OLD | NEW |
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/change_list_loader.h" | 5 #include "chrome/browser/chromeos/drive/change_list_loader.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/prefs/testing_pref_service.h" | 10 #include "base/prefs/testing_pref_service.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 241 |
242 TEST_F(ChangeListLoaderTest, Load_LocalMetadataAvailable) { | 242 TEST_F(ChangeListLoaderTest, Load_LocalMetadataAvailable) { |
243 // Prepare metadata. | 243 // Prepare metadata. |
244 FileError error = FILE_ERROR_FAILED; | 244 FileError error = FILE_ERROR_FAILED; |
245 change_list_loader_->LoadIfNeeded( | 245 change_list_loader_->LoadIfNeeded( |
246 google_apis::test_util::CreateCopyResultCallback(&error)); | 246 google_apis::test_util::CreateCopyResultCallback(&error)); |
247 base::RunLoop().RunUntilIdle(); | 247 base::RunLoop().RunUntilIdle(); |
248 EXPECT_EQ(FILE_ERROR_OK, error); | 248 EXPECT_EQ(FILE_ERROR_OK, error); |
249 | 249 |
250 // Reset loader. | 250 // Reset loader. |
| 251 about_resource_loader_.reset(new AboutResourceLoader(scheduler_.get())); |
251 change_list_loader_.reset( | 252 change_list_loader_.reset( |
252 new ChangeListLoader(logger_.get(), | 253 new ChangeListLoader(logger_.get(), |
253 base::MessageLoopProxy::current().get(), | 254 base::MessageLoopProxy::current().get(), |
254 metadata_.get(), | 255 metadata_.get(), |
255 scheduler_.get(), | 256 scheduler_.get(), |
256 about_resource_loader_.get(), | 257 about_resource_loader_.get(), |
257 loader_controller_.get())); | 258 loader_controller_.get())); |
258 | 259 |
259 // Add a file to the service. | 260 // Add a file to the service. |
260 scoped_ptr<google_apis::FileResource> gdata_entry = AddNewFile("New File"); | 261 scoped_ptr<google_apis::FileResource> gdata_entry = AddNewFile("New File"); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 TestChangeListLoaderObserver observer(change_list_loader_.get()); | 384 TestChangeListLoaderObserver observer(change_list_loader_.get()); |
384 FileError check_for_updates_error = FILE_ERROR_FAILED; | 385 FileError check_for_updates_error = FILE_ERROR_FAILED; |
385 change_list_loader_->CheckForUpdates( | 386 change_list_loader_->CheckForUpdates( |
386 google_apis::test_util::CreateCopyResultCallback( | 387 google_apis::test_util::CreateCopyResultCallback( |
387 &check_for_updates_error)); | 388 &check_for_updates_error)); |
388 base::RunLoop().RunUntilIdle(); | 389 base::RunLoop().RunUntilIdle(); |
389 | 390 |
390 // Update is pending due to the lock. | 391 // Update is pending due to the lock. |
391 EXPECT_TRUE(observer.changed_files().empty()); | 392 EXPECT_TRUE(observer.changed_files().empty()); |
392 | 393 |
393 // Unlock the loader, this should resume the pending udpate. | 394 // Unlock the loader, this should resume the pending update. |
394 lock.reset(); | 395 lock.reset(); |
395 base::RunLoop().RunUntilIdle(); | 396 base::RunLoop().RunUntilIdle(); |
396 EXPECT_TRUE( | 397 EXPECT_TRUE( |
397 observer.changed_files().CountDirectory(util::GetDriveMyDriveRootPath())); | 398 observer.changed_files().CountDirectory(util::GetDriveMyDriveRootPath())); |
398 } | 399 } |
399 | 400 |
400 } // namespace internal | 401 } // namespace internal |
401 } // namespace drive | 402 } // namespace drive |
OLD | NEW |