OLD | NEW |
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 CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ |
6 #define CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ | 6 #define CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 virtual void RequestConfigureSyncer( | 46 virtual void RequestConfigureSyncer( |
47 syncer::ConfigureReason reason, | 47 syncer::ConfigureReason reason, |
48 syncer::ModelTypeSet to_download, | 48 syncer::ModelTypeSet to_download, |
49 syncer::ModelTypeSet to_purge, | 49 syncer::ModelTypeSet to_purge, |
50 syncer::ModelTypeSet to_journal, | 50 syncer::ModelTypeSet to_journal, |
51 syncer::ModelTypeSet to_unapply, | 51 syncer::ModelTypeSet to_unapply, |
52 syncer::ModelTypeSet to_ignore, | 52 syncer::ModelTypeSet to_ignore, |
53 const syncer::ModelSafeRoutingInfo& routing_info, | 53 const syncer::ModelSafeRoutingInfo& routing_info, |
54 const base::Callback<void(syncer::ModelTypeSet, | 54 const base::Callback<void(syncer::ModelTypeSet, |
55 syncer::ModelTypeSet)>& ready_task, | 55 syncer::ModelTypeSet)>& ready_task, |
56 const base::Closure& retry_callback) OVERRIDE; | 56 const base::Closure& retry_callback) override; |
57 | 57 |
58 protected: | 58 protected: |
59 virtual void InitCore(scoped_ptr<DoInitializeOptions> options) OVERRIDE; | 59 virtual void InitCore(scoped_ptr<DoInitializeOptions> options) override; |
60 | 60 |
61 private: | 61 private: |
62 // Invoked at the start of HandleSyncManagerInitializationOnFrontendLoop. | 62 // Invoked at the start of HandleSyncManagerInitializationOnFrontendLoop. |
63 // Allows extra initialization work to be performed before the backend comes | 63 // Allows extra initialization work to be performed before the backend comes |
64 // up. | 64 // up. |
65 base::Closure callback_; | 65 base::Closure callback_; |
66 }; | 66 }; |
67 | 67 |
68 } // namespace browser_sync | 68 } // namespace browser_sync |
69 | 69 |
70 class TestProfileSyncService : public ProfileSyncService { | 70 class TestProfileSyncService : public ProfileSyncService { |
71 public: | 71 public: |
72 // TODO(tim): Add ability to inject TokenService alongside SigninManager. | 72 // TODO(tim): Add ability to inject TokenService alongside SigninManager. |
73 // TODO(rogerta): what does above comment mean? | 73 // TODO(rogerta): what does above comment mean? |
74 TestProfileSyncService( | 74 TestProfileSyncService( |
75 scoped_ptr<ProfileSyncComponentsFactory> factory, | 75 scoped_ptr<ProfileSyncComponentsFactory> factory, |
76 Profile* profile, | 76 Profile* profile, |
77 SigninManagerBase* signin, | 77 SigninManagerBase* signin, |
78 ProfileOAuth2TokenService* oauth2_token_service, | 78 ProfileOAuth2TokenService* oauth2_token_service, |
79 browser_sync::ProfileSyncServiceStartBehavior behavior); | 79 browser_sync::ProfileSyncServiceStartBehavior behavior); |
80 | 80 |
81 virtual ~TestProfileSyncService(); | 81 virtual ~TestProfileSyncService(); |
82 | 82 |
83 virtual void OnConfigureDone( | 83 virtual void OnConfigureDone( |
84 const sync_driver::DataTypeManager::ConfigureResult& result) OVERRIDE; | 84 const sync_driver::DataTypeManager::ConfigureResult& result) override; |
85 | 85 |
86 // We implement our own version to avoid some DCHECKs. | 86 // We implement our own version to avoid some DCHECKs. |
87 virtual syncer::UserShare* GetUserShare() const OVERRIDE; | 87 virtual syncer::UserShare* GetUserShare() const override; |
88 | 88 |
89 static TestProfileSyncService* BuildAutoStartAsyncInit( | 89 static TestProfileSyncService* BuildAutoStartAsyncInit( |
90 Profile* profile, base::Closure callback); | 90 Profile* profile, base::Closure callback); |
91 | 91 |
92 ProfileSyncComponentsFactoryMock* components_factory_mock(); | 92 ProfileSyncComponentsFactoryMock* components_factory_mock(); |
93 | 93 |
94 syncer::TestIdFactory* id_factory(); | 94 syncer::TestIdFactory* id_factory(); |
95 | 95 |
96 // Raise visibility to ease testing. | 96 // Raise visibility to ease testing. |
97 using ProfileSyncService::NotifyObservers; | 97 using ProfileSyncService::NotifyObservers; |
98 | 98 |
99 protected: | 99 protected: |
100 static KeyedService* TestFactoryFunction(content::BrowserContext* profile); | 100 static KeyedService* TestFactoryFunction(content::BrowserContext* profile); |
101 | 101 |
102 // Return NULL handle to use in backend initialization to avoid receiving | 102 // Return NULL handle to use in backend initialization to avoid receiving |
103 // js messages on UI loop when it's being destroyed, which are not deleted | 103 // js messages on UI loop when it's being destroyed, which are not deleted |
104 // and cause memory leak in test. | 104 // and cause memory leak in test. |
105 virtual syncer::WeakHandle<syncer::JsEventHandler> GetJsEventHandler() | 105 virtual syncer::WeakHandle<syncer::JsEventHandler> GetJsEventHandler() |
106 OVERRIDE; | 106 override; |
107 | 107 |
108 virtual bool NeedBackup() const OVERRIDE; | 108 virtual bool NeedBackup() const override; |
109 | 109 |
110 private: | 110 private: |
111 syncer::TestIdFactory id_factory_; | 111 syncer::TestIdFactory id_factory_; |
112 }; | 112 }; |
113 | 113 |
114 #endif // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ | 114 #endif // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |