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 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 class LoggingDelegate : public OperationDelegate { | 49 class LoggingDelegate : public OperationDelegate { |
50 public: | 50 public: |
51 typedef base::Callback<bool( | 51 typedef base::Callback<bool( |
52 const std::string& local_id, | 52 const std::string& local_id, |
53 const FileOperationCallback& callback)> WaitForSyncCompleteHandler; | 53 const FileOperationCallback& callback)> WaitForSyncCompleteHandler; |
54 | 54 |
55 LoggingDelegate(); | 55 LoggingDelegate(); |
56 ~LoggingDelegate(); | 56 ~LoggingDelegate(); |
57 | 57 |
58 // OperationDelegate overrides. | 58 // OperationDelegate overrides. |
59 virtual void OnFileChangedByOperation( | 59 void OnFileChangedByOperation(const FileChange& changed_files) override; |
60 const FileChange& changed_files) override; | 60 void OnEntryUpdatedByOperation(const ClientContext& context, |
61 virtual void OnEntryUpdatedByOperation( | 61 const std::string& local_id) override; |
62 const ClientContext& context, | 62 void OnDriveSyncError(DriveSyncErrorType type, |
63 const std::string& local_id) override; | 63 const std::string& local_id) override; |
64 virtual void OnDriveSyncError(DriveSyncErrorType type, | 64 bool WaitForSyncComplete(const std::string& local_id, |
65 const std::string& local_id) override; | 65 const FileOperationCallback& callback) override; |
66 virtual bool WaitForSyncComplete( | |
67 const std::string& local_id, | |
68 const FileOperationCallback& callback) override; | |
69 | 66 |
70 // Gets the set of changed paths. | 67 // Gets the set of changed paths. |
71 const FileChange& get_changed_files() { return changed_files_; } | 68 const FileChange& get_changed_files() { return changed_files_; } |
72 | 69 |
73 // Gets the set of updated local IDs. | 70 // Gets the set of updated local IDs. |
74 const std::set<std::string>& updated_local_ids() const { | 71 const std::set<std::string>& updated_local_ids() const { |
75 return updated_local_ids_; | 72 return updated_local_ids_; |
76 } | 73 } |
77 | 74 |
78 // Gets the list of drive sync errors. | 75 // Gets the list of drive sync errors. |
79 const std::vector<DriveSyncErrorType>& drive_sync_errors() const { | 76 const std::vector<DriveSyncErrorType>& drive_sync_errors() const { |
80 return drive_sync_errors_; | 77 return drive_sync_errors_; |
81 } | 78 } |
82 | 79 |
83 // Sets the callback used to handle WaitForSyncComplete() method calls. | 80 // Sets the callback used to handle WaitForSyncComplete() method calls. |
84 void set_wait_for_sync_complete_handler( | 81 void set_wait_for_sync_complete_handler( |
85 const WaitForSyncCompleteHandler& wait_for_sync_complete_handler) { | 82 const WaitForSyncCompleteHandler& wait_for_sync_complete_handler) { |
86 wait_for_sync_complete_handler_ = wait_for_sync_complete_handler; | 83 wait_for_sync_complete_handler_ = wait_for_sync_complete_handler; |
87 } | 84 } |
88 | 85 |
89 private: | 86 private: |
90 FileChange changed_files_; | 87 FileChange changed_files_; |
91 std::set<std::string> updated_local_ids_; | 88 std::set<std::string> updated_local_ids_; |
92 std::vector<DriveSyncErrorType> drive_sync_errors_; | 89 std::vector<DriveSyncErrorType> drive_sync_errors_; |
93 WaitForSyncCompleteHandler wait_for_sync_complete_handler_; | 90 WaitForSyncCompleteHandler wait_for_sync_complete_handler_; |
94 }; | 91 }; |
95 | 92 |
96 OperationTestBase(); | 93 OperationTestBase(); |
97 explicit OperationTestBase(int test_thread_bundle_options); | 94 explicit OperationTestBase(int test_thread_bundle_options); |
98 virtual ~OperationTestBase(); | 95 ~OperationTestBase() override; |
99 | 96 |
100 // testing::Test overrides. | 97 // testing::Test overrides. |
101 virtual void SetUp() override; | 98 void SetUp() override; |
102 | 99 |
103 // Returns the path of the temporary directory for putting test files. | 100 // Returns the path of the temporary directory for putting test files. |
104 base::FilePath temp_dir() const { return temp_dir_.path(); } | 101 base::FilePath temp_dir() const { return temp_dir_.path(); } |
105 | 102 |
106 // Synchronously gets the resource entry corresponding to the path from local | 103 // Synchronously gets the resource entry corresponding to the path from local |
107 // ResourceMetadta. | 104 // ResourceMetadta. |
108 FileError GetLocalResourceEntry(const base::FilePath& path, | 105 FileError GetLocalResourceEntry(const base::FilePath& path, |
109 ResourceEntry* entry); | 106 ResourceEntry* entry); |
110 | 107 |
111 // Synchronously gets the resource entry corresponding to the ID from local | 108 // Synchronously gets the resource entry corresponding to the ID from local |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 metadata_; | 157 metadata_; |
161 scoped_ptr<internal::AboutResourceLoader> about_resource_loader_; | 158 scoped_ptr<internal::AboutResourceLoader> about_resource_loader_; |
162 scoped_ptr<internal::LoaderController> loader_controller_; | 159 scoped_ptr<internal::LoaderController> loader_controller_; |
163 scoped_ptr<internal::ChangeListLoader> change_list_loader_; | 160 scoped_ptr<internal::ChangeListLoader> change_list_loader_; |
164 }; | 161 }; |
165 | 162 |
166 } // namespace file_system | 163 } // namespace file_system |
167 } // namespace drive | 164 } // namespace drive |
168 | 165 |
169 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_ | 166 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_ |
OLD | NEW |