| 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/invalidations/invalidator_storage.h" |
| 12 #include "chrome/browser/sync/sync_prefs.h" | 12 #include "chrome/browser/sync/sync_prefs.h" |
| 13 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
| 14 #include "content/public/test/test_browser_thread.h" | 14 #include "content/public/test/test_browser_thread.h" |
| 15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 16 #include "net/url_request/test_url_fetcher_factory.h" | 16 #include "net/url_request/test_url_fetcher_factory.h" |
| 17 #include "sync/internal_api/public/base/model_type.h" | 17 #include "sync/internal_api/public/base/model_type.h" |
| 18 #include "sync/internal_api/public/engine/model_safe_worker.h" | 18 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| 19 #include "sync/internal_api/public/sync_manager_factory.h" |
| 19 #include "sync/internal_api/public/util/experiments.h" | 20 #include "sync/internal_api/public/util/experiments.h" |
| 20 #include "sync/protocol/encryption.pb.h" | 21 #include "sync/protocol/encryption.pb.h" |
| 21 #include "sync/protocol/sync_protocol_error.h" | 22 #include "sync/protocol/sync_protocol_error.h" |
| 22 #include "sync/util/test_unrecoverable_error_handler.h" | 23 #include "sync/util/test_unrecoverable_error_handler.h" |
| 23 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 25 | 26 |
| 26 using content::BrowserThread; | 27 using content::BrowserThread; |
| 27 | 28 |
| 28 namespace browser_sync { | 29 namespace browser_sync { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 InvalidatorStorage invalidator_storage(profile.GetPrefs()); | 99 InvalidatorStorage invalidator_storage(profile.GetPrefs()); |
| 99 SyncBackendHost backend(profile.GetDebugName(), | 100 SyncBackendHost backend(profile.GetDebugName(), |
| 100 &profile, sync_prefs.AsWeakPtr(), | 101 &profile, sync_prefs.AsWeakPtr(), |
| 101 invalidator_storage.AsWeakPtr()); | 102 invalidator_storage.AsWeakPtr()); |
| 102 | 103 |
| 103 MockSyncFrontend mock_frontend; | 104 MockSyncFrontend mock_frontend; |
| 104 syncer::SyncCredentials credentials; | 105 syncer::SyncCredentials credentials; |
| 105 credentials.email = "user@example.com"; | 106 credentials.email = "user@example.com"; |
| 106 credentials.sync_token = "sync_token"; | 107 credentials.sync_token = "sync_token"; |
| 107 syncer::TestUnrecoverableErrorHandler handler; | 108 syncer::TestUnrecoverableErrorHandler handler; |
| 109 syncer::SyncManagerFactory sync_manager_factory; |
| 108 backend.Initialize(&mock_frontend, | 110 backend.Initialize(&mock_frontend, |
| 109 syncer::WeakHandle<syncer::JsEventHandler>(), | 111 syncer::WeakHandle<syncer::JsEventHandler>(), |
| 110 GURL(k_mock_url), | 112 GURL(k_mock_url), |
| 111 syncer::ModelTypeSet(), | 113 syncer::ModelTypeSet(), |
| 112 credentials, | 114 credentials, |
| 113 true, | 115 true, |
| 116 &sync_manager_factory, |
| 114 &handler, | 117 &handler, |
| 115 NULL); | 118 NULL); |
| 116 backend.StopSyncingForShutdown(); | 119 backend.StopSyncingForShutdown(); |
| 117 backend.Shutdown(false); | 120 backend.Shutdown(false); |
| 118 } | 121 } |
| 119 | 122 |
| 120 // TODO(akalin): Write more SyncBackendHost unit tests. | 123 // TODO(akalin): Write more SyncBackendHost unit tests. |
| 121 | 124 |
| 122 } // namespace browser_sync | 125 } // namespace browser_sync |
| OLD | NEW |