| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 TEST_F(SyncBackendHostTest, InitShutdown) { | 78 TEST_F(SyncBackendHostTest, InitShutdown) { |
| 79 std::string k_mock_url = "http://www.example.com"; | 79 std::string k_mock_url = "http://www.example.com"; |
| 80 FakeURLFetcherFactory test_factory_; | 80 FakeURLFetcherFactory test_factory_; |
| 81 test_factory_.SetFakeResponse(k_mock_url + "/time?command=get_time", "", | 81 test_factory_.SetFakeResponse(k_mock_url + "/time?command=get_time", "", |
| 82 false); | 82 false); |
| 83 | 83 |
| 84 TestingProfile profile; | 84 TestingProfile profile; |
| 85 profile.CreateRequestContext(); | 85 profile.CreateRequestContext(); |
| 86 | 86 |
| 87 SyncBackendHost backend(&profile); | 87 SyncBackendHost backend(profile.GetDebugName(), &profile); |
| 88 | 88 |
| 89 // TODO(akalin): Handle this in SyncBackendHost instead of in | 89 // TODO(akalin): Handle this in SyncBackendHost instead of in |
| 90 // ProfileSyncService, or maybe figure out a way to share the | 90 // ProfileSyncService, or maybe figure out a way to share the |
| 91 // "register sync prefs" code. | 91 // "register sync prefs" code. |
| 92 PrefService* pref_service = profile.GetPrefs(); | 92 PrefService* pref_service = profile.GetPrefs(); |
| 93 pref_service->RegisterStringPref(prefs::kEncryptionBootstrapToken, ""); | 93 pref_service->RegisterStringPref(prefs::kEncryptionBootstrapToken, ""); |
| 94 pref_service->RegisterBooleanPref(prefs::kSyncHasSetupCompleted, | 94 pref_service->RegisterBooleanPref(prefs::kSyncHasSetupCompleted, |
| 95 false, | 95 false, |
| 96 PrefService::UNSYNCABLE_PREF); | 96 PrefService::UNSYNCABLE_PREF); |
| 97 | 97 |
| 98 MockSyncFrontend mock_frontend; | 98 MockSyncFrontend mock_frontend; |
| 99 sync_api::SyncCredentials credentials; | 99 sync_api::SyncCredentials credentials; |
| 100 credentials.email = "user@example.com"; | 100 credentials.email = "user@example.com"; |
| 101 credentials.sync_token = "sync_token"; | 101 credentials.sync_token = "sync_token"; |
| 102 backend.Initialize(&mock_frontend, | 102 backend.Initialize(&mock_frontend, |
| 103 WeakHandle<JsEventHandler>(), | 103 WeakHandle<JsEventHandler>(), |
| 104 GURL(k_mock_url), | 104 GURL(k_mock_url), |
| 105 syncable::ModelTypeSet(), | 105 syncable::ModelTypeSet(), |
| 106 credentials, | 106 credentials, |
| 107 true); | 107 true); |
| 108 backend.Shutdown(false); | 108 backend.Shutdown(false); |
| 109 } | 109 } |
| 110 | 110 |
| 111 // TODO(akalin): Write more SyncBackendHost unit tests. | 111 // TODO(akalin): Write more SyncBackendHost unit tests. |
| 112 | 112 |
| 113 } // namespace browser_sync | 113 } // namespace browser_sync |
| OLD | NEW |