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

Side by Side Diff: chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac_unittest.mm

Issue 12255023: [Media Galleries] Switch Mac MTP delegate to async interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test for overlapped ReadDir Created 7 years, 8 months 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
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 #import <Foundation/Foundation.h> 5 #import <Foundation/Foundation.h>
6 #import <ImageCaptureCore/ImageCaptureCore.h> 6 #import <ImageCaptureCore/ImageCaptureCore.h>
7 7
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/files/scoped_temp_dir.h"
9 #include "base/mac/cocoa_protocols.h" 10 #include "base/mac/cocoa_protocols.h"
10 #include "base/mac/foundation_util.h" 11 #include "base/mac/foundation_util.h"
11 #include "base/memory/scoped_nsobject.h" 12 #include "base/memory/scoped_nsobject.h"
12 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/run_loop.h"
13 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
14 #include "base/strings/sys_string_conversions.h" 16 #include "base/strings/sys_string_conversions.h"
15 #include "base/test/sequenced_worker_pool_owner.h" 17 #include "base/test/sequenced_worker_pool_owner.h"
16 #include "base/threading/sequenced_worker_pool.h" 18 #include "base/threading/sequenced_worker_pool.h"
17 #include "chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.h" 19 #include "chrome/browser/media_galleries/mac/mtp_device_delegate_impl_mac.h"
18 #include "chrome/browser/storage_monitor/image_capture_device_manager.h" 20 #include "chrome/browser/storage_monitor/image_capture_device_manager.h"
19 #include "chrome/browser/storage_monitor/test_storage_monitor.h" 21 #include "chrome/browser/storage_monitor/test_storage_monitor.h"
20 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
21 #include "content/public/test/test_browser_thread.h" 23 #include "content/public/test/test_browser_thread.h"
22 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 event->Signal(); 170 event->Signal();
169 } 171 }
170 172
171 class MTPDeviceDelegateImplMacTest : public testing::Test { 173 class MTPDeviceDelegateImplMacTest : public testing::Test {
172 public: 174 public:
173 MTPDeviceDelegateImplMacTest() : camera_(NULL), delegate_(NULL) {} 175 MTPDeviceDelegateImplMacTest() : camera_(NULL), delegate_(NULL) {}
174 176
175 virtual void SetUp() OVERRIDE { 177 virtual void SetUp() OVERRIDE {
176 ui_thread_.reset(new content::TestBrowserThread( 178 ui_thread_.reset(new content::TestBrowserThread(
177 content::BrowserThread::UI, &message_loop_)); 179 content::BrowserThread::UI, &message_loop_));
180 file_thread_.reset(new content::TestBrowserThread(
181 content::BrowserThread::FILE, &message_loop_));
182 io_thread_.reset(new content::TestBrowserThread(
183 content::BrowserThread::IO));
184 ASSERT_TRUE(io_thread_->Start());
185 // Need a waitable event on io thread startup?
Lei Zhang 2013/04/04 03:46:21 remove?
Greg Billock 2013/04/04 17:00:51 Done.
178 186
179 manager_.SetNotifications(monitor_.receiver()); 187 manager_.SetNotifications(monitor_.receiver());
180 188
181 camera_ = [MockMTPICCameraDevice alloc]; 189 camera_ = [MockMTPICCameraDevice alloc];
182 id<ICDeviceBrowserDelegate> delegate = manager_.device_browser(); 190 id<ICDeviceBrowserDelegate> delegate = manager_.device_browser();
183 [delegate deviceBrowser:nil didAddDevice:camera_ moreComing:NO]; 191 [delegate deviceBrowser:nil didAddDevice:camera_ moreComing:NO];
184 192
185 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); 193 delegate_ = new chrome::MTPDeviceDelegateImplMac("id", "/ic:id");
Lei Zhang 2013/04/04 03:46:21 there's already a const for "id", and constify "/i
Greg Billock 2013/04/04 17:00:51 Done.
186 task_runner_ = pool->GetSequencedTaskRunner( 194 }
187 pool->GetNamedSequenceToken("token-name")); 195
188 delegate_ = new chrome::MTPDeviceDelegateImplMac( 196 void OnError(base::WaitableEvent* event, base::PlatformFileError error) {
189 "id", "/ic:id", task_runner_.get()); 197 error_ = error;
198 event->Signal();
199 }
200
201 void OverlappedOnError(base::WaitableEvent* event,
202 base::PlatformFileError error) {
203 overlapped_error_ = error;
204 event->Signal();
205 }
Lei Zhang 2013/04/04 03:46:21 nit: separate with newline
Greg Billock 2013/04/04 17:00:51 Done.
206 void OnFileInfo(base::WaitableEvent* event,
207 const base::PlatformFileInfo& info) {
208 error_ = base::PLATFORM_FILE_OK;
209 info_ = info;
210 event->Signal();
211 }
212
213 void OnReadDir(base::WaitableEvent* event,
214 const fileapi::AsyncFileUtil::EntryList& files,
215 bool has_more) {
216 error_ = base::PLATFORM_FILE_OK;
217 ASSERT_FALSE(has_more);
218 file_list_ = files;
219 event->Signal();
220 }
221
222 void OverlappedOnReadDir(base::WaitableEvent* event,
223 const fileapi::AsyncFileUtil::EntryList& files,
224 bool has_more) {
225 overlapped_error_ = base::PLATFORM_FILE_OK;
226 ASSERT_FALSE(has_more);
227 overlapped_file_list_ = files;
228 event->Signal();
229 }
230
231 void OnDownload(base::WaitableEvent* event,
232 const base::PlatformFileInfo& file_info,
233 const base::FilePath& local_path) {
234 error_ = base::PLATFORM_FILE_OK;
235 event->Signal();
236 }
237
238 base::PlatformFileError GetFileInfo(const base::FilePath& path,
239 base::PlatformFileInfo* info) {
240 base::WaitableEvent wait(true, false);
Lei Zhang 2013/04/04 03:46:21 IWYU for WaitableEvent.
Greg Billock 2013/04/04 17:00:51 It's there.
241 delegate_->GetFileInfo(
242 path,
243 base::Bind(&MTPDeviceDelegateImplMacTest::OnFileInfo,
244 base::Unretained(this),
245 &wait),
246 base::Bind(&MTPDeviceDelegateImplMacTest::OnError,
247 base::Unretained(this),
248 &wait));
249 base::RunLoop loop;
250 loop.RunUntilIdle();
251 wait.Wait();
Lei Zhang 2013/04/04 03:46:21 Can we just check IsSignaled() instead? If we alre
Greg Billock 2013/04/04 17:00:51 Done.
252 *info = info_;
253 return error_;
254 }
255
256 base::PlatformFileError ReadDir(const base::FilePath& path) {
257 base::WaitableEvent wait(true, false);
258 delegate_->ReadDirectory(
259 path,
260 base::Bind(&MTPDeviceDelegateImplMacTest::OnReadDir,
261 base::Unretained(this),
262 &wait),
263 base::Bind(&MTPDeviceDelegateImplMacTest::OnError,
264 base::Unretained(this),
265 &wait));
266 base::RunLoop loop;
267 loop.RunUntilIdle();
268 wait.Wait();
269 return error_;
270 }
271
272 base::PlatformFileError DownloadFile(
273 const base::FilePath& path,
274 const base::FilePath& local_path) {
275 base::WaitableEvent wait(true, false);
276 delegate_->CreateSnapshotFile(
277 path, local_path,
278 base::Bind(&MTPDeviceDelegateImplMacTest::OnDownload,
279 base::Unretained(this),
280 &wait),
281 base::Bind(&MTPDeviceDelegateImplMacTest::OnError,
282 base::Unretained(this),
283 &wait));
284 base::RunLoop loop;
285 loop.RunUntilIdle();
286 wait.Wait();
287 return error_;
190 } 288 }
191 289
192 virtual void TearDown() OVERRIDE { 290 virtual void TearDown() OVERRIDE {
193 id<ICDeviceBrowserDelegate> delegate = manager_.device_browser(); 291 id<ICDeviceBrowserDelegate> delegate = manager_.device_browser();
194 [delegate deviceBrowser:nil didRemoveDevice:camera_ moreGoing:NO]; 292 [delegate deviceBrowser:nil didRemoveDevice:camera_ moreGoing:NO];
195 293
196 task_runner_->PostTask(FROM_HERE, 294 delegate_->CancelPendingTasksAndDeleteDelegate();
197 base::Bind(&chrome::MTPDeviceDelegateImplMac:: 295
198 CancelPendingTasksAndDeleteDelegate, 296 io_thread_->Stop();
199 base::Unretained(delegate_)));
200 } 297 }
201 298
202 protected: 299 protected:
203 MessageLoopForUI message_loop_; 300 MessageLoopForUI message_loop_;
301 // Note: threads must be made in this order: UI > FILE > IO
204 scoped_ptr<content::TestBrowserThread> ui_thread_; 302 scoped_ptr<content::TestBrowserThread> ui_thread_;
303 scoped_ptr<content::TestBrowserThread> file_thread_;
304 scoped_ptr<content::TestBrowserThread> io_thread_;
305 base::ScopedTempDir temp_dir_;
205 chrome::test::TestStorageMonitor monitor_; 306 chrome::test::TestStorageMonitor monitor_;
206 chrome::ImageCaptureDeviceManager manager_; 307 chrome::ImageCaptureDeviceManager manager_;
207 ICCameraDevice* camera_; 308 MockMTPICCameraDevice* camera_;
208 scoped_refptr<base::SequencedTaskRunner> task_runner_;
209 309
210 // This object needs special deletion inside the above |task_runner_|. 310 // This object needs special deletion inside the above |task_runner_|.
211 chrome::MTPDeviceDelegateImplMac* delegate_; 311 chrome::MTPDeviceDelegateImplMac* delegate_;
212 312
313 base::PlatformFileError error_;
314 base::PlatformFileInfo info_;
315 fileapi::AsyncFileUtil::EntryList file_list_;
316
317 base::PlatformFileError overlapped_error_;
318 fileapi::AsyncFileUtil::EntryList overlapped_file_list_;
319
213 private: 320 private:
214 DISALLOW_COPY_AND_ASSIGN(MTPDeviceDelegateImplMacTest); 321 DISALLOW_COPY_AND_ASSIGN(MTPDeviceDelegateImplMacTest);
215 }; 322 };
216 323
217 TEST_F(MTPDeviceDelegateImplMacTest, TestGetRootFileInfo) { 324 TEST_F(MTPDeviceDelegateImplMacTest, TestGetRootFileInfo) {
218 base::PlatformFileInfo info; 325 base::PlatformFileInfo info;
219 // Making a fresh delegate should have a single file entry for the synthetic 326 // Making a fresh delegate should have a single file entry for the synthetic
220 // root directory, with the name equal to the device id string. 327 // root directory, with the name equal to the device id string.
221 EXPECT_EQ(base::PLATFORM_FILE_OK, 328 EXPECT_EQ(base::PLATFORM_FILE_OK,
222 delegate_->GetFileInfo(base::FilePath("/ic:id"), &info)); 329 GetFileInfo(base::FilePath("/ic:id"), &info));
223 EXPECT_TRUE(info.is_directory); 330 EXPECT_TRUE(info.is_directory);
224 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, 331 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
225 delegate_->GetFileInfo(base::FilePath("/nonexistent"), &info)); 332 GetFileInfo(base::FilePath("/nonexistent"), &info));
226 333
227 // Signal the delegate that no files are coming. 334 // Signal the delegate that no files are coming.
228 delegate_->NoMoreItems(); 335 delegate_->NoMoreItems();
229 336
230 scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator> enumerator = 337 EXPECT_EQ(base::PLATFORM_FILE_OK, ReadDir(base::FilePath("/ic:id")));
231 delegate_->CreateFileEnumerator(base::FilePath("/ic:id"), true); 338 EXPECT_EQ(0U, file_list_.size());
232 EXPECT_TRUE(enumerator->Next().empty()); 339 }
340
341 TEST_F(MTPDeviceDelegateImplMacTest, TestOverlappedReadDir) {
342 base::Time time1 = base::Time::Now();
343 base::PlatformFileInfo info1;
344 info1.size = 1;
345 info1.is_directory = false;
346 info1.is_symbolic_link = false;
347 info1.last_modified = time1;
348 info1.last_accessed = time1;
349 info1.creation_time = time1;
350 delegate_->ItemAdded("name1", info1);
351
352 base::WaitableEvent wait(true, false);
353
354 delegate_->ReadDirectory(
355 base::FilePath("/ic:id"),
356 base::Bind(&MTPDeviceDelegateImplMacTest::OnReadDir,
357 base::Unretained(this),
358 &wait),
359 base::Bind(&MTPDeviceDelegateImplMacTest::OnError,
360 base::Unretained(this),
361 &wait));
362
363 delegate_->ReadDirectory(
364 base::FilePath("/ic:id"),
365 base::Bind(&MTPDeviceDelegateImplMacTest::OverlappedOnReadDir,
366 base::Unretained(this),
367 &wait),
368 base::Bind(&MTPDeviceDelegateImplMacTest::OverlappedOnError,
369 base::Unretained(this),
370 &wait));
371
372
373 // Signal the delegate that no files are coming.
374 delegate_->NoMoreItems();
375
376 base::RunLoop loop;
377 loop.RunUntilIdle();
378 wait.Wait();
379
380 EXPECT_EQ(base::PLATFORM_FILE_OK, error_);
381 EXPECT_EQ(1U, file_list_.size());
382 EXPECT_EQ(base::PLATFORM_FILE_OK, overlapped_error_);
383 EXPECT_EQ(1U, overlapped_file_list_.size());
233 } 384 }
234 385
235 TEST_F(MTPDeviceDelegateImplMacTest, TestGetFileInfo) { 386 TEST_F(MTPDeviceDelegateImplMacTest, TestGetFileInfo) {
236 base::Time time1 = base::Time::Now(); 387 base::Time time1 = base::Time::Now();
237 base::PlatformFileInfo info1; 388 base::PlatformFileInfo info1;
238 info1.size = 1; 389 info1.size = 1;
239 info1.is_directory = false; 390 info1.is_directory = false;
240 info1.is_symbolic_link = false; 391 info1.is_symbolic_link = false;
241 info1.last_modified = time1; 392 info1.last_modified = time1;
242 info1.last_accessed = time1; 393 info1.last_accessed = time1;
243 info1.creation_time = time1; 394 info1.creation_time = time1;
244 delegate_->ItemAdded("name1", info1); 395 delegate_->ItemAdded("name1", info1);
245 396
246 base::PlatformFileInfo info; 397 base::PlatformFileInfo info;
247 EXPECT_EQ(base::PLATFORM_FILE_OK, 398 EXPECT_EQ(base::PLATFORM_FILE_OK,
248 delegate_->GetFileInfo(base::FilePath("/ic:id/name1"), &info)); 399 GetFileInfo(base::FilePath("/ic:id/name1"), &info));
249 EXPECT_EQ(info1.size, info.size); 400 EXPECT_EQ(info1.size, info.size);
250 EXPECT_EQ(info1.is_directory, info.is_directory); 401 EXPECT_EQ(info1.is_directory, info.is_directory);
251 EXPECT_EQ(info1.last_modified, info.last_modified); 402 EXPECT_EQ(info1.last_modified, info.last_modified);
252 EXPECT_EQ(info1.last_accessed, info.last_accessed); 403 EXPECT_EQ(info1.last_accessed, info.last_accessed);
253 EXPECT_EQ(info1.creation_time, info.creation_time); 404 EXPECT_EQ(info1.creation_time, info.creation_time);
254 405
255 info1.size = 2; 406 info1.size = 2;
256 delegate_->ItemAdded("name2", info1); 407 delegate_->ItemAdded("name2", info1);
257 delegate_->NoMoreItems(); 408 delegate_->NoMoreItems();
258 409
259 EXPECT_EQ(base::PLATFORM_FILE_OK, 410 EXPECT_EQ(base::PLATFORM_FILE_OK,
260 delegate_->GetFileInfo(base::FilePath("/ic:id/name2"), &info)); 411 GetFileInfo(base::FilePath("/ic:id/name2"), &info));
261 EXPECT_EQ(info1.size, info.size); 412 EXPECT_EQ(info1.size, info.size);
262 413
263 scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator> enumerator = 414 EXPECT_EQ(base::PLATFORM_FILE_OK, ReadDir(base::FilePath("/ic:id")));
264 delegate_->CreateFileEnumerator(base::FilePath("/ic:id"), true);
265 base::FilePath next = enumerator->Next();
266 ASSERT_FALSE(next.empty());
267 EXPECT_EQ(1, enumerator->Size());
268 EXPECT_EQ(time1, enumerator->LastModifiedTime());
269 EXPECT_FALSE(enumerator->IsDirectory());
270 EXPECT_EQ("/ic:id/name1", next.value());
271 415
272 next = enumerator->Next(); 416 ASSERT_EQ(2U, file_list_.size());
273 ASSERT_FALSE(next.empty()); 417 EXPECT_EQ(time1, file_list_[0].last_modified_time);
274 EXPECT_EQ(2, enumerator->Size()); 418 EXPECT_FALSE(file_list_[0].is_directory);
275 EXPECT_EQ(time1, enumerator->LastModifiedTime()); 419 EXPECT_EQ("/ic:id/name1", file_list_[0].name);
276 EXPECT_FALSE(enumerator->IsDirectory());
277 EXPECT_EQ("/ic:id/name2", next.value());
278 420
279 next = enumerator->Next(); 421 EXPECT_EQ(time1, file_list_[1].last_modified_time);
280 EXPECT_TRUE(next.empty()); 422 EXPECT_FALSE(file_list_[1].is_directory);
423 EXPECT_EQ("/ic:id/name2", file_list_[1].name);
281 } 424 }
282 425
283 TEST_F(MTPDeviceDelegateImplMacTest, TestIgnoreDirectories) { 426 TEST_F(MTPDeviceDelegateImplMacTest, TestIgnoreDirectories) {
284 base::Time time1 = base::Time::Now(); 427 base::Time time1 = base::Time::Now();
285 base::PlatformFileInfo info1; 428 base::PlatformFileInfo info1;
286 info1.size = 1; 429 info1.size = 1;
287 info1.is_directory = false; 430 info1.is_directory = false;
288 info1.is_symbolic_link = false; 431 info1.is_symbolic_link = false;
289 info1.last_modified = time1; 432 info1.last_modified = time1;
290 info1.last_accessed = time1; 433 info1.last_accessed = time1;
291 info1.creation_time = time1; 434 info1.creation_time = time1;
292 delegate_->ItemAdded("name1", info1); 435 delegate_->ItemAdded("name1", info1);
293 436
294 info1.is_directory = true; 437 info1.is_directory = true;
295 delegate_->ItemAdded("dir1", info1); 438 delegate_->ItemAdded("dir1", info1);
296 delegate_->ItemAdded("dir2", info1); 439 delegate_->ItemAdded("dir2", info1);
297 440
298 info1.is_directory = false; 441 info1.is_directory = false;
299 delegate_->ItemAdded("name2", info1); 442 delegate_->ItemAdded("name2", info1);
300 delegate_->NoMoreItems(); 443 delegate_->NoMoreItems();
301 444
302 scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator> enumerator = 445 EXPECT_EQ(base::PLATFORM_FILE_OK, ReadDir(base::FilePath("/ic:id")));
303 delegate_->CreateFileEnumerator(base::FilePath("/ic:id"), true);
304 base::FilePath next = enumerator->Next();
305 ASSERT_FALSE(next.empty());
306 EXPECT_EQ("/ic:id/name1", next.value());
307 446
308 next = enumerator->Next(); 447 ASSERT_EQ(2U, file_list_.size());
309 ASSERT_FALSE(next.empty()); 448 EXPECT_EQ(time1, file_list_[0].last_modified_time);
310 EXPECT_EQ("/ic:id/name2", next.value()); 449 EXPECT_FALSE(file_list_[0].is_directory);
450 EXPECT_EQ("/ic:id/name1", file_list_[0].name);
311 451
312 next = enumerator->Next(); 452 EXPECT_EQ(time1, file_list_[1].last_modified_time);
313 EXPECT_TRUE(next.empty()); 453 EXPECT_FALSE(file_list_[1].is_directory);
454 EXPECT_EQ("/ic:id/name2", file_list_[1].name);
314 } 455 }
315 456
316 TEST_F(MTPDeviceDelegateImplMacTest, EnumeratorWaitsForEntries) { 457 TEST_F(MTPDeviceDelegateImplMacTest, TestDownload) {
317 base::Time time1 = base::Time::Now(); 458 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
318 base::PlatformFileInfo info1; 459 base::Time t1 = base::Time::Now();
319 info1.size = 1; 460 base::PlatformFileInfo info;
320 info1.is_directory = false; 461 info.size = 4;
321 info1.is_symbolic_link = false; 462 info.is_directory = false;
322 info1.last_modified = time1; 463 info.is_symbolic_link = false;
323 info1.last_accessed = time1; 464 info.last_modified = t1;
324 info1.creation_time = time1; 465 info.last_accessed = t1;
325 delegate_->ItemAdded("name1", info1); 466 info.creation_time = t1;
467 std::string kTestFileName("filename");
468 scoped_nsobject<MockMTPICCameraFile> picture1(
469 [[MockMTPICCameraFile alloc]
470 init:base::SysUTF8ToNSString(kTestFileName)]);
471 [camera_ addMediaFile:picture1];
472 delegate_->ItemAdded(kTestFileName, info);
473 delegate_->NoMoreItems();
326 474
327 scoped_ptr<fileapi::FileSystemFileUtil::AbstractFileEnumerator> enumerator = 475 EXPECT_EQ(base::PLATFORM_FILE_OK, ReadDir(base::FilePath("/ic:id")));
328 delegate_->CreateFileEnumerator(base::FilePath("/ic:id"), true); 476 ASSERT_EQ(1U, file_list_.size());
329 // Event is manually reset, initially unsignaled 477 ASSERT_EQ("/ic:id/filename", file_list_[0].name);
330 base::WaitableEvent event(true, false);
331 base::FilePath next;
332 task_runner_->PostTask(FROM_HERE,
333 base::Bind(&EnumerateAndSignal,
334 enumerator.get(), &event, &next));
335 message_loop_.RunUntilIdle();
336 ASSERT_TRUE(event.IsSignaled());
337 EXPECT_EQ("/ic:id/name1", next.value());
338 478
339 event.Reset(); 479 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND,
480 DownloadFile(base::FilePath("/ic:id/nonexist"),
481 temp_dir_.path().Append("target")));
340 482
341 // This method will block until it is sure there are no more items. 483 EXPECT_EQ(base::PLATFORM_FILE_OK,
342 task_runner_->PostTask(FROM_HERE, 484 DownloadFile(base::FilePath("/ic:id/filename"),
343 base::Bind(&EnumerateAndSignal, 485 temp_dir_.path().Append("target")));
344 enumerator.get(), &event, &next)); 486 std::string contents;
345 message_loop_.RunUntilIdle(); 487 EXPECT_TRUE(file_util::ReadFileToString(temp_dir_.path().Append("target"),
346 ASSERT_FALSE(event.IsSignaled()); 488 &contents));
347 delegate_->NoMoreItems(); 489 EXPECT_EQ(kTestFileContents, contents);
348 event.Wait();
349 ASSERT_TRUE(event.IsSignaled());
350 EXPECT_TRUE(next.empty());
351 message_loop_.RunUntilIdle();
352 } 490 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698