| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/sync/glue/sync_backend_host.h" | 5 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 MOCK_METHOD2(OnBackendInitialized, void(const WeakHandle<JsBackend>&, bool)); | 35 MOCK_METHOD2(OnBackendInitialized, void(const WeakHandle<JsBackend>&, bool)); |
| 36 MOCK_METHOD0(OnSyncCycleCompleted, void()); | 36 MOCK_METHOD0(OnSyncCycleCompleted, void()); |
| 37 MOCK_METHOD0(OnAuthError, void()); | 37 MOCK_METHOD0(OnAuthError, void()); |
| 38 MOCK_METHOD0(OnStopSyncingPermanently, void()); | 38 MOCK_METHOD0(OnStopSyncingPermanently, void()); |
| 39 MOCK_METHOD0(OnClearServerDataSucceeded, void()); | 39 MOCK_METHOD0(OnClearServerDataSucceeded, void()); |
| 40 MOCK_METHOD0(OnClearServerDataFailed, void()); | 40 MOCK_METHOD0(OnClearServerDataFailed, void()); |
| 41 MOCK_METHOD1(OnPassphraseRequired, void(sync_api::PassphraseRequiredReason)); | 41 MOCK_METHOD1(OnPassphraseRequired, void(sync_api::PassphraseRequiredReason)); |
| 42 MOCK_METHOD0(OnPassphraseAccepted, void()); | 42 MOCK_METHOD0(OnPassphraseAccepted, void()); |
| 43 MOCK_METHOD1(OnEncryptionComplete, void(const syncable::ModelTypeSet&)); | 43 MOCK_METHOD1(OnEncryptionComplete, void(const syncable::ModelTypeSet&)); |
| 44 MOCK_METHOD1(OnMigrationNeededForTypes, void(const syncable::ModelTypeSet&)); | 44 MOCK_METHOD1(OnMigrationNeededForTypes, void(const syncable::ModelTypeSet&)); |
| 45 MOCK_CONST_METHOD1(GetRegisteredDataTypes, |
| 46 void(syncable::ModelTypeSet* types)); |
| 47 MOCK_CONST_METHOD1(GetPreferredDataTypes, |
| 48 void(syncable::ModelTypeSet* types)); |
| 49 MOCK_METHOD1(RegisterDataTypeController, |
| 50 void(browser_sync::DataTypeController* data_type_controller)); |
| 45 }; | 51 }; |
| 46 | 52 |
| 47 } // namespace | 53 } // namespace |
| 48 | 54 |
| 49 class SyncBackendHostTest : public TestingBrowserProcessTest { | 55 class SyncBackendHostTest : public TestingBrowserProcessTest { |
| 50 protected: | 56 protected: |
| 51 SyncBackendHostTest() | 57 SyncBackendHostTest() |
| 52 : ui_thread_(BrowserThread::UI, &ui_loop_), | 58 : ui_thread_(BrowserThread::UI, &ui_loop_), |
| 53 io_thread_(BrowserThread::IO) {} | 59 io_thread_(BrowserThread::IO) {} |
| 54 | 60 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 pref_service->RegisterStringPref(prefs::kEncryptionBootstrapToken, ""); | 99 pref_service->RegisterStringPref(prefs::kEncryptionBootstrapToken, ""); |
| 94 pref_service->RegisterBooleanPref(prefs::kSyncHasSetupCompleted, | 100 pref_service->RegisterBooleanPref(prefs::kSyncHasSetupCompleted, |
| 95 false, | 101 false, |
| 96 PrefService::UNSYNCABLE_PREF); | 102 PrefService::UNSYNCABLE_PREF); |
| 97 | 103 |
| 98 MockSyncFrontend mock_frontend; | 104 MockSyncFrontend mock_frontend; |
| 99 sync_api::SyncCredentials credentials; | 105 sync_api::SyncCredentials credentials; |
| 100 credentials.email = "user@example.com"; | 106 credentials.email = "user@example.com"; |
| 101 credentials.sync_token = "sync_token"; | 107 credentials.sync_token = "sync_token"; |
| 102 backend.Initialize(&mock_frontend, | 108 backend.Initialize(&mock_frontend, |
| 109 NULL, |
| 103 WeakHandle<JsEventHandler>(), | 110 WeakHandle<JsEventHandler>(), |
| 104 GURL(k_mock_url), | 111 GURL(k_mock_url), |
| 105 syncable::ModelTypeSet(), | 112 syncable::ModelTypeSet(), |
| 106 credentials, | 113 credentials, |
| 107 true); | 114 true); |
| 108 backend.Shutdown(false); | 115 backend.Shutdown(false); |
| 109 } | 116 } |
| 110 | 117 |
| 111 TEST_F(SyncBackendHostTest, GetPendingConfigModeState) { | 118 TEST_F(SyncBackendHostTest, GetPendingConfigModeState) { |
| 112 SyncBackendHost::PendingConfigureDataTypesState state; | 119 SyncBackendHost::PendingConfigureDataTypesState state; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 &routing_info, sync_api::CONFIGURE_REASON_RECONFIGURATION, | 203 &routing_info, sync_api::CONFIGURE_REASON_RECONFIGURATION, |
| 197 &state); | 204 &state); |
| 198 | 205 |
| 199 EXPECT_TRUE(routing_info.empty()); | 206 EXPECT_TRUE(routing_info.empty()); |
| 200 } | 207 } |
| 201 } | 208 } |
| 202 | 209 |
| 203 // TODO(akalin): Write more SyncBackendHost unit tests. | 210 // TODO(akalin): Write more SyncBackendHost unit tests. |
| 204 | 211 |
| 205 } // namespace browser_sync | 212 } // namespace browser_sync |
| OLD | NEW |