Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: chrome/browser/chromeos/drive/file_system/operation_test_base.h

Issue 372713004: Wait for parent directory sync before performing server-side copy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add operation_observer.cc Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 30 matching lines...) Expand all
41 namespace file_system { 41 namespace file_system {
42 42
43 // Base fixture class for testing Drive file system operations. It sets up the 43 // Base fixture class for testing Drive file system operations. It sets up the
44 // basic set of Drive internal classes (ResourceMetadata, Cache, etc) on top of 44 // basic set of Drive internal classes (ResourceMetadata, Cache, etc) on top of
45 // FakeDriveService for testing. 45 // FakeDriveService for testing.
46 class OperationTestBase : public testing::Test { 46 class OperationTestBase : public testing::Test {
47 protected: 47 protected:
48 // OperationObserver that records all the events. 48 // OperationObserver that records all the events.
49 class LoggingObserver : public OperationObserver { 49 class LoggingObserver : public OperationObserver {
50 public: 50 public:
51 typedef base::Callback<bool(
52 const std::string& local_id,
53 const FileOperationCallback& callback)> WaitForSyncCompleteHandler;
54
51 LoggingObserver(); 55 LoggingObserver();
52 ~LoggingObserver(); 56 ~LoggingObserver();
53 57
54 // OperationObserver overrides. 58 // OperationObserver overrides.
55 virtual void OnFileChangedByOperation( 59 virtual void OnFileChangedByOperation(
56 const FileChange& changed_files) OVERRIDE; 60 const FileChange& changed_files) OVERRIDE;
57 virtual void OnEntryUpdatedByOperation( 61 virtual void OnEntryUpdatedByOperation(
58 const std::string& local_id) OVERRIDE; 62 const std::string& local_id) OVERRIDE;
59 virtual void OnDriveSyncError(DriveSyncErrorType type, 63 virtual void OnDriveSyncError(DriveSyncErrorType type,
60 const std::string& local_id) OVERRIDE; 64 const std::string& local_id) OVERRIDE;
65 virtual bool WaitForSyncComplete(
66 const std::string& local_id,
67 const FileOperationCallback& callback) OVERRIDE;
61 68
62 // Gets the set of changed paths. 69 // Gets the set of changed paths.
63 const FileChange& get_changed_files() { return changed_files_; } 70 const FileChange& get_changed_files() { return changed_files_; }
64 71
65 // Gets the set of updated local IDs. 72 // Gets the set of updated local IDs.
66 const std::set<std::string>& updated_local_ids() const { 73 const std::set<std::string>& updated_local_ids() const {
67 return updated_local_ids_; 74 return updated_local_ids_;
68 } 75 }
69 76
70 // Gets the list of drive sync errors. 77 // Gets the list of drive sync errors.
71 const std::vector<DriveSyncErrorType>& drive_sync_errors() const { 78 const std::vector<DriveSyncErrorType>& drive_sync_errors() const {
72 return drive_sync_errors_; 79 return drive_sync_errors_;
73 } 80 }
74 81
82 // Sets the callback used to handle WaitForSyncComplete() method calls.
83 void set_wait_for_sync_complete_handler(
84 const WaitForSyncCompleteHandler& wait_for_sync_complete_handler) {
85 wait_for_sync_complete_handler_ = wait_for_sync_complete_handler;
86 }
87
75 private: 88 private:
76 FileChange changed_files_; 89 FileChange changed_files_;
77 std::set<std::string> updated_local_ids_; 90 std::set<std::string> updated_local_ids_;
78 std::vector<DriveSyncErrorType> drive_sync_errors_; 91 std::vector<DriveSyncErrorType> drive_sync_errors_;
92 WaitForSyncCompleteHandler wait_for_sync_complete_handler_;
79 }; 93 };
80 94
81 OperationTestBase(); 95 OperationTestBase();
82 explicit OperationTestBase(int test_thread_bundle_options); 96 explicit OperationTestBase(int test_thread_bundle_options);
83 virtual ~OperationTestBase(); 97 virtual ~OperationTestBase();
84 98
85 // testing::Test overrides. 99 // testing::Test overrides.
86 virtual void SetUp() OVERRIDE; 100 virtual void SetUp() OVERRIDE;
87 101
88 // Returns the path of the temporary directory for putting test files. 102 // Returns the path of the temporary directory for putting test files.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 metadata_; 159 metadata_;
146 scoped_ptr<internal::AboutResourceLoader> about_resource_loader_; 160 scoped_ptr<internal::AboutResourceLoader> about_resource_loader_;
147 scoped_ptr<internal::LoaderController> loader_controller_; 161 scoped_ptr<internal::LoaderController> loader_controller_;
148 scoped_ptr<internal::ChangeListLoader> change_list_loader_; 162 scoped_ptr<internal::ChangeListLoader> change_list_loader_;
149 }; 163 };
150 164
151 } // namespace file_system 165 } // namespace file_system
152 } // namespace drive 166 } // namespace drive
153 167
154 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_ 168 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_OPERATION_TEST_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698