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

Side by Side Diff: chrome/browser/storage_monitor/image_capture_device_manager_unittest.mm

Issue 109043002: Move more file_util functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 // contents to a separate filename, mimicking the ImageCaptureCore 384 // contents to a separate filename, mimicking the ImageCaptureCore
385 // library behavior. Our code then renames the file onto the requested 385 // library behavior. Our code then renames the file onto the requested
386 // destination. 386 // destination.
387 [camera downloadFile:kTestFileName localPath:temp_file]; 387 [camera downloadFile:kTestFileName localPath:temp_file];
388 base::RunLoop().RunUntilIdle(); 388 base::RunLoop().RunUntilIdle();
389 389
390 ASSERT_EQ(2U, listener_.downloads().size()); 390 ASSERT_EQ(2U, listener_.downloads().size());
391 EXPECT_EQ(kTestFileName, listener_.downloads()[1]); 391 EXPECT_EQ(kTestFileName, listener_.downloads()[1]);
392 ASSERT_EQ(base::PLATFORM_FILE_OK, listener_.last_error()); 392 ASSERT_EQ(base::PLATFORM_FILE_OK, listener_.last_error());
393 char file_contents[5]; 393 char file_contents[5];
394 ASSERT_EQ(4, file_util::ReadFile(temp_file, file_contents, 394 ASSERT_EQ(4, base::ReadFile(temp_file, file_contents,
395 strlen(kTestFileContents))); 395 strlen(kTestFileContents)));
396 EXPECT_EQ(kTestFileContents, 396 EXPECT_EQ(kTestFileContents,
397 std::string(file_contents, strlen(kTestFileContents))); 397 std::string(file_contents, strlen(kTestFileContents)));
398 398
399 [camera didRemoveDevice:device]; 399 [camera didRemoveDevice:device];
400 } 400 }
401 401
402 TEST_F(ImageCaptureDeviceManagerTest, TestSubdirectories) { 402 TEST_F(ImageCaptureDeviceManagerTest, TestSubdirectories) {
403 ImageCaptureDeviceManager manager; 403 ImageCaptureDeviceManager manager;
404 manager.SetNotifications(monitor_->receiver()); 404 manager.SetNotifications(monitor_->receiver());
405 MockICCameraDevice* device = AttachDevice(&manager); 405 MockICCameraDevice* device = AttachDevice(&manager);
(...skipping 12 matching lines...) Expand all
418 [camera cameraDevice:nil didAddItem:picture1]; 418 [camera cameraDevice:nil didAddItem:picture1];
419 419
420 base::ScopedTempDir temp_dir; 420 base::ScopedTempDir temp_dir;
421 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 421 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
422 base::FilePath temp_file = temp_dir.path().Append("tempfile"); 422 base::FilePath temp_file = temp_dir.path().Append("tempfile");
423 423
424 [camera downloadFile:("dir/" + kTestFileName) localPath:temp_file]; 424 [camera downloadFile:("dir/" + kTestFileName) localPath:temp_file];
425 base::RunLoop().RunUntilIdle(); 425 base::RunLoop().RunUntilIdle();
426 426
427 char file_contents[5]; 427 char file_contents[5];
428 ASSERT_EQ(4, file_util::ReadFile(temp_file, file_contents, 428 ASSERT_EQ(4, base::ReadFile(temp_file, file_contents,
429 strlen(kTestFileContents))); 429 strlen(kTestFileContents)));
430 EXPECT_EQ(kTestFileContents, 430 EXPECT_EQ(kTestFileContents,
431 std::string(file_contents, strlen(kTestFileContents))); 431 std::string(file_contents, strlen(kTestFileContents)));
432 432
433 [camera didRemoveDevice:device]; 433 [camera didRemoveDevice:device];
434 } 434 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc ('k') | chrome/browser/ui/pdf/pdf_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698