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

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

Issue 10824252: Revert 150990 - [Sync] Avoid unregistering object IDs on shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « sync/internal_api/public/sync_manager.h ('k') | sync/internal_api/sync_manager_impl.h » ('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 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 "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "sync/internal_api/public/sync_manager.h" 12 #include "sync/internal_api/public/sync_manager.h"
13 #include "sync/notifier/sync_notifier_registrar.h" 13 #include "sync/notifier/sync_notifier_helper.h"
14 14
15 namespace base { 15 namespace base {
16 class SequencedTaskRunner; 16 class SequencedTaskRunner;
17 } 17 }
18 18
19 namespace syncer { 19 namespace syncer {
20 20
21 class FakeSyncManager : public SyncManager { 21 class FakeSyncManager : public SyncManager {
22 public: 22 public:
23 // |initial_sync_ended_types|: The set of types that have initial_sync_ended 23 explicit FakeSyncManager();
24 // set to true. This value will be used by InitialSyncEndedTypes() until the
25 // next configuration is performed.
26 //
27 // |progress_marker_types|: The set of types that have valid progress
28 // markers. This will be used by GetTypesWithEmptyProgressMarkerToken() until
29 // the next configuration is performed.
30 //
31 // |configure_fail_types|: The set of types that will fail
32 // configuration. Once ConfigureSyncer is called, the
33 // |initial_sync_ended_types_| and |progress_marker_types_| will be updated
34 // to include those types that didn't fail.
35 FakeSyncManager(ModelTypeSet initial_sync_ended_types,
36 ModelTypeSet progress_marker_types,
37 ModelTypeSet configure_fail_types);
38 virtual ~FakeSyncManager(); 24 virtual ~FakeSyncManager();
39 25
26 // The set of types that have initial_sync_ended set to true. This value will
27 // be used by InitialSyncEndedTypes() until the next configuration is
28 // performed.
29 void set_initial_sync_ended_types(ModelTypeSet types);
30
31 // The set of types that have valid progress markers. This will be used by
32 // GetTypesWithEmptyProgressMarkerToken() until the next configuration is
33 // performed.
34 void set_progress_marker_types(ModelTypeSet types);
35
36 // The set of types that will fail configuration. Once ConfigureSyncer is
37 // called, the |initial_sync_ended_types_| and
38 // |progress_marker_types_| will be updated to include those types
39 // that didn't fail.
40 void set_configure_fail_types(ModelTypeSet types);
41
40 // Returns those types that have been cleaned (purged from the directory) 42 // Returns those types that have been cleaned (purged from the directory)
41 // since the last call to GetAndResetCleanedTypes(), or since startup if never 43 // since the last call to GetAndResetCleanedTypes(), or since startup if never
42 // called. 44 // called.
43 ModelTypeSet GetAndResetCleanedTypes(); 45 ModelTypeSet GetAndResetCleanedTypes();
44 46
45 // Returns those types that have been downloaded since the last call to 47 // Returns those types that have been downloaded since the last call to
46 // GetAndResetDownloadedTypes(), or since startup if never called. 48 // GetAndResetDownloadedTypes(), or since startup if never called.
47 ModelTypeSet GetAndResetDownloadedTypes(); 49 ModelTypeSet GetAndResetDownloadedTypes();
48 50
49 // Returns those types that have been marked as enabled since the 51 // Returns those types that have been marked as enabled since the
50 // last call to GetAndResetEnabledTypes(), or since startup if never 52 // last call to GetAndResetEnabledTypes(), or since startup if never
51 // called. 53 // called.
52 ModelTypeSet GetAndResetEnabledTypes(); 54 ModelTypeSet GetAndResetEnabledTypes();
53 55
54 // Posts a method to invalidate the given IDs on the sync thread. 56 // Posts a method to invalidate the given IDs on the sync thread.
55 void Invalidate(const ObjectIdPayloadMap& id_payloads, 57 void Invalidate(const ObjectIdPayloadMap& id_payloads,
56 IncomingNotificationSource source); 58 IncomingNotificationSource source);
57 59
58 // Posts a method to enable notifications on the sync thread. 60 // Posts a method to enable notifications on the sync thread.
59 void EnableNotifications(); 61 void EnableNotifications();
60 62
61 // Posts a method to disable notifications on the sync thread. 63 // Posts a method to disable notifications on the sync thread.
62 void DisableNotifications(NotificationsDisabledReason reason); 64 void DisableNotifications(NotificationsDisabledReason reason);
63 65
64 // Block until the sync thread has finished processing any pending messages.
65 void WaitForSyncThread();
66
67 // SyncManager implementation. 66 // SyncManager implementation.
68 // Note: we treat whatever message loop this is called from as the sync 67 // Note: we treat whatever message loop this is called from as the sync
69 // loop for purposes of callbacks. 68 // loop for purposes of callbacks.
70 virtual void Init( 69 virtual void Init(
71 const FilePath& database_location, 70 const FilePath& database_location,
72 const WeakHandle<JsEventHandler>& event_handler, 71 const WeakHandle<JsEventHandler>& event_handler,
73 const std::string& sync_server_and_path, 72 const std::string& sync_server_and_path,
74 int sync_server_port, 73 int sync_server_port,
75 bool use_ssl, 74 bool use_ssl,
76 const scoped_refptr<base::TaskRunner>& blocking_task_runner, 75 const scoped_refptr<base::TaskRunner>& blocking_task_runner,
(...skipping 11 matching lines...) Expand all
88 UnrecoverableErrorHandler* unrecoverable_error_handler, 87 UnrecoverableErrorHandler* unrecoverable_error_handler,
89 ReportUnrecoverableErrorFunction 88 ReportUnrecoverableErrorFunction
90 report_unrecoverable_error_function) OVERRIDE; 89 report_unrecoverable_error_function) OVERRIDE;
91 virtual void ThrowUnrecoverableError() OVERRIDE; 90 virtual void ThrowUnrecoverableError() OVERRIDE;
92 virtual ModelTypeSet InitialSyncEndedTypes() OVERRIDE; 91 virtual ModelTypeSet InitialSyncEndedTypes() OVERRIDE;
93 virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken( 92 virtual ModelTypeSet GetTypesWithEmptyProgressMarkerToken(
94 ModelTypeSet types) OVERRIDE; 93 ModelTypeSet types) OVERRIDE;
95 virtual bool PurgePartiallySyncedTypes() OVERRIDE; 94 virtual bool PurgePartiallySyncedTypes() OVERRIDE;
96 virtual void UpdateCredentials(const SyncCredentials& credentials) OVERRIDE; 95 virtual void UpdateCredentials(const SyncCredentials& credentials) OVERRIDE;
97 virtual void UpdateEnabledTypes(const ModelTypeSet& types) OVERRIDE; 96 virtual void UpdateEnabledTypes(const ModelTypeSet& types) OVERRIDE;
98 virtual void RegisterInvalidationHandler(
99 SyncNotifierObserver* handler) OVERRIDE;
100 virtual void UpdateRegisteredInvalidationIds( 97 virtual void UpdateRegisteredInvalidationIds(
101 SyncNotifierObserver* handler, 98 SyncNotifierObserver* handler,
102 const ObjectIdSet& ids) OVERRIDE; 99 const ObjectIdSet& ids) OVERRIDE;
103 virtual void UnregisterInvalidationHandler(
104 SyncNotifierObserver* handler) OVERRIDE;
105 virtual void StartSyncingNormally( 100 virtual void StartSyncingNormally(
106 const ModelSafeRoutingInfo& routing_info) OVERRIDE; 101 const ModelSafeRoutingInfo& routing_info) OVERRIDE;
107 virtual void SetEncryptionPassphrase(const std::string& passphrase, 102 virtual void SetEncryptionPassphrase(const std::string& passphrase,
108 bool is_explicit) OVERRIDE; 103 bool is_explicit) OVERRIDE;
109 virtual void SetDecryptionPassphrase(const std::string& passphrase) OVERRIDE; 104 virtual void SetDecryptionPassphrase(const std::string& passphrase) OVERRIDE;
110 virtual void ConfigureSyncer( 105 virtual void ConfigureSyncer(
111 ConfigureReason reason, 106 ConfigureReason reason,
112 const ModelTypeSet& types_to_config, 107 const ModelTypeSet& types_to_config,
113 const ModelSafeRoutingInfo& new_routing_info, 108 const ModelSafeRoutingInfo& new_routing_info,
114 const base::Closure& ready_task, 109 const base::Closure& ready_task,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // have their progress markers or initial_sync_ended bits set. 143 // have their progress markers or initial_sync_ended bits set.
149 ModelTypeSet configure_fail_types_; 144 ModelTypeSet configure_fail_types_;
150 // The set of types that have been cleaned up. 145 // The set of types that have been cleaned up.
151 ModelTypeSet cleaned_types_; 146 ModelTypeSet cleaned_types_;
152 // The set of types that have been downloaded. 147 // The set of types that have been downloaded.
153 ModelTypeSet downloaded_types_; 148 ModelTypeSet downloaded_types_;
154 // The set of types that have been enabled. 149 // The set of types that have been enabled.
155 ModelTypeSet enabled_types_; 150 ModelTypeSet enabled_types_;
156 151
157 // Faked notifier state. 152 // Faked notifier state.
158 SyncNotifierRegistrar registrar_; 153 SyncNotifierHelper notifier_helper_;
159 154
160 DISALLOW_COPY_AND_ASSIGN(FakeSyncManager); 155 DISALLOW_COPY_AND_ASSIGN(FakeSyncManager);
161 }; 156 };
162 157
163 } // namespace syncer 158 } // namespace syncer
164 159
165 #endif // SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_SYNC_MANAGER_H_ 160 #endif // SYNC_INTERNAL_API_PUBLIC_TEST_FAKE_SYNC_MANAGER_H_
OLDNEW
« no previous file with comments | « sync/internal_api/public/sync_manager.h ('k') | sync/internal_api/sync_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698