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

Side by Side Diff: sync/internal_api/public/test/fake_sync_manager.h

Issue 10795018: [Sync] Remove unneeded 'using syncer::' lines and 'syncer::' scopings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fiix indent Created 8 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 (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 #ifndef SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_SYNC_MANAGER_H_ 5 #ifndef SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_SYNC_MANAGER_H_
6 #define SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_SYNC_MANAGER_H_ 6 #define SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_SYNC_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "sync/internal_api/public/sync_manager.h" 10 #include "sync/internal_api/public/sync_manager.h"
11 11
12 #include "base/observer_list.h" 12 #include "base/observer_list.h"
13 13
14 class MessageLoop; 14 class MessageLoop;
15 15
16 namespace syncer { 16 namespace syncer {
17 17
18 class FakeSyncManager : public SyncManager { 18 class FakeSyncManager : public SyncManager {
19 public: 19 public:
20 explicit FakeSyncManager(); 20 explicit FakeSyncManager();
21 virtual ~FakeSyncManager(); 21 virtual ~FakeSyncManager();
22 22
23 // The set of types that have initial_sync_ended set to true. This value will 23 // The set of types that have initial_sync_ended set to true. This value will
24 // be used by InitialSyncEndedTypes() until the next configuration is 24 // be used by InitialSyncEndedTypes() until the next configuration is
25 // performed. 25 // performed.
26 void set_initial_sync_ended_types(syncer::ModelTypeSet types); 26 void set_initial_sync_ended_types(ModelTypeSet types);
27 27
28 // The set of types that have valid progress markers. This will be used by 28 // The set of types that have valid progress markers. This will be used by
29 // GetTypesWithEmptyProgressMarkerToken() until the next configuration is 29 // GetTypesWithEmptyProgressMarkerToken() until the next configuration is
30 // performed. 30 // performed.
31 void set_progress_marker_types(syncer::ModelTypeSet types); 31 void set_progress_marker_types(ModelTypeSet types);
32 32
33 // The set of types that will fail configuration. Once ConfigureSyncer is 33 // The set of types that will fail configuration. Once ConfigureSyncer is
34 // called, the |initial_sync_ended_types_| and 34 // called, the |initial_sync_ended_types_| and
35 // |progress_marker_types_| will be updated to include those types 35 // |progress_marker_types_| will be updated to include those types
36 // that didn't fail. 36 // that didn't fail.
37 void set_configure_fail_types(syncer::ModelTypeSet types); 37 void set_configure_fail_types(ModelTypeSet types);
38 38
39 // Returns those types that have been cleaned (purged from the directory) 39 // Returns those types that have been cleaned (purged from the directory)
40 // since the last call to GetAndResetCleanedTypes(), or since startup if never 40 // since the last call to GetAndResetCleanedTypes(), or since startup if never
41 // called. 41 // called.
42 syncer::ModelTypeSet GetAndResetCleanedTypes(); 42 ModelTypeSet GetAndResetCleanedTypes();
43 43
44 // Returns those types that have been downloaded since the last call to 44 // Returns those types that have been downloaded since the last call to
45 // GetAndResetDownloadedTypes(), or since startup if never called. 45 // GetAndResetDownloadedTypes(), or since startup if never called.
46 syncer::ModelTypeSet GetAndResetDownloadedTypes(); 46 ModelTypeSet GetAndResetDownloadedTypes();
47 47
48 // SyncManager implementation. 48 // SyncManager implementation.
49 // Note: we treat whatever message loop this is called from as the sync 49 // Note: we treat whatever message loop this is called from as the sync
50 // loop for purposes of callbacks. 50 // loop for purposes of callbacks.
51 virtual bool Init( 51 virtual bool Init(
52 const FilePath& database_location, 52 const FilePath& database_location,
53 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler, 53 const WeakHandle<JsEventHandler>& event_handler,
54 const std::string& sync_server_and_path, 54 const std::string& sync_server_and_path,
55 int sync_server_port, 55 int sync_server_port,
56 bool use_ssl, 56 bool use_ssl,
57 const scoped_refptr<base::TaskRunner>& blocking_task_runner, 57 const scoped_refptr<base::TaskRunner>& blocking_task_runner,
58 scoped_ptr<HttpPostProviderFactory> post_factory, 58 scoped_ptr<HttpPostProviderFactory> post_factory,
59 const syncer::ModelSafeRoutingInfo& model_safe_routing_info, 59 const ModelSafeRoutingInfo& model_safe_routing_info,
60 const std::vector<syncer::ModelSafeWorker*>& workers, 60 const std::vector<ModelSafeWorker*>& workers,
61 syncer::ExtensionsActivityMonitor* 61 ExtensionsActivityMonitor* extensions_activity_monitor,
62 extensions_activity_monitor,
63 ChangeDelegate* change_delegate, 62 ChangeDelegate* change_delegate,
64 const SyncCredentials& credentials, 63 const SyncCredentials& credentials,
65 scoped_ptr<syncer::SyncNotifier> sync_notifier, 64 scoped_ptr<SyncNotifier> sync_notifier,
66 const std::string& restored_key_for_bootstrapping, 65 const std::string& restored_key_for_bootstrapping,
67 scoped_ptr<InternalComponentsFactory> internal_components_factory, 66 scoped_ptr<InternalComponentsFactory> internal_components_factory,
68 syncer::Encryptor* encryptor, 67 Encryptor* encryptor,
69 syncer::UnrecoverableErrorHandler* unrecoverable_error_handler, 68 UnrecoverableErrorHandler* unrecoverable_error_handler,
70 syncer::ReportUnrecoverableErrorFunction 69 ReportUnrecoverableErrorFunction
71 report_unrecoverable_error_function) OVERRIDE; 70 report_unrecoverable_error_function) OVERRIDE;
72 virtual void ThrowUnrecoverableError() OVERRIDE; 71 virtual void ThrowUnrecoverableError() OVERRIDE;
73 virtual syncer::ModelTypeSet InitialSyncEndedTypes() OVERRIDE; 72 virtual ModelTypeSet InitialSyncEndedTypes() OVERRIDE;
74 virtual syncer::ModelTypeSet GetTypesWithEmptyProgressMarkerToken( 73 virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken(
75 syncer::ModelTypeSet types) OVERRIDE; 74 ModelTypeSet types) OVERRIDE;
76 virtual bool PurgePartiallySyncedTypes() OVERRIDE; 75 virtual bool PurgePartiallySyncedTypes() OVERRIDE;
77 virtual void UpdateCredentials(const SyncCredentials& credentials) OVERRIDE; 76 virtual void UpdateCredentials(const SyncCredentials& credentials) OVERRIDE;
78 virtual void UpdateEnabledTypes(const syncer::ModelTypeSet& types) OVERRIDE; 77 virtual void UpdateEnabledTypes(const ModelTypeSet& types) OVERRIDE;
79 virtual void StartSyncingNormally( 78 virtual void StartSyncingNormally(
80 const syncer::ModelSafeRoutingInfo& routing_info) OVERRIDE; 79 const ModelSafeRoutingInfo& routing_info) OVERRIDE;
81 virtual void SetEncryptionPassphrase(const std::string& passphrase, 80 virtual void SetEncryptionPassphrase(const std::string& passphrase,
82 bool is_explicit) OVERRIDE; 81 bool is_explicit) OVERRIDE;
83 virtual void SetDecryptionPassphrase(const std::string& passphrase) OVERRIDE; 82 virtual void SetDecryptionPassphrase(const std::string& passphrase) OVERRIDE;
84 virtual void ConfigureSyncer( 83 virtual void ConfigureSyncer(
85 ConfigureReason reason, 84 ConfigureReason reason,
86 const syncer::ModelTypeSet& types_to_config, 85 const ModelTypeSet& types_to_config,
87 const syncer::ModelSafeRoutingInfo& new_routing_info, 86 const ModelSafeRoutingInfo& new_routing_info,
88 const base::Closure& ready_task, 87 const base::Closure& ready_task,
89 const base::Closure& retry_task) OVERRIDE; 88 const base::Closure& retry_task) OVERRIDE;
90 virtual void AddObserver(Observer* observer) OVERRIDE; 89 virtual void AddObserver(Observer* observer) OVERRIDE;
91 virtual void RemoveObserver(Observer* observer) OVERRIDE; 90 virtual void RemoveObserver(Observer* observer) OVERRIDE;
92 virtual SyncStatus GetDetailedStatus() const OVERRIDE; 91 virtual SyncStatus GetDetailedStatus() const OVERRIDE;
93 virtual bool IsUsingExplicitPassphrase() OVERRIDE; 92 virtual bool IsUsingExplicitPassphrase() OVERRIDE;
94 virtual void SaveChanges() OVERRIDE; 93 virtual void SaveChanges() OVERRIDE;
95 virtual void StopSyncingForShutdown(const base::Closure& callback) OVERRIDE; 94 virtual void StopSyncingForShutdown(const base::Closure& callback) OVERRIDE;
96 virtual void ShutdownOnSyncThread() OVERRIDE; 95 virtual void ShutdownOnSyncThread() OVERRIDE;
97 virtual UserShare* GetUserShare() OVERRIDE; 96 virtual UserShare* GetUserShare() OVERRIDE;
98 virtual void RefreshNigori(const std::string& chrome_version, 97 virtual void RefreshNigori(const std::string& chrome_version,
99 const base::Closure& done_callback) OVERRIDE; 98 const base::Closure& done_callback) OVERRIDE;
100 virtual void EnableEncryptEverything() OVERRIDE; 99 virtual void EnableEncryptEverything() OVERRIDE;
101 virtual bool ReceivedExperiment(syncer::Experiments* experiments) OVERRIDE; 100 virtual bool ReceivedExperiment(Experiments* experiments) OVERRIDE;
102 virtual bool HasUnsyncedItems() OVERRIDE; 101 virtual bool HasUnsyncedItems() OVERRIDE;
103 102
104 private: 103 private:
105 ObserverList<SyncManager::Observer> observers_; 104 ObserverList<SyncManager::Observer> observers_;
106 105
107 // Faked directory state. 106 // Faked directory state.
108 syncer::ModelTypeSet initial_sync_ended_types_; 107 ModelTypeSet initial_sync_ended_types_;
109 syncer::ModelTypeSet progress_marker_types_; 108 ModelTypeSet progress_marker_types_;
110 109
111 // Test specific state. 110 // Test specific state.
112 // The types that should fail configuration attempts. These types will not 111 // The types that should fail configuration attempts. These types will not
113 // have their progress markers or initial_sync_ended bits set. 112 // have their progress markers or initial_sync_ended bits set.
114 syncer::ModelTypeSet configure_fail_types_; 113 ModelTypeSet configure_fail_types_;
115 // The set of types that have been cleaned up. 114 // The set of types that have been cleaned up.
116 syncer::ModelTypeSet cleaned_types_; 115 ModelTypeSet cleaned_types_;
117 // The set of types that have been downloaded. 116 // The set of types that have been downloaded.
118 syncer::ModelTypeSet downloaded_types_; 117 ModelTypeSet downloaded_types_;
119 118
120 // For StopSyncingForShutdown's callback. 119 // For StopSyncingForShutdown's callback.
121 MessageLoop* sync_loop_; 120 MessageLoop* sync_loop_;
122 121
123 DISALLOW_COPY_AND_ASSIGN(FakeSyncManager); 122 DISALLOW_COPY_AND_ASSIGN(FakeSyncManager);
124 }; 123 };
125 124
126 } // namespace syncer 125 } // namespace syncer
127 126
128 #endif // SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_SYNC_MANAGER_H_ 127 #endif // SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_SYNC_MANAGER_H_
OLDNEW
« no previous file with comments | « sync/internal_api/public/sync_manager_factory.h ('k') | sync/internal_api/public/test/test_entry_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698