OLD | NEW |
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 "chrome/browser/chromeos/drive/drive_file_system.h" | 5 #include "chrome/browser/chromeos/drive/drive_file_system.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "chrome/browser/chromeos/drive/drive_test_util.h" | 23 #include "chrome/browser/chromeos/drive/drive_test_util.h" |
24 #include "chrome/browser/chromeos/drive/drive_webapps_registry.h" | 24 #include "chrome/browser/chromeos/drive/drive_webapps_registry.h" |
25 #include "chrome/browser/chromeos/drive/file_system/remove_operation.h" | 25 #include "chrome/browser/chromeos/drive/file_system/remove_operation.h" |
26 #include "chrome/browser/chromeos/drive/mock_directory_change_observer.h" | 26 #include "chrome/browser/chromeos/drive/mock_directory_change_observer.h" |
27 #include "chrome/browser/chromeos/drive/mock_drive_cache_observer.h" | 27 #include "chrome/browser/chromeos/drive/mock_drive_cache_observer.h" |
28 #include "chrome/browser/chromeos/drive/mock_drive_web_apps_registry.h" | 28 #include "chrome/browser/chromeos/drive/mock_drive_web_apps_registry.h" |
29 #include "chrome/browser/chromeos/drive/mock_free_disk_space_getter.h" | 29 #include "chrome/browser/chromeos/drive/mock_free_disk_space_getter.h" |
30 #include "chrome/browser/google_apis/drive_api_parser.h" | 30 #include "chrome/browser/google_apis/drive_api_parser.h" |
31 #include "chrome/browser/google_apis/drive_uploader.h" | 31 #include "chrome/browser/google_apis/drive_uploader.h" |
32 #include "chrome/browser/google_apis/mock_drive_service.h" | 32 #include "chrome/browser/google_apis/mock_drive_service.h" |
33 #include "chrome/browser/google_apis/mock_drive_uploader.h" | |
34 #include "chrome/common/chrome_paths.h" | 33 #include "chrome/common/chrome_paths.h" |
35 #include "chrome/test/base/testing_profile.h" | 34 #include "chrome/test/base/testing_profile.h" |
36 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
37 #include "content/public/test/test_browser_thread.h" | 36 #include "content/public/test/test_browser_thread.h" |
38 #include "testing/gmock/include/gmock/gmock.h" | 37 #include "testing/gmock/include/gmock/gmock.h" |
39 #include "testing/gtest/include/gtest/gtest.h" | 38 #include "testing/gtest/include/gtest/gtest.h" |
40 | 39 |
41 using ::testing::AnyNumber; | 40 using ::testing::AnyNumber; |
42 using ::testing::AtLeast; | 41 using ::testing::AtLeast; |
43 using ::testing::Eq; | 42 using ::testing::Eq; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } | 83 } |
85 | 84 |
86 // Action used to set mock expectations for | 85 // Action used to set mock expectations for |
87 // DriveServiceInterface::GetDocumentEntry(). | 86 // DriveServiceInterface::GetDocumentEntry(). |
88 ACTION_P2(MockGetDocumentEntry, status, value) { | 87 ACTION_P2(MockGetDocumentEntry, status, value) { |
89 base::MessageLoopProxy::current()->PostTask(FROM_HERE, | 88 base::MessageLoopProxy::current()->PostTask(FROM_HERE, |
90 base::Bind(arg1, status, base::Passed(value))); | 89 base::Bind(arg1, status, base::Passed(value))); |
91 } | 90 } |
92 | 91 |
93 // Action used to set mock expectations for | 92 // Action used to set mock expectations for |
94 // DriveUploaderInterface::UploadExistingFile(). | |
95 ACTION_P4(MockUploadExistingFile, | |
96 error, drive_path, local_file_path, document_entry) { | |
97 scoped_ptr<google_apis::DocumentEntry> scoped_document_entry(document_entry); | |
98 base::MessageLoopProxy::current()->PostTask(FROM_HERE, | |
99 base::Bind(arg5, | |
100 error, | |
101 drive_path, | |
102 local_file_path, | |
103 base::Passed(&scoped_document_entry))); | |
104 | |
105 const int kUploadId = 123; | |
106 return kUploadId; | |
107 } | |
108 | |
109 // Action used to set mock expectations for | |
110 // DriveUploaderInterface::UploadNewFile(). | |
111 ACTION(MockUploadNewFile) { | |
112 scoped_ptr<base::Value> value = | |
113 google_apis::test_util::LoadJSONFile("gdata/uploaded_file.json"); | |
114 scoped_ptr<google_apis::DocumentEntry> document_entry( | |
115 google_apis::DocumentEntry::ExtractAndParse(*value)); | |
116 | |
117 base::MessageLoopProxy::current()->PostTask(FROM_HERE, | |
118 base::Bind(arg7, | |
119 google_apis::DRIVE_UPLOAD_OK, | |
120 arg1, | |
121 arg2, | |
122 base::Passed(&document_entry))); | |
123 | |
124 const int kUploadId = 123; | |
125 return kUploadId; | |
126 } | |
127 | |
128 // Action used to set mock expectations for | |
129 // DriveFileSystem::CopyDocument(). | 93 // DriveFileSystem::CopyDocument(). |
130 ACTION_P2(MockCopyDocument, status, value) { | 94 ACTION_P2(MockCopyDocument, status, value) { |
131 base::MessageLoopProxy::current()->PostTask( | 95 base::MessageLoopProxy::current()->PostTask( |
132 FROM_HERE, | 96 FROM_HERE, |
133 base::Bind(arg2, status, base::Passed(value))); | 97 base::Bind(arg2, status, base::Passed(value))); |
134 } | 98 } |
135 | 99 |
136 ACTION(MockFailingGetDocuments) { | 100 ACTION(MockFailingGetDocuments) { |
137 base::MessageLoopProxy::current()->PostTask( | 101 base::MessageLoopProxy::current()->PostTask( |
138 FROM_HERE, | 102 FROM_HERE, |
139 base::Bind(arg5, google_apis::GDATA_NO_CONNECTION, | 103 base::Bind(arg5, google_apis::GDATA_NO_CONNECTION, |
140 base::Passed(scoped_ptr<base::Value>()))); | 104 base::Passed(scoped_ptr<base::Value>()))); |
141 } | 105 } |
142 | 106 |
143 // Counts the number of files (not directories) in |entries|. | 107 // Counts the number of files (not directories) in |entries|. |
144 int CountFiles(const DriveEntryProtoVector& entries) { | 108 int CountFiles(const DriveEntryProtoVector& entries) { |
145 int num_files = 0; | 109 int num_files = 0; |
146 for (size_t i = 0; i < entries.size(); ++i) { | 110 for (size_t i = 0; i < entries.size(); ++i) { |
147 if (!entries[i].file_info().is_directory()) | 111 if (!entries[i].file_info().is_directory()) |
148 ++num_files; | 112 ++num_files; |
149 } | 113 } |
150 return num_files; | 114 return num_files; |
151 } | 115 } |
152 | 116 |
| 117 // A fake implementation of DriveUploaderInterface, which provides fake |
| 118 // behaviors for file uploading. |
| 119 class FakeDriveUploader : public google_apis::DriveUploaderInterface { |
| 120 public: |
| 121 FakeDriveUploader() {} |
| 122 virtual ~FakeDriveUploader() {} |
| 123 |
| 124 // DriveUploaderInterface overrides. |
| 125 |
| 126 // Pretends that a new file was uploaded successfully, and returns the |
| 127 // contents of "gdata/uploaded_file.json" to the caller. |
| 128 virtual int UploadNewFile( |
| 129 const GURL& upload_location, |
| 130 const FilePath& drive_file_path, |
| 131 const FilePath& local_file_path, |
| 132 const std::string& title, |
| 133 const std::string& content_type, |
| 134 int64 content_length, |
| 135 int64 file_size, |
| 136 const google_apis::UploadCompletionCallback& completion_callback, |
| 137 const google_apis::UploaderReadyCallback& ready_callback) OVERRIDE { |
| 138 scoped_ptr<base::Value> value = |
| 139 google_apis::test_util::LoadJSONFile("gdata/uploaded_file.json"); |
| 140 scoped_ptr<google_apis::DocumentEntry> document_entry( |
| 141 google_apis::DocumentEntry::ExtractAndParse(*value)); |
| 142 |
| 143 base::MessageLoopProxy::current()->PostTask( |
| 144 FROM_HERE, |
| 145 base::Bind(completion_callback, |
| 146 google_apis::DRIVE_UPLOAD_OK, |
| 147 drive_file_path, |
| 148 local_file_path, |
| 149 base::Passed(&document_entry))); |
| 150 |
| 151 const int kUploadId = 123; |
| 152 return kUploadId; |
| 153 } |
| 154 |
| 155 virtual int StreamExistingFile( |
| 156 const GURL& upload_location, |
| 157 const FilePath& drive_file_path, |
| 158 const FilePath& local_file_path, |
| 159 const std::string& content_type, |
| 160 int64 content_length, |
| 161 int64 file_size, |
| 162 const google_apis::UploadCompletionCallback& completion_callback, |
| 163 const google_apis::UploaderReadyCallback& ready_callback) OVERRIDE { |
| 164 NOTREACHED(); |
| 165 return 0; |
| 166 } |
| 167 |
| 168 // Pretends that an existing file ("drive/File 1.txt") was uploaded |
| 169 // successfully, and returns an entry for the file in |
| 170 // "gdata/root_feed.json" to the caller. |
| 171 virtual int UploadExistingFile( |
| 172 const GURL& upload_location, |
| 173 const FilePath& drive_file_path, |
| 174 const FilePath& local_file_path, |
| 175 const std::string& content_type, |
| 176 int64 file_size, |
| 177 const google_apis::UploadCompletionCallback& completion_callback, |
| 178 const google_apis::UploaderReadyCallback& ready_callback) { |
| 179 // This function can only handle "drive/File 1.txt" whose resource ID is |
| 180 // "file:2_file_resource_id". |
| 181 DCHECK_EQ("drive/File 1.txt", drive_file_path.value()); |
| 182 const std::string kResourceId = "file:2_file_resource_id"; |
| 183 |
| 184 // Create a google_apis::DocumentEntry, which is needed to return a value |
| 185 // from this function. TODO(satorux): This should be cleaned |
| 186 // up. crbug.com/134240. |
| 187 scoped_ptr<google_apis::DocumentEntry> document_entry; |
| 188 scoped_ptr<base::Value> value = |
| 189 google_apis::test_util::LoadJSONFile("gdata/root_feed.json"); |
| 190 if (!value.get()) |
| 191 return -1; |
| 192 |
| 193 base::DictionaryValue* as_dict = NULL; |
| 194 base::ListValue* entry_list = NULL; |
| 195 if (value->GetAsDictionary(&as_dict) && |
| 196 as_dict->GetList("feed.entry", &entry_list)) { |
| 197 for (size_t i = 0; i < entry_list->GetSize(); ++i) { |
| 198 base::DictionaryValue* entry = NULL; |
| 199 std::string resource_id; |
| 200 if (entry_list->GetDictionary(i, &entry) && |
| 201 entry->GetString("gd$resourceId.$t", &resource_id) && |
| 202 resource_id == kResourceId) { |
| 203 document_entry = google_apis::DocumentEntry::CreateFrom(*entry); |
| 204 } |
| 205 } |
| 206 } |
| 207 if (!document_entry) |
| 208 return -1; |
| 209 |
| 210 base::MessageLoopProxy::current()->PostTask( |
| 211 FROM_HERE, |
| 212 base::Bind(completion_callback, |
| 213 google_apis::DRIVE_UPLOAD_OK, |
| 214 drive_file_path, |
| 215 local_file_path, |
| 216 base::Passed(&document_entry))); |
| 217 |
| 218 const int kUploadId = 123; |
| 219 return kUploadId; |
| 220 } |
| 221 |
| 222 virtual void UpdateUpload(int upload_id, |
| 223 content::DownloadItem* download) OVERRIDE { |
| 224 NOTREACHED(); |
| 225 } |
| 226 |
| 227 virtual int64 GetUploadedBytes(int upload_id) const OVERRIDE { |
| 228 NOTREACHED(); |
| 229 return 0; |
| 230 } |
| 231 }; |
| 232 |
153 } // namespace | 233 } // namespace |
154 | 234 |
155 class DriveFileSystemTest : public testing::Test { | 235 class DriveFileSystemTest : public testing::Test { |
156 protected: | 236 protected: |
157 DriveFileSystemTest() | 237 DriveFileSystemTest() |
158 : ui_thread_(content::BrowserThread::UI, &message_loop_), | 238 : ui_thread_(content::BrowserThread::UI, &message_loop_), |
159 io_thread_(content::BrowserThread::IO), | 239 io_thread_(content::BrowserThread::IO), |
160 cache_(NULL), | 240 cache_(NULL), |
161 file_system_(NULL), | 241 file_system_(NULL), |
162 mock_drive_service_(NULL), | 242 mock_drive_service_(NULL), |
(...skipping 28 matching lines...) Expand all Loading... |
191 SetFreeDiskSpaceGetterForTesting(mock_free_disk_space_checker_); | 271 SetFreeDiskSpaceGetterForTesting(mock_free_disk_space_checker_); |
192 | 272 |
193 scoped_refptr<base::SequencedWorkerPool> pool = | 273 scoped_refptr<base::SequencedWorkerPool> pool = |
194 content::BrowserThread::GetBlockingPool(); | 274 content::BrowserThread::GetBlockingPool(); |
195 blocking_task_runner_ = | 275 blocking_task_runner_ = |
196 pool->GetSequencedTaskRunner(pool->GetSequenceToken()); | 276 pool->GetSequencedTaskRunner(pool->GetSequenceToken()); |
197 | 277 |
198 cache_ = DriveCache::CreateDriveCache( | 278 cache_ = DriveCache::CreateDriveCache( |
199 DriveCache::GetCacheRootPath(profile_.get()), blocking_task_runner_); | 279 DriveCache::GetCacheRootPath(profile_.get()), blocking_task_runner_); |
200 | 280 |
201 mock_uploader_.reset(new StrictMock<google_apis::MockDriveUploader>); | 281 fake_uploader_.reset(new FakeDriveUploader); |
202 mock_webapps_registry_.reset(new StrictMock<MockDriveWebAppsRegistry>); | 282 mock_webapps_registry_.reset(new StrictMock<MockDriveWebAppsRegistry>); |
203 | 283 |
204 ASSERT_FALSE(file_system_); | 284 ASSERT_FALSE(file_system_); |
205 file_system_ = new DriveFileSystem(profile_.get(), | 285 file_system_ = new DriveFileSystem(profile_.get(), |
206 cache_, | 286 cache_, |
207 mock_drive_service_, | 287 mock_drive_service_, |
208 mock_uploader_.get(), | 288 fake_uploader_.get(), |
209 mock_webapps_registry_.get(), | 289 mock_webapps_registry_.get(), |
210 blocking_task_runner_); | 290 blocking_task_runner_); |
211 | 291 |
212 mock_cache_observer_.reset(new StrictMock<MockDriveCacheObserver>); | 292 mock_cache_observer_.reset(new StrictMock<MockDriveCacheObserver>); |
213 cache_->AddObserver(mock_cache_observer_.get()); | 293 cache_->AddObserver(mock_cache_observer_.get()); |
214 | 294 |
215 mock_directory_observer_.reset(new StrictMock<MockDirectoryChangeObserver>); | 295 mock_directory_observer_.reset(new StrictMock<MockDirectoryChangeObserver>); |
216 file_system_->AddObserver(mock_directory_observer_.get()); | 296 file_system_->AddObserver(mock_directory_observer_.get()); |
217 | 297 |
218 file_system_->Initialize(); | 298 file_system_->Initialize(); |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 | 884 |
805 MessageLoopForUI message_loop_; | 885 MessageLoopForUI message_loop_; |
806 // The order of the test threads is important, do not change the order. | 886 // The order of the test threads is important, do not change the order. |
807 // See also content/browser/browser_thread_impl.cc. | 887 // See also content/browser/browser_thread_impl.cc. |
808 content::TestBrowserThread ui_thread_; | 888 content::TestBrowserThread ui_thread_; |
809 content::TestBrowserThread io_thread_; | 889 content::TestBrowserThread io_thread_; |
810 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 890 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
811 scoped_ptr<TestingProfile> profile_; | 891 scoped_ptr<TestingProfile> profile_; |
812 scoped_refptr<CallbackHelper> callback_helper_; | 892 scoped_refptr<CallbackHelper> callback_helper_; |
813 DriveCache* cache_; | 893 DriveCache* cache_; |
814 scoped_ptr<StrictMock<google_apis::MockDriveUploader> > mock_uploader_; | 894 scoped_ptr<FakeDriveUploader> fake_uploader_; |
815 DriveFileSystem* file_system_; | 895 DriveFileSystem* file_system_; |
816 StrictMock<google_apis::MockDriveService>* mock_drive_service_; | 896 StrictMock<google_apis::MockDriveService>* mock_drive_service_; |
817 scoped_ptr<StrictMock<MockDriveWebAppsRegistry> > mock_webapps_registry_; | 897 scoped_ptr<StrictMock<MockDriveWebAppsRegistry> > mock_webapps_registry_; |
818 StrictMock<MockFreeDiskSpaceGetter>* mock_free_disk_space_checker_; | 898 StrictMock<MockFreeDiskSpaceGetter>* mock_free_disk_space_checker_; |
819 scoped_ptr<StrictMock<MockDriveCacheObserver> > mock_cache_observer_; | 899 scoped_ptr<StrictMock<MockDriveCacheObserver> > mock_cache_observer_; |
820 scoped_ptr<StrictMock<MockDirectoryChangeObserver> > mock_directory_observer_; | 900 scoped_ptr<StrictMock<MockDirectoryChangeObserver> > mock_directory_observer_; |
821 | 901 |
822 int num_callback_invocations_; | 902 int num_callback_invocations_; |
823 DriveFileError expected_error_; | 903 DriveFileError expected_error_; |
824 int expected_cache_state_; | 904 int expected_cache_state_; |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 | 1364 |
1285 // Confirm that the remote file does not exist. | 1365 // Confirm that the remote file does not exist. |
1286 const FilePath remote_dest_file_path(FILE_PATH_LITERAL("drive/remote.txt")); | 1366 const FilePath remote_dest_file_path(FILE_PATH_LITERAL("drive/remote.txt")); |
1287 EXPECT_FALSE(EntryExists(remote_dest_file_path)); | 1367 EXPECT_FALSE(EntryExists(remote_dest_file_path)); |
1288 | 1368 |
1289 scoped_ptr<base::Value> value = | 1369 scoped_ptr<base::Value> value = |
1290 google_apis::test_util::LoadJSONFile("gdata/document_to_download.json"); | 1370 google_apis::test_util::LoadJSONFile("gdata/document_to_download.json"); |
1291 scoped_ptr<google_apis::DocumentEntry> document_entry( | 1371 scoped_ptr<google_apis::DocumentEntry> document_entry( |
1292 google_apis::DocumentEntry::ExtractAndParse(*value)); | 1372 google_apis::DocumentEntry::ExtractAndParse(*value)); |
1293 | 1373 |
1294 EXPECT_CALL(*mock_uploader_, UploadNewFile(_, _, _, _, _, _, _, _, _)) | |
1295 .WillOnce(MockUploadNewFile()); | |
1296 | |
1297 // Transfer the local file to Drive. | 1374 // Transfer the local file to Drive. |
1298 file_system_->TransferFileFromLocalToRemote( | 1375 file_system_->TransferFileFromLocalToRemote( |
1299 local_src_file_path, remote_dest_file_path, callback); | 1376 local_src_file_path, remote_dest_file_path, callback); |
1300 google_apis::test_util::RunBlockingPoolTask(); | 1377 google_apis::test_util::RunBlockingPoolTask(); |
1301 | 1378 |
1302 EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); | 1379 EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); |
1303 | 1380 |
1304 // Now the remote file should exist. | 1381 // Now the remote file should exist. |
1305 EXPECT_TRUE(EntryExists(remote_dest_file_path)); | 1382 EXPECT_TRUE(EntryExists(remote_dest_file_path)); |
1306 } | 1383 } |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2396 test_util::TEST_CACHE_STATE_DIRTY | | 2473 test_util::TEST_CACHE_STATE_DIRTY | |
2397 test_util::TEST_CACHE_STATE_PERSISTENT, | 2474 test_util::TEST_CACHE_STATE_PERSISTENT, |
2398 DriveCache::CACHE_TYPE_PERSISTENT); | 2475 DriveCache::CACHE_TYPE_PERSISTENT); |
2399 const FilePath outgoing_symlink_path = | 2476 const FilePath outgoing_symlink_path = |
2400 DriveCache::GetCacheRootPath(profile_.get()) | 2477 DriveCache::GetCacheRootPath(profile_.get()) |
2401 .AppendASCII("outgoing") | 2478 .AppendASCII("outgoing") |
2402 .AppendASCII(kResourceId); | 2479 .AppendASCII(kResourceId); |
2403 ASSERT_TRUE(file_util::PathExists(dirty_cache_file_path)); | 2480 ASSERT_TRUE(file_util::PathExists(dirty_cache_file_path)); |
2404 ASSERT_TRUE(file_util::PathExists(outgoing_symlink_path)); | 2481 ASSERT_TRUE(file_util::PathExists(outgoing_symlink_path)); |
2405 | 2482 |
2406 // Create a google_apis::DocumentEntry, which is needed to mock | |
2407 // DriveUploaderInterface::UploadExistingFile(). | |
2408 // TODO(satorux): This should be cleaned up. crbug.com/134240. | |
2409 scoped_ptr<google_apis::DocumentEntry> document_entry; | |
2410 scoped_ptr<base::Value> value = | |
2411 google_apis::test_util::LoadJSONFile("gdata/root_feed.json"); | |
2412 ASSERT_TRUE(value.get()); | |
2413 base::DictionaryValue* as_dict = NULL; | |
2414 base::ListValue* entry_list = NULL; | |
2415 if (value->GetAsDictionary(&as_dict) && | |
2416 as_dict->GetList("feed.entry", &entry_list)) { | |
2417 for (size_t i = 0; i < entry_list->GetSize(); ++i) { | |
2418 base::DictionaryValue* entry = NULL; | |
2419 std::string resource_id; | |
2420 if (entry_list->GetDictionary(i, &entry) && | |
2421 entry->GetString("gd$resourceId.$t", &resource_id) && | |
2422 resource_id == kResourceId) { | |
2423 // This will be deleted by UploadExistingFile(). | |
2424 document_entry = google_apis::DocumentEntry::CreateFrom(*entry); | |
2425 } | |
2426 } | |
2427 } | |
2428 ASSERT_TRUE(document_entry); | |
2429 | |
2430 // The mock uploader will be used to simulate a file upload. | |
2431 EXPECT_CALL(*mock_uploader_, UploadExistingFile( | |
2432 GURL("https://file_link_resumable_edit_media/"), | |
2433 kFilePath, | |
2434 dirty_cache_file_path, | |
2435 "audio/mpeg", | |
2436 kDummyCacheContent.size(), // The size after modification must be used. | |
2437 _, // Completion callback. | |
2438 _)) // Ready callback. | |
2439 .WillOnce(MockUploadExistingFile( | |
2440 google_apis::DRIVE_UPLOAD_OK, | |
2441 FilePath::FromUTF8Unsafe("drive/File1"), | |
2442 dirty_cache_file_path, | |
2443 document_entry.release())); | |
2444 | |
2445 // We'll notify the directory change to the observer upon completion. | 2483 // We'll notify the directory change to the observer upon completion. |
2446 EXPECT_CALL(*mock_directory_observer_, | 2484 EXPECT_CALL(*mock_directory_observer_, |
2447 OnDirectoryChanged(Eq(FilePath(kDriveRootDirectory)))).Times(1); | 2485 OnDirectoryChanged(Eq(FilePath(kDriveRootDirectory)))).Times(1); |
2448 | 2486 |
2449 // The callback will be called upon completion of | 2487 // The callback will be called upon completion of |
2450 // UpdateFileByResourceId(). | 2488 // UpdateFileByResourceId(). |
2451 FileOperationCallback callback = | 2489 FileOperationCallback callback = |
2452 base::Bind(&CallbackHelper::FileOperationCallback, | 2490 base::Bind(&CallbackHelper::FileOperationCallback, |
2453 callback_helper_.get()); | 2491 callback_helper_.get()); |
2454 | 2492 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2699 | 2737 |
2700 // Try to close the same file twice. | 2738 // Try to close the same file twice. |
2701 file_system_->CloseFile(kFileInRoot, close_file_callback); | 2739 file_system_->CloseFile(kFileInRoot, close_file_callback); |
2702 message_loop_.Run(); | 2740 message_loop_.Run(); |
2703 | 2741 |
2704 // It must fail. | 2742 // It must fail. |
2705 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); | 2743 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); |
2706 } | 2744 } |
2707 | 2745 |
2708 } // namespace drive | 2746 } // namespace drive |
OLD | NEW |