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/file_system/operation_test_base.h" | 5 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h" |
6 | 6 |
7 #include "base/prefs/testing_pref_service.h" | 7 #include "base/prefs/testing_pref_service.h" |
8 #include "base/threading/sequenced_worker_pool.h" | 8 #include "base/threading/sequenced_worker_pool.h" |
9 #include "chrome/browser/chromeos/drive/change_list_loader.h" | 9 #include "chrome/browser/chromeos/drive/change_list_loader.h" |
10 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" | 10 #include "chrome/browser/chromeos/drive/fake_free_disk_space_getter.h" |
11 #include "chrome/browser/chromeos/drive/file_cache.h" | 11 #include "chrome/browser/chromeos/drive/file_cache.h" |
12 #include "chrome/browser/chromeos/drive/file_change.h" | 12 #include "chrome/browser/chromeos/drive/file_change.h" |
13 #include "chrome/browser/chromeos/drive/file_system/operation_observer.h" | 13 #include "chrome/browser/chromeos/drive/file_system/operation_delegate.h" |
14 #include "chrome/browser/chromeos/drive/job_scheduler.h" | 14 #include "chrome/browser/chromeos/drive/job_scheduler.h" |
15 #include "chrome/browser/chromeos/drive/resource_metadata.h" | 15 #include "chrome/browser/chromeos/drive/resource_metadata.h" |
16 #include "chrome/browser/drive/event_logger.h" | 16 #include "chrome/browser/drive/event_logger.h" |
17 #include "chrome/browser/drive/fake_drive_service.h" | 17 #include "chrome/browser/drive/fake_drive_service.h" |
18 #include "chrome/browser/drive/test_util.h" | 18 #include "chrome/browser/drive/test_util.h" |
19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
20 #include "content/public/test/test_utils.h" | 20 #include "content/public/test/test_utils.h" |
21 #include "google_apis/drive/test_util.h" | 21 #include "google_apis/drive/test_util.h" |
22 | 22 |
23 namespace drive { | 23 namespace drive { |
24 namespace file_system { | 24 namespace file_system { |
25 | 25 |
26 OperationTestBase::LoggingObserver::LoggingObserver() { | 26 OperationTestBase::LoggingDelegate::LoggingDelegate() { |
27 } | 27 } |
28 | 28 |
29 OperationTestBase::LoggingObserver::~LoggingObserver() { | 29 OperationTestBase::LoggingDelegate::~LoggingDelegate() { |
30 } | 30 } |
31 | 31 |
32 void OperationTestBase::LoggingObserver::OnFileChangedByOperation( | 32 void OperationTestBase::LoggingDelegate::OnFileChangedByOperation( |
33 const FileChange& changed_files) { | 33 const FileChange& changed_files) { |
34 changed_files_.Apply(changed_files); | 34 changed_files_.Apply(changed_files); |
35 } | 35 } |
36 | 36 |
37 void OperationTestBase::LoggingObserver::OnEntryUpdatedByOperation( | 37 void OperationTestBase::LoggingDelegate::OnEntryUpdatedByOperation( |
38 const std::string& local_id) { | 38 const std::string& local_id) { |
39 updated_local_ids_.insert(local_id); | 39 updated_local_ids_.insert(local_id); |
40 } | 40 } |
41 | 41 |
42 void OperationTestBase::LoggingObserver::OnDriveSyncError( | 42 void OperationTestBase::LoggingDelegate::OnDriveSyncError( |
43 DriveSyncErrorType type, const std::string& local_id) { | 43 DriveSyncErrorType type, const std::string& local_id) { |
44 drive_sync_errors_.push_back(type); | 44 drive_sync_errors_.push_back(type); |
45 } | 45 } |
46 | 46 |
47 bool OperationTestBase::LoggingObserver::WaitForSyncComplete( | 47 bool OperationTestBase::LoggingDelegate::WaitForSyncComplete( |
48 const std::string& local_id, | 48 const std::string& local_id, |
49 const FileOperationCallback& callback) { | 49 const FileOperationCallback& callback) { |
50 return wait_for_sync_complete_handler_.is_null() ? | 50 return wait_for_sync_complete_handler_.is_null() ? |
51 false : wait_for_sync_complete_handler_.Run(local_id, callback); | 51 false : wait_for_sync_complete_handler_.Run(local_id, callback); |
52 } | 52 } |
53 | 53 |
54 OperationTestBase::OperationTestBase() { | 54 OperationTestBase::OperationTestBase() { |
55 } | 55 } |
56 | 56 |
57 OperationTestBase::OperationTestBase(int test_thread_bundle_options) | 57 OperationTestBase::OperationTestBase(int test_thread_bundle_options) |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 FileError OperationTestBase::CheckForUpdates() { | 185 FileError OperationTestBase::CheckForUpdates() { |
186 FileError error = FILE_ERROR_FAILED; | 186 FileError error = FILE_ERROR_FAILED; |
187 change_list_loader_->CheckForUpdates( | 187 change_list_loader_->CheckForUpdates( |
188 google_apis::test_util::CreateCopyResultCallback(&error)); | 188 google_apis::test_util::CreateCopyResultCallback(&error)); |
189 content::RunAllBlockingPoolTasksUntilIdle(); | 189 content::RunAllBlockingPoolTasksUntilIdle(); |
190 return error; | 190 return error; |
191 } | 191 } |
192 | 192 |
193 } // namespace file_system | 193 } // namespace file_system |
194 } // namespace drive | 194 } // namespace drive |
OLD | NEW |