| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/sync/driver/glue/sync_backend_host_impl.h" | 5 #include "components/sync/driver/glue/sync_backend_host_impl.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 const base::TimeDelta&) {} | 68 const base::TimeDelta&) {} |
| 69 | 69 |
| 70 void QuitMessageLoop() { | 70 void QuitMessageLoop() { |
| 71 base::MessageLoop::current()->QuitWhenIdle(); | 71 base::MessageLoop::current()->QuitWhenIdle(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 class MockSyncEngineHost : public SyncEngineHost { | 74 class MockSyncEngineHost : public SyncEngineHost { |
| 75 public: | 75 public: |
| 76 virtual ~MockSyncEngineHost() {} | 76 virtual ~MockSyncEngineHost() {} |
| 77 | 77 |
| 78 MOCK_METHOD4(OnBackendInitialized, | 78 MOCK_METHOD4(OnEngineInitialized, |
| 79 void(const WeakHandle<JsBackend>&, | 79 void(const WeakHandle<JsBackend>&, |
| 80 const WeakHandle<DataTypeDebugInfoListener>&, | 80 const WeakHandle<DataTypeDebugInfoListener>&, |
| 81 const std::string&, | 81 const std::string&, |
| 82 bool)); | 82 bool)); |
| 83 MOCK_METHOD0(OnSyncCycleCompleted, void()); | 83 MOCK_METHOD0(OnSyncCycleCompleted, void()); |
| 84 MOCK_METHOD1(OnConnectionStatusChange, void(ConnectionStatus status)); | 84 MOCK_METHOD1(OnConnectionStatusChange, void(ConnectionStatus status)); |
| 85 MOCK_METHOD0(OnClearServerDataSucceeded, void()); | 85 MOCK_METHOD0(OnClearServerDataSucceeded, void()); |
| 86 MOCK_METHOD0(OnClearServerDataFailed, void()); | 86 MOCK_METHOD0(OnClearServerDataFailed, void()); |
| 87 MOCK_METHOD2(OnPassphraseRequired, | 87 MOCK_METHOD2(OnPassphraseRequired, |
| 88 void(PassphraseRequiredReason, const sync_pb::EncryptedData&)); | 88 void(PassphraseRequiredReason, const sync_pb::EncryptedData&)); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 backend_->Shutdown(STOP_SYNC); | 198 backend_->Shutdown(STOP_SYNC); |
| 199 } | 199 } |
| 200 backend_.reset(); | 200 backend_.reset(); |
| 201 sync_prefs_.reset(); | 201 sync_prefs_.reset(); |
| 202 // Pump messages posted by the sync thread. | 202 // Pump messages posted by the sync thread. |
| 203 base::RunLoop().RunUntilIdle(); | 203 base::RunLoop().RunUntilIdle(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 // Synchronously initializes the backend. | 206 // Synchronously initializes the backend. |
| 207 void InitializeBackend(bool expect_success) { | 207 void InitializeBackend(bool expect_success) { |
| 208 EXPECT_CALL(mock_host_, OnBackendInitialized(_, _, _, expect_success)) | 208 EXPECT_CALL(mock_host_, OnEngineInitialized(_, _, _, expect_success)) |
| 209 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); | 209 .WillOnce(InvokeWithoutArgs(QuitMessageLoop)); |
| 210 SyncEngine::HttpPostProviderFactoryGetter | 210 SyncEngine::HttpPostProviderFactoryGetter |
| 211 http_post_provider_factory_getter = | 211 http_post_provider_factory_getter = |
| 212 base::Bind(&NetworkResources::GetHttpPostProviderFactory, | 212 base::Bind(&NetworkResources::GetHttpPostProviderFactory, |
| 213 base::Unretained(network_resources_.get()), nullptr, | 213 base::Unretained(network_resources_.get()), nullptr, |
| 214 base::Bind(&EmptyNetworkTimeUpdate)); | 214 base::Bind(&EmptyNetworkTimeUpdate)); |
| 215 backend_->Initialize( | 215 backend_->Initialize( |
| 216 &mock_host_, sync_thread_.task_runner(), WeakHandle<JsEventHandler>(), | 216 &mock_host_, sync_thread_.task_runner(), WeakHandle<JsEventHandler>(), |
| 217 GURL(std::string()), std::string(), credentials_, true, false, | 217 GURL(std::string()), std::string(), credentials_, true, false, |
| 218 base::FilePath(), std::move(fake_manager_factory_), | 218 base::FilePath(), std::move(fake_manager_factory_), |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 backend_->StopSyncingForShutdown(); | 820 backend_->StopSyncingForShutdown(); |
| 821 // Verify that call to DeactivateNonBlockingDataType doesn't assert. | 821 // Verify that call to DeactivateNonBlockingDataType doesn't assert. |
| 822 backend_->DeactivateNonBlockingDataType(AUTOFILL); | 822 backend_->DeactivateNonBlockingDataType(AUTOFILL); |
| 823 backend_->Shutdown(STOP_SYNC); | 823 backend_->Shutdown(STOP_SYNC); |
| 824 backend_.reset(); | 824 backend_.reset(); |
| 825 } | 825 } |
| 826 | 826 |
| 827 } // namespace | 827 } // namespace |
| 828 | 828 |
| 829 } // namespace syncer | 829 } // namespace syncer |
| OLD | NEW |