| 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/sync_client.h" | 5 #include "chrome/browser/chromeos/drive/sync_client.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/prefs/testing_pref_service.h" | 11 #include "base/prefs/testing_pref_service.h" |
| 12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "base/test/test_timeouts.h" | 13 #include "base/test/test_timeouts.h" |
| 14 #include "chrome/browser/chromeos/drive/change_list_loader.h" | 14 #include "chrome/browser/chromeos/drive/change_list_loader.h" |
| 15 #include "chrome/browser/chromeos/drive/change_list_processor.h" | |
| 16 #include "chrome/browser/chromeos/drive/drive.pb.h" | 15 #include "chrome/browser/chromeos/drive/drive.pb.h" |
| 17 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" | 16 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" |
| 18 #include "chrome/browser/chromeos/drive/file_cache.h" | 17 #include "chrome/browser/chromeos/drive/file_cache.h" |
| 19 #include "chrome/browser/chromeos/drive/file_system/move_operation.h" | 18 #include "chrome/browser/chromeos/drive/file_system/move_operation.h" |
| 20 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" | 19 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" |
| 21 #include "chrome/browser/chromeos/drive/file_system/remove_operation.h" | 20 #include "chrome/browser/chromeos/drive/file_system/remove_operation.h" |
| 22 #include "chrome/browser/chromeos/drive/file_system_util.h" | 21 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 23 #include "chrome/browser/chromeos/drive/job_scheduler.h" | 22 #include "chrome/browser/chromeos/drive/job_scheduler.h" |
| 24 #include "chrome/browser/chromeos/drive/resource_entry_conversion.h" | 23 #include "chrome/browser/chromeos/drive/resource_entry_conversion.h" |
| 25 #include "chrome/browser/chromeos/drive/resource_metadata.h" | 24 #include "chrome/browser/chromeos/drive/resource_metadata.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 ASSERT_NO_FATAL_FAILURE(AddFileEntry("removed")); | 184 ASSERT_NO_FATAL_FAILURE(AddFileEntry("removed")); |
| 186 ASSERT_NO_FATAL_FAILURE(AddFileEntry("moved")); | 185 ASSERT_NO_FATAL_FAILURE(AddFileEntry("moved")); |
| 187 | 186 |
| 188 // Load data from the service to the metadata. | 187 // Load data from the service to the metadata. |
| 189 FileError error = FILE_ERROR_FAILED; | 188 FileError error = FILE_ERROR_FAILED; |
| 190 internal::ChangeListLoader change_list_loader( | 189 internal::ChangeListLoader change_list_loader( |
| 191 base::MessageLoopProxy::current().get(), | 190 base::MessageLoopProxy::current().get(), |
| 192 metadata_.get(), | 191 metadata_.get(), |
| 193 scheduler_.get(), | 192 scheduler_.get(), |
| 194 drive_service_.get()); | 193 drive_service_.get()); |
| 195 change_list_loader.LoadIfNeeded( | 194 change_list_loader.LoadForTesting( |
| 196 DirectoryFetchInfo(), | |
| 197 google_apis::test_util::CreateCopyResultCallback(&error)); | 195 google_apis::test_util::CreateCopyResultCallback(&error)); |
| 198 base::RunLoop().RunUntilIdle(); | 196 base::RunLoop().RunUntilIdle(); |
| 199 EXPECT_EQ(FILE_ERROR_OK, error); | 197 EXPECT_EQ(FILE_ERROR_OK, error); |
| 200 | 198 |
| 201 // Prepare 3 pinned-but-not-present files. | 199 // Prepare 3 pinned-but-not-present files. |
| 202 EXPECT_EQ(FILE_ERROR_OK, cache_->Pin(GetLocalId("foo"))); | 200 EXPECT_EQ(FILE_ERROR_OK, cache_->Pin(GetLocalId("foo"))); |
| 203 EXPECT_EQ(FILE_ERROR_OK, cache_->Pin(GetLocalId("bar"))); | 201 EXPECT_EQ(FILE_ERROR_OK, cache_->Pin(GetLocalId("bar"))); |
| 204 EXPECT_EQ(FILE_ERROR_OK, cache_->Pin(GetLocalId("baz"))); | 202 EXPECT_EQ(FILE_ERROR_OK, cache_->Pin(GetLocalId("baz"))); |
| 205 | 203 |
| 206 // Prepare a pinned-and-fetched file. | 204 // Prepare a pinned-and-fetched file. |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 ASSERT_FALSE(drive_service_->paused_action().is_null()); | 426 ASSERT_FALSE(drive_service_->paused_action().is_null()); |
| 429 drive_service_->paused_action().Run(); | 427 drive_service_->paused_action().Run(); |
| 430 base::RunLoop().RunUntilIdle(); | 428 base::RunLoop().RunUntilIdle(); |
| 431 | 429 |
| 432 // Task should be run twice. | 430 // Task should be run twice. |
| 433 EXPECT_EQ(2, drive_service_->download_file_count()); | 431 EXPECT_EQ(2, drive_service_->download_file_count()); |
| 434 } | 432 } |
| 435 | 433 |
| 436 } // namespace internal | 434 } // namespace internal |
| 437 } // namespace drive | 435 } // namespace drive |
| OLD | NEW |