| 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 #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" |
| 11 #include "chrome/browser/sync/invalidations/invalidator_storage.h" |
| 11 #include "chrome/browser/sync/sync_prefs.h" | 12 #include "chrome/browser/sync/sync_prefs.h" |
| 12 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
| 13 #include "content/test/test_browser_thread.h" | 14 #include "content/test/test_browser_thread.h" |
| 14 #include "content/test/test_url_fetcher_factory.h" | 15 #include "content/test/test_url_fetcher_factory.h" |
| 15 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 16 #include "sync/engine/model_safe_worker.h" | 17 #include "sync/engine/model_safe_worker.h" |
| 17 #include "sync/protocol/encryption.pb.h" | 18 #include "sync/protocol/encryption.pb.h" |
| 18 #include "sync/protocol/sync_protocol_error.h" | 19 #include "sync/protocol/sync_protocol_error.h" |
| 19 #include "sync/syncable/model_type.h" | 20 #include "sync/syncable/model_type.h" |
| 20 #include "sync/util/experiments.h" | 21 #include "sync/util/experiments.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 TEST_F(SyncBackendHostTest, InitShutdown) { | 87 TEST_F(SyncBackendHostTest, InitShutdown) { |
| 87 std::string k_mock_url = "http://www.example.com"; | 88 std::string k_mock_url = "http://www.example.com"; |
| 88 FakeURLFetcherFactory test_factory_; | 89 FakeURLFetcherFactory test_factory_; |
| 89 test_factory_.SetFakeResponse(k_mock_url + "/time?command=get_time", "", | 90 test_factory_.SetFakeResponse(k_mock_url + "/time?command=get_time", "", |
| 90 false); | 91 false); |
| 91 | 92 |
| 92 TestingProfile profile; | 93 TestingProfile profile; |
| 93 profile.CreateRequestContext(); | 94 profile.CreateRequestContext(); |
| 94 | 95 |
| 95 SyncPrefs sync_prefs(profile.GetPrefs()); | 96 SyncPrefs sync_prefs(profile.GetPrefs()); |
| 97 InvalidatorStorage invalidator_storage(profile.GetPrefs()); |
| 96 SyncBackendHost backend(profile.GetDebugName(), | 98 SyncBackendHost backend(profile.GetDebugName(), |
| 97 &profile, sync_prefs.AsWeakPtr()); | 99 &profile, sync_prefs.AsWeakPtr(), |
| 100 invalidator_storage.AsWeakPtr()); |
| 98 | 101 |
| 99 MockSyncFrontend mock_frontend; | 102 MockSyncFrontend mock_frontend; |
| 100 sync_api::SyncCredentials credentials; | 103 sync_api::SyncCredentials credentials; |
| 101 credentials.email = "user@example.com"; | 104 credentials.email = "user@example.com"; |
| 102 credentials.sync_token = "sync_token"; | 105 credentials.sync_token = "sync_token"; |
| 103 browser_sync::TestUnrecoverableErrorHandler handler; | 106 browser_sync::TestUnrecoverableErrorHandler handler; |
| 104 backend.Initialize(&mock_frontend, | 107 backend.Initialize(&mock_frontend, |
| 105 WeakHandle<JsEventHandler>(), | 108 WeakHandle<JsEventHandler>(), |
| 106 GURL(k_mock_url), | 109 GURL(k_mock_url), |
| 107 syncable::ModelTypeSet(), | 110 syncable::ModelTypeSet(), |
| 108 credentials, | 111 credentials, |
| 109 true, | 112 true, |
| 110 &handler, | 113 &handler, |
| 111 NULL); | 114 NULL); |
| 112 backend.StopSyncingForShutdown(); | 115 backend.StopSyncingForShutdown(); |
| 113 backend.Shutdown(false); | 116 backend.Shutdown(false); |
| 114 } | 117 } |
| 115 | 118 |
| 116 // TODO(akalin): Write more SyncBackendHost unit tests. | 119 // TODO(akalin): Write more SyncBackendHost unit tests. |
| 117 | 120 |
| 118 } // namespace browser_sync | 121 } // namespace browser_sync |
| OLD | NEW |