| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/sync/driver/glue/sync_backend_registrar.h" | 5 #include "components/sync/driver/glue/sync_backend_registrar.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/threading/thread.h" |
| 13 #include "components/sync/driver/change_processor_mock.h" | 14 #include "components/sync/driver/change_processor_mock.h" |
| 14 #include "components/sync/driver/fake_sync_client.h" | 15 #include "components/sync/driver/fake_sync_client.h" |
| 15 #include "components/sync/driver/glue/browser_thread_model_worker.h" | 16 #include "components/sync/driver/glue/browser_thread_model_worker.h" |
| 16 #include "components/sync/driver/sync_api_component_factory_mock.h" | 17 #include "components/sync/driver/sync_api_component_factory_mock.h" |
| 17 #include "components/sync/engine/passive_model_worker.h" | 18 #include "components/sync/engine/passive_model_worker.h" |
| 18 #include "components/sync/syncable/test_user_share.h" | 19 #include "components/sync/syncable/test_user_share.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 22 |
| 22 namespace syncer { | 23 namespace syncer { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 87 |
| 87 ~SyncBackendRegistrarTest() override {} | 88 ~SyncBackendRegistrarTest() override {} |
| 88 | 89 |
| 89 void SetUp() override { | 90 void SetUp() override { |
| 90 db_thread_.StartAndWaitForTesting(); | 91 db_thread_.StartAndWaitForTesting(); |
| 91 file_thread_.StartAndWaitForTesting(); | 92 file_thread_.StartAndWaitForTesting(); |
| 92 sync_thread_.StartAndWaitForTesting(); | 93 sync_thread_.StartAndWaitForTesting(); |
| 93 test_user_share_.SetUp(); | 94 test_user_share_.SetUp(); |
| 94 sync_client_ = base::MakeUnique<RegistrarSyncClient>( | 95 sync_client_ = base::MakeUnique<RegistrarSyncClient>( |
| 95 ui_task_runner(), db_task_runner(), file_task_runner()); | 96 ui_task_runner(), db_task_runner(), file_task_runner()); |
| 96 registrar_ = base::MakeUnique<SyncBackendRegistrar>( | 97 registrar_ = |
| 97 "test", sync_client_.get(), ui_task_runner(), db_task_runner(), | 98 base::MakeUnique<SyncBackendRegistrar>("test", sync_client_.get()); |
| 98 file_task_runner()); | |
| 99 } | 99 } |
| 100 | 100 |
| 101 void TearDown() override { | 101 void TearDown() override { |
| 102 registrar_->RequestWorkerStopOnUIThread(); | 102 registrar_->RequestWorkerStopOnUIThread(); |
| 103 test_user_share_.TearDown(); | 103 test_user_share_.TearDown(); |
| 104 sync_thread_.task_runner()->DeleteSoon(FROM_HERE, registrar_.release()); | 104 sync_thread_.task_runner()->DeleteSoon(FROM_HERE, registrar_.release()); |
| 105 sync_thread_.FlushForTesting(); | 105 sync_thread_.FlushForTesting(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void ExpectRoutingInfo(SyncBackendRegistrar* registrar, | 108 void ExpectRoutingInfo(SyncBackendRegistrar* registrar, |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 registrar_->ConfigureDataTypes(types_to_add, ModelTypeSet()); | 297 registrar_->ConfigureDataTypes(types_to_add, ModelTypeSet()); |
| 298 EXPECT_EQ(ModelTypeSet(BOOKMARKS), newly_added_types); | 298 EXPECT_EQ(ModelTypeSet(BOOKMARKS), newly_added_types); |
| 299 EXPECT_EQ(types_to_add, registrar_->GetLastConfiguredTypes()); | 299 EXPECT_EQ(types_to_add, registrar_->GetLastConfiguredTypes()); |
| 300 ExpectRoutingInfo(registrar_.get(), {{AUTOFILL, GROUP_NON_BLOCKING}, | 300 ExpectRoutingInfo(registrar_.get(), {{AUTOFILL, GROUP_NON_BLOCKING}, |
| 301 {BOOKMARKS, GROUP_NON_BLOCKING}}); | 301 {BOOKMARKS, GROUP_NON_BLOCKING}}); |
| 302 } | 302 } |
| 303 | 303 |
| 304 } // namespace | 304 } // namespace |
| 305 | 305 |
| 306 } // namespace syncer | 306 } // namespace syncer |
| OLD | NEW |