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

Side by Side Diff: chrome/browser/chromeos/drive/file_system/open_file_operation_unittest.cc

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/chromeos/drive/file_system/open_file_operation.h" 5 #include "chrome/browser/chromeos/drive/file_system/open_file_operation.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 29 matching lines...) Expand all
40 const int64 file_size = src_entry.file_info().size(); 40 const int64 file_size = src_entry.file_info().size();
41 41
42 FileError error = FILE_ERROR_FAILED; 42 FileError error = FILE_ERROR_FAILED;
43 base::FilePath file_path; 43 base::FilePath file_path;
44 operation_->OpenFile( 44 operation_->OpenFile(
45 file_in_root, 45 file_in_root,
46 google_apis::test_util::CreateCopyResultCallback(&error, &file_path)); 46 google_apis::test_util::CreateCopyResultCallback(&error, &file_path));
47 test_util::RunBlockingPoolTask(); 47 test_util::RunBlockingPoolTask();
48 48
49 EXPECT_EQ(FILE_ERROR_OK, error); 49 EXPECT_EQ(FILE_ERROR_OK, error);
50 ASSERT_TRUE(file_util::PathExists(file_path)); 50 ASSERT_TRUE(base::PathExists(file_path));
51 int64 local_file_size; 51 int64 local_file_size;
52 ASSERT_TRUE(file_util::GetFileSize(file_path, &local_file_size)); 52 ASSERT_TRUE(file_util::GetFileSize(file_path, &local_file_size));
53 EXPECT_EQ(file_size, local_file_size); 53 EXPECT_EQ(file_size, local_file_size);
54 54
55 // The file_path should be added into the set. 55 // The file_path should be added into the set.
56 EXPECT_EQ(1, open_files_[file_in_root]); 56 EXPECT_EQ(1, open_files_[file_in_root]);
57 57
58 // Open again. 58 // Open again.
59 error = FILE_ERROR_FAILED; 59 error = FILE_ERROR_FAILED;
60 operation_->OpenFile( 60 operation_->OpenFile(
61 file_in_root, 61 file_in_root,
62 google_apis::test_util::CreateCopyResultCallback(&error, &file_path)); 62 google_apis::test_util::CreateCopyResultCallback(&error, &file_path));
63 test_util::RunBlockingPoolTask(); 63 test_util::RunBlockingPoolTask();
64 64
65 EXPECT_EQ(FILE_ERROR_OK, error); 65 EXPECT_EQ(FILE_ERROR_OK, error);
66 ASSERT_TRUE(file_util::PathExists(file_path)); 66 ASSERT_TRUE(base::PathExists(file_path));
67 ASSERT_TRUE(file_util::GetFileSize(file_path, &local_file_size)); 67 ASSERT_TRUE(file_util::GetFileSize(file_path, &local_file_size));
68 EXPECT_EQ(file_size, local_file_size); 68 EXPECT_EQ(file_size, local_file_size);
69 69
70 // The file_path should be added into the set. 70 // The file_path should be added into the set.
71 EXPECT_EQ(2, open_files_[file_in_root]); 71 EXPECT_EQ(2, open_files_[file_in_root]);
72 } 72 }
73 73
74 TEST_F(OpenFileOperationTest, NotFound) { 74 TEST_F(OpenFileOperationTest, NotFound) {
75 const base::FilePath file_in_root( 75 const base::FilePath file_in_root(
76 FILE_PATH_LITERAL("drive/root/not-exist.txt")); 76 FILE_PATH_LITERAL("drive/root/not-exist.txt"));
77 77
78 FileError error = FILE_ERROR_FAILED; 78 FileError error = FILE_ERROR_FAILED;
79 base::FilePath file_path; 79 base::FilePath file_path;
80 operation_->OpenFile( 80 operation_->OpenFile(
81 file_in_root, 81 file_in_root,
82 google_apis::test_util::CreateCopyResultCallback(&error, &file_path)); 82 google_apis::test_util::CreateCopyResultCallback(&error, &file_path));
83 test_util::RunBlockingPoolTask(); 83 test_util::RunBlockingPoolTask();
84 EXPECT_EQ(FILE_ERROR_NOT_FOUND, error); 84 EXPECT_EQ(FILE_ERROR_NOT_FOUND, error);
85 85
86 // The file shouldn't be in the set of opened files. 86 // The file shouldn't be in the set of opened files.
87 EXPECT_EQ(0U, open_files_.count(file_in_root)); 87 EXPECT_EQ(0U, open_files_.count(file_in_root));
88 } 88 }
89 89
90 } // namespace file_system 90 } // namespace file_system
91 } // namespace drive 91 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_cache_unittest.cc ('k') | chrome/browser/chromeos/drive/file_system_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698