OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "base/message_loop/message_loop_proxy.h" | |
7 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
8 #include "base/sequenced_task_runner.h" | 7 #include "base/sequenced_task_runner.h" |
| 8 #include "base/thread_task_runner_handle.h" |
9 #include "sync/engine/model_type_sync_proxy_impl.h" | 9 #include "sync/engine/model_type_sync_proxy_impl.h" |
10 #include "sync/internal_api/public/base/model_type.h" | 10 #include "sync/internal_api/public/base/model_type.h" |
11 #include "sync/internal_api/public/sync_context.h" | 11 #include "sync/internal_api/public/sync_context.h" |
12 #include "sync/internal_api/sync_context_proxy_impl.h" | 12 #include "sync/internal_api/sync_context_proxy_impl.h" |
13 #include "sync/sessions/model_type_registry.h" | 13 #include "sync/sessions/model_type_registry.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 namespace syncer { | 16 namespace syncer { |
17 | 17 |
18 class SyncContextProxyImplTest : public ::testing::Test { | 18 class SyncContextProxyImplTest : public ::testing::Test { |
19 public: | 19 public: |
20 SyncContextProxyImplTest() | 20 SyncContextProxyImplTest() |
21 : sync_task_runner_(base::MessageLoopProxy::current()), | 21 : sync_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
22 type_task_runner_(base::MessageLoopProxy::current()), | 22 type_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
23 registry_(new ModelTypeRegistry()), | 23 registry_(new ModelTypeRegistry()), |
24 context_proxy_(sync_task_runner_, registry_->AsWeakPtr()) {} | 24 context_proxy_(sync_task_runner_, registry_->AsWeakPtr()) {} |
25 | 25 |
26 // The sync thread could be shut down at any time without warning. This | 26 // The sync thread could be shut down at any time without warning. This |
27 // function simulates such an event. | 27 // function simulates such an event. |
28 void DisableSync() { registry_.reset(); } | 28 void DisableSync() { registry_.reset(); } |
29 | 29 |
30 scoped_ptr<SyncContextProxy> GetProxy() { return context_proxy_.Clone(); } | 30 scoped_ptr<SyncContextProxy> GetProxy() { return context_proxy_.Clone(); } |
31 | 31 |
32 private: | 32 private: |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 themes_sync_proxy->Enable(GetProxy()); | 79 themes_sync_proxy->Enable(GetProxy()); |
80 | 80 |
81 base::RunLoop run_loop_; | 81 base::RunLoop run_loop_; |
82 run_loop_.RunUntilIdle(); | 82 run_loop_.RunUntilIdle(); |
83 | 83 |
84 EXPECT_TRUE(themes_sync_proxy->IsConnected()); | 84 EXPECT_TRUE(themes_sync_proxy->IsConnected()); |
85 DisableSync(); | 85 DisableSync(); |
86 } | 86 } |
87 | 87 |
88 } // namespace syncer | 88 } // namespace syncer |
OLD | NEW |