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" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "chrome/browser/sync/glue/data_type_manager_impl.h" | 13 #include "chrome/browser/sync/glue/data_type_manager_impl.h" |
14 #include "chrome/browser/sync/invalidations/invalidator_storage.h" | 14 #include "chrome/browser/sync/invalidations/invalidator_storage.h" |
15 #include "chrome/browser/sync/profile_sync_service.h" | 15 #include "chrome/browser/sync/profile_sync_service.h" |
16 #include "chrome/browser/sync/sync_prefs.h" | 16 #include "chrome/browser/sync/sync_prefs.h" |
17 #include "chrome/test/base/profile_mock.h" | 17 #include "chrome/test/base/profile_mock.h" |
18 #include "sync/internal_api/public/test/test_internal_components_factory.h" | 18 #include "sync/internal_api/public/test/test_internal_components_factory.h" |
19 #include "sync/test/engine/test_id_factory.h" | 19 #include "sync/test/engine/test_id_factory.h" |
20 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
21 | 21 |
22 class Profile; | 22 class Profile; |
23 class Task; | 23 class Task; |
24 class TestProfileSyncService; | 24 class TestProfileSyncService; |
25 | 25 |
26 ACTION(ReturnNewDataTypeManager) { | 26 ACTION(ReturnNewDataTypeManager) { |
27 return new browser_sync::DataTypeManagerImpl(arg0, arg1); | 27 return new browser_sync::DataTypeManagerImpl(arg0, arg1, arg2); |
28 } | 28 } |
29 | 29 |
30 namespace browser_sync { | 30 namespace browser_sync { |
31 | 31 |
32 class SyncBackendHostForProfileSyncTest : public SyncBackendHost { | 32 class SyncBackendHostForProfileSyncTest : public SyncBackendHost { |
33 public: | 33 public: |
34 // |synchronous_init| causes initialization to block until the syncapi has | 34 // |synchronous_init| causes initialization to block until the syncapi has |
35 // completed setting itself up and called us back. | 35 // completed setting itself up and called us back. |
36 // TOOD(akalin): Remove |synchronous_init| (http://crbug.com/140354). | 36 // TOOD(akalin): Remove |synchronous_init| (http://crbug.com/140354). |
37 SyncBackendHostForProfileSyncTest( | 37 SyncBackendHostForProfileSyncTest( |
(...skipping 11 matching lines...) Expand all Loading... |
49 MOCK_METHOD1(RequestNudge, void(const tracked_objects::Location&)); | 49 MOCK_METHOD1(RequestNudge, void(const tracked_objects::Location&)); |
50 | 50 |
51 virtual void RequestConfigureSyncer( | 51 virtual void RequestConfigureSyncer( |
52 syncer::ConfigureReason reason, | 52 syncer::ConfigureReason reason, |
53 syncer::ModelTypeSet types_to_config, | 53 syncer::ModelTypeSet types_to_config, |
54 const syncer::ModelSafeRoutingInfo& routing_info, | 54 const syncer::ModelSafeRoutingInfo& routing_info, |
55 const base::Callback<void(syncer::ModelTypeSet)>& ready_task, | 55 const base::Callback<void(syncer::ModelTypeSet)>& ready_task, |
56 const base::Closure& retry_callback) OVERRIDE; | 56 const base::Closure& retry_callback) OVERRIDE; |
57 | 57 |
58 virtual void HandleSyncManagerInitializationOnFrontendLoop( | 58 virtual void HandleSyncManagerInitializationOnFrontendLoop( |
59 const syncer::WeakHandle<syncer::JsBackend>& js_backend, bool success, | 59 const syncer::WeakHandle<syncer::JsBackend>& js_backend, |
60 syncer::ModelTypeSet restored_types) OVERRIDE; | 60 bool success, |
| 61 syncer::ModelTypeSet restored_types) OVERRIDE; |
61 | 62 |
62 static void SetHistoryServiceExpectations(ProfileMock* profile); | 63 static void SetHistoryServiceExpectations(ProfileMock* profile); |
63 | 64 |
64 void SetInitialSyncEndedForAllTypes(); | 65 void SetInitialSyncEndedForAllTypes(); |
65 | 66 |
66 void EmitOnNotificationsEnabled(); | 67 void EmitOnNotificationsEnabled(); |
67 void EmitOnNotificationsDisabled( | 68 void EmitOnNotificationsDisabled( |
68 syncer::NotificationsDisabledReason reason); | 69 syncer::NotificationsDisabledReason reason); |
69 void EmitOnIncomingNotification( | 70 void EmitOnIncomingNotification( |
70 const syncer::ObjectIdPayloadMap& id_payloads, | 71 const syncer::ObjectIdPayloadMap& id_payloads, |
(...skipping 27 matching lines...) Expand all Loading... |
98 ProfileSyncService::StartBehavior behavior, | 99 ProfileSyncService::StartBehavior behavior, |
99 bool synchronous_backend_initialization, | 100 bool synchronous_backend_initialization, |
100 const base::Closure& callback); | 101 const base::Closure& callback); |
101 | 102 |
102 virtual ~TestProfileSyncService(); | 103 virtual ~TestProfileSyncService(); |
103 | 104 |
104 virtual void OnBackendInitialized( | 105 virtual void OnBackendInitialized( |
105 const syncer::WeakHandle<syncer::JsBackend>& backend, | 106 const syncer::WeakHandle<syncer::JsBackend>& backend, |
106 bool success) OVERRIDE; | 107 bool success) OVERRIDE; |
107 | 108 |
108 virtual void Observe(int type, | 109 virtual void OnConfigureDone( |
109 const content::NotificationSource& source, | 110 const browser_sync::DataTypeManager::ConfigureResult& result) OVERRIDE; |
110 const content::NotificationDetails& details) OVERRIDE; | |
111 | 111 |
112 // We implement our own version to avoid some DCHECKs. | 112 // We implement our own version to avoid some DCHECKs. |
113 virtual syncer::UserShare* GetUserShare() const OVERRIDE; | 113 virtual syncer::UserShare* GetUserShare() const OVERRIDE; |
114 | 114 |
115 // If this is called, configuring data types will require a syncer | 115 // If this is called, configuring data types will require a syncer |
116 // nudge. | 116 // nudge. |
117 void dont_set_initial_sync_ended_on_init(); | 117 void dont_set_initial_sync_ended_on_init(); |
118 void set_synchronous_sync_configuration(); | 118 void set_synchronous_sync_configuration(); |
119 | 119 |
120 void fail_initial_download(); | 120 void fail_initial_download(); |
(...skipping 20 matching lines...) Expand all Loading... |
141 bool synchronous_sync_configuration_; | 141 bool synchronous_sync_configuration_; |
142 | 142 |
143 base::Closure callback_; | 143 base::Closure callback_; |
144 bool set_initial_sync_ended_on_init_; | 144 bool set_initial_sync_ended_on_init_; |
145 | 145 |
146 bool fail_initial_download_; | 146 bool fail_initial_download_; |
147 syncer::StorageOption storage_option_; | 147 syncer::StorageOption storage_option_; |
148 }; | 148 }; |
149 | 149 |
150 #endif // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ | 150 #endif // CHROME_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |