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

Side by Side Diff: components/sync/engine/fake_sync_manager.h

Issue 2644373003: Revert of [Sync] Make directory types registration explicit in ModelTypeRegistry (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « components/sync/engine/fake_sync_engine.cc ('k') | components/sync/engine/fake_sync_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 COMPONENTS_SYNC_ENGINE_FAKE_SYNC_MANAGER_H_ 5 #ifndef COMPONENTS_SYNC_ENGINE_FAKE_SYNC_MANAGER_H_
6 #define COMPONENTS_SYNC_ENGINE_FAKE_SYNC_MANAGER_H_ 6 #define COMPONENTS_SYNC_ENGINE_FAKE_SYNC_MANAGER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "components/sync/engine/fake_model_type_connector.h"
16 #include "components/sync/engine/sync_manager.h" 15 #include "components/sync/engine/sync_manager.h"
17 #include "components/sync/syncable/test_user_share.h" 16 #include "components/sync/syncable/test_user_share.h"
18 #include "components/sync/test/fake_sync_encryption_handler.h"
19 17
20 namespace base { 18 namespace base {
21 class SequencedTaskRunner; 19 class SequencedTaskRunner;
22 } 20 }
23 21
24 namespace syncer { 22 namespace syncer {
25 23
26 class FakeSyncEncryptionHandler; 24 class FakeSyncEncryptionHandler;
27 25
28 class FakeSyncManager : public SyncManager { 26 class FakeSyncManager : public SyncManager {
(...skipping 21 matching lines...) Expand all
50 48
51 // Returns those types that have been unapplied as part of purging disabled 49 // Returns those types that have been unapplied as part of purging disabled
52 // types since the last call to GetAndResetUnappliedTypes, or since startup if 50 // types since the last call to GetAndResetUnappliedTypes, or since startup if
53 // never called. 51 // never called.
54 ModelTypeSet GetAndResetUnappliedTypes(); 52 ModelTypeSet GetAndResetUnappliedTypes();
55 53
56 // Returns those types that have been downloaded since the last call to 54 // Returns those types that have been downloaded since the last call to
57 // GetAndResetDownloadedTypes(), or since startup if never called. 55 // GetAndResetDownloadedTypes(), or since startup if never called.
58 ModelTypeSet GetAndResetDownloadedTypes(); 56 ModelTypeSet GetAndResetDownloadedTypes();
59 57
58 // Returns those types that have been marked as enabled since the
59 // last call to GetAndResetEnabledTypes(), or since startup if never
60 // called.
61 ModelTypeSet GetAndResetEnabledTypes();
62
60 // Returns the types that have most recently received a refresh request. 63 // Returns the types that have most recently received a refresh request.
61 ModelTypeSet GetLastRefreshRequestTypes(); 64 ModelTypeSet GetLastRefreshRequestTypes();
62 65
63 // Returns the most recent configuration reason since the last call to 66 // Returns the most recent configuration reason since the last call to
64 // GetAndResetConfigureReason, or since startup if never called. 67 // GetAndResetConfigureReason, or since startup if never called.
65 ConfigureReason GetAndResetConfigureReason(); 68 ConfigureReason GetAndResetConfigureReason();
66 69
67 // Returns the number of invalidations received since startup. 70 // Returns the number of invalidations received since startup.
68 int GetInvalidationCount() const; 71 int GetInvalidationCount() const;
69 72
70 // Block until the sync thread has finished processing any pending messages. 73 // Block until the sync thread has finished processing any pending messages.
71 void WaitForSyncThread(); 74 void WaitForSyncThread();
72 75
73 // SyncManager implementation. 76 // SyncManager implementation.
74 // Note: we treat whatever message loop this is called from as the sync 77 // Note: we treat whatever message loop this is called from as the sync
75 // loop for purposes of callbacks. 78 // loop for purposes of callbacks.
76 void Init(InitArgs* args) override; 79 void Init(InitArgs* args) override;
77 ModelTypeSet InitialSyncEndedTypes() override; 80 ModelTypeSet InitialSyncEndedTypes() override;
78 ModelTypeSet GetTypesWithEmptyProgressMarkerToken( 81 ModelTypeSet GetTypesWithEmptyProgressMarkerToken(
79 ModelTypeSet types) override; 82 ModelTypeSet types) override;
80 void PurgePartiallySyncedTypes() override; 83 void PurgePartiallySyncedTypes() override;
81 void PurgeDisabledTypes(ModelTypeSet to_purge, 84 void PurgeDisabledTypes(ModelTypeSet to_purge,
82 ModelTypeSet to_journal, 85 ModelTypeSet to_journal,
83 ModelTypeSet to_unapply) override; 86 ModelTypeSet to_unapply) override;
84 void UpdateCredentials(const SyncCredentials& credentials) override; 87 void UpdateCredentials(const SyncCredentials& credentials) override;
85 void StartSyncingNormally(base::Time last_poll_time) override; 88 void StartSyncingNormally(const ModelSafeRoutingInfo& routing_info,
86 void StartConfiguration() override; 89 base::Time last_poll_time) override;
87 void ConfigureSyncer(ConfigureReason reason, 90 void ConfigureSyncer(ConfigureReason reason,
88 ModelTypeSet to_download, 91 ModelTypeSet to_download,
92 const ModelSafeRoutingInfo& new_routing_info,
89 const base::Closure& ready_task, 93 const base::Closure& ready_task,
90 const base::Closure& retry_task) override; 94 const base::Closure& retry_task) override;
91 void OnIncomingInvalidation( 95 void OnIncomingInvalidation(
92 ModelType type, 96 ModelType type,
93 std::unique_ptr<InvalidationInterface> interface) override; 97 std::unique_ptr<InvalidationInterface> interface) override;
94 void SetInvalidatorEnabled(bool invalidator_enabled) override; 98 void SetInvalidatorEnabled(bool invalidator_enabled) override;
95 void AddObserver(Observer* observer) override; 99 void AddObserver(Observer* observer) override;
96 void RemoveObserver(Observer* observer) override; 100 void RemoveObserver(Observer* observer) override;
97 SyncStatus GetDetailedStatus() const override; 101 SyncStatus GetDetailedStatus() const override;
98 void SaveChanges() override; 102 void SaveChanges() override;
99 void ShutdownOnSyncThread(ShutdownReason reason) override; 103 void ShutdownOnSyncThread(ShutdownReason reason) override;
100 UserShare* GetUserShare() override; 104 UserShare* GetUserShare() override;
101 ModelTypeConnector* GetModelTypeConnector() override;
102 std::unique_ptr<ModelTypeConnector> GetModelTypeConnectorProxy() override; 105 std::unique_ptr<ModelTypeConnector> GetModelTypeConnectorProxy() override;
103 const std::string cache_guid() override; 106 const std::string cache_guid() override;
104 bool ReceivedExperiment(Experiments* experiments) override; 107 bool ReceivedExperiment(Experiments* experiments) override;
105 bool HasUnsyncedItems() override; 108 bool HasUnsyncedItems() override;
106 SyncEncryptionHandler* GetEncryptionHandler() override; 109 SyncEncryptionHandler* GetEncryptionHandler() override;
107 std::vector<std::unique_ptr<ProtocolEvent>> GetBufferedProtocolEvents() 110 std::vector<std::unique_ptr<ProtocolEvent>> GetBufferedProtocolEvents()
108 override; 111 override;
109 void RefreshTypes(ModelTypeSet types) override; 112 void RefreshTypes(ModelTypeSet types) override;
110 void RegisterDirectoryTypeDebugInfoObserver( 113 void RegisterDirectoryTypeDebugInfoObserver(
111 TypeDebugInfoObserver* observer) override; 114 TypeDebugInfoObserver* observer) override;
(...skipping 18 matching lines...) Expand all
130 // Test specific state. 133 // Test specific state.
131 // The types that should fail configuration attempts. These types will not 134 // The types that should fail configuration attempts. These types will not
132 // have their progress markers or initial_sync_ended bits set. 135 // have their progress markers or initial_sync_ended bits set.
133 ModelTypeSet configure_fail_types_; 136 ModelTypeSet configure_fail_types_;
134 // The set of types that have been purged. 137 // The set of types that have been purged.
135 ModelTypeSet purged_types_; 138 ModelTypeSet purged_types_;
136 // Subset of |purged_types_| that were unapplied. 139 // Subset of |purged_types_| that were unapplied.
137 ModelTypeSet unapplied_types_; 140 ModelTypeSet unapplied_types_;
138 // The set of types that have been downloaded. 141 // The set of types that have been downloaded.
139 ModelTypeSet downloaded_types_; 142 ModelTypeSet downloaded_types_;
143 // The set of types that have been enabled.
144 ModelTypeSet enabled_types_;
140 145
141 // The types for which a refresh was most recently requested. 146 // The types for which a refresh was most recently requested.
142 ModelTypeSet last_refresh_request_types_; 147 ModelTypeSet last_refresh_request_types_;
143 148
144 // The most recent configure reason. 149 // The most recent configure reason.
145 ConfigureReason last_configure_reason_; 150 ConfigureReason last_configure_reason_;
146 151
147 FakeModelTypeConnector fake_model_type_connector_; 152 std::unique_ptr<FakeSyncEncryptionHandler> fake_encryption_handler_;
148
149 FakeSyncEncryptionHandler fake_encryption_handler_;
150 153
151 TestUserShare test_user_share_; 154 TestUserShare test_user_share_;
152 155
153 // Number of invalidations received since startup. 156 // Number of invalidations received since startup.
154 int num_invalidations_received_; 157 int num_invalidations_received_;
155 158
156 DISALLOW_COPY_AND_ASSIGN(FakeSyncManager); 159 DISALLOW_COPY_AND_ASSIGN(FakeSyncManager);
157 }; 160 };
158 161
159 } // namespace syncer 162 } // namespace syncer
160 163
161 #endif // COMPONENTS_SYNC_ENGINE_FAKE_SYNC_MANAGER_H_ 164 #endif // COMPONENTS_SYNC_ENGINE_FAKE_SYNC_MANAGER_H_
OLDNEW
« no previous file with comments | « components/sync/engine/fake_sync_engine.cc ('k') | components/sync/engine/fake_sync_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698