Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Side by Side Diff: net/base/directory_lister_unittest.cc

Issue 11359217: Move scoped_temp_dir from base to base/files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « crypto/nss_util.cc ('k') | net/base/upload_data_stream_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/file_path.h" 5 #include "base/file_path.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/files/scoped_temp_dir.h"
7 #include "base/i18n/file_util_icu.h" 8 #include "base/i18n/file_util_icu.h"
8 #include "base/logging.h" 9 #include "base/logging.h"
9 #include "base/message_loop.h" 10 #include "base/message_loop.h"
10 #include "base/path_service.h" 11 #include "base/path_service.h"
11 #include "base/scoped_temp_dir.h"
12 #include "net/base/directory_lister.h" 12 #include "net/base/directory_lister.h"
13 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 namespace net { 16 namespace net {
17 17
18 class ListerDelegate : public DirectoryLister::DirectoryListerDelegate { 18 class ListerDelegate : public DirectoryLister::DirectoryListerDelegate {
19 public: 19 public:
20 ListerDelegate(bool recursive, 20 ListerDelegate(bool recursive,
21 bool quit_loop_after_each_file) 21 bool quit_loop_after_each_file)
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 int num_files = delegate.num_files(); 125 int num_files = delegate.num_files();
126 126
127 lister.Cancel(); 127 lister.Cancel();
128 128
129 MessageLoop::current()->RunUntilIdle(); 129 MessageLoop::current()->RunUntilIdle();
130 130
131 EXPECT_EQ(num_files, delegate.num_files()); 131 EXPECT_EQ(num_files, delegate.num_files());
132 } 132 }
133 133
134 TEST(DirectoryListerTest, EmptyDirTest) { 134 TEST(DirectoryListerTest, EmptyDirTest) {
135 ScopedTempDir tempDir; 135 base::ScopedTempDir tempDir;
136 EXPECT_TRUE(tempDir.CreateUniqueTempDir()); 136 EXPECT_TRUE(tempDir.CreateUniqueTempDir());
137 137
138 bool kRecursive = false; 138 bool kRecursive = false;
139 bool kQuitLoopAfterEachFile = false; 139 bool kQuitLoopAfterEachFile = false;
140 ListerDelegate delegate(kRecursive, kQuitLoopAfterEachFile); 140 ListerDelegate delegate(kRecursive, kQuitLoopAfterEachFile);
141 DirectoryLister lister(tempDir.path(), &delegate); 141 DirectoryLister lister(tempDir.path(), &delegate);
142 lister.Start(); 142 lister.Start();
143 143
144 MessageLoop::current()->Run(); 144 MessageLoop::current()->Run();
145 145
146 // Contains only the parent directory ("..") 146 // Contains only the parent directory ("..")
147 EXPECT_EQ(1, delegate.num_files()); 147 EXPECT_EQ(1, delegate.num_files());
148 EXPECT_EQ(OK, delegate.error()); 148 EXPECT_EQ(OK, delegate.error());
149 } 149 }
150 150
151 } // namespace net 151 } // namespace net
OLDNEW
« no previous file with comments | « crypto/nss_util.cc ('k') | net/base/upload_data_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698