| 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" | 6 #include "base/message_loop/message_loop_proxy.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/sequenced_task_runner.h" | 8 #include "base/sequenced_task_runner.h" |
| 9 #include "sync/internal_api/public/base/model_type.h" | 9 #include "sync/internal_api/public/base/model_type.h" |
| 10 #include "sync/internal_api/public/non_blocking_type_processor.h" | 10 #include "sync/internal_api/public/non_blocking_type_processor.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 core_proxy_( | 24 core_proxy_( |
| 25 sync_task_runner_, | 25 sync_task_runner_, |
| 26 core_->AsWeakPtr()) {} | 26 core_->AsWeakPtr()) {} |
| 27 | 27 |
| 28 // The sync thread could be shut down at any time without warning. This | 28 // The sync thread could be shut down at any time without warning. This |
| 29 // function simulates such an event. | 29 // function simulates such an event. |
| 30 void DisableSync() { | 30 void DisableSync() { |
| 31 core_.reset(); | 31 core_.reset(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 SyncCoreProxy* GetProxy() { | 34 scoped_ptr<SyncCoreProxy> GetProxy() { return core_proxy_.Clone(); } |
| 35 return &core_proxy_; | |
| 36 } | |
| 37 | 35 |
| 38 private: | 36 private: |
| 39 base::MessageLoop loop_; | 37 base::MessageLoop loop_; |
| 40 scoped_refptr<base::SequencedTaskRunner> sync_task_runner_; | 38 scoped_refptr<base::SequencedTaskRunner> sync_task_runner_; |
| 41 scoped_refptr<base::SequencedTaskRunner> type_task_runner_; | 39 scoped_refptr<base::SequencedTaskRunner> type_task_runner_; |
| 42 ModelTypeRegistry registry_; | 40 ModelTypeRegistry registry_; |
| 43 scoped_ptr<SyncCore> core_; | 41 scoped_ptr<SyncCore> core_; |
| 44 SyncCoreProxyImpl core_proxy_; | 42 SyncCoreProxyImpl core_proxy_; |
| 45 }; | 43 }; |
| 46 | 44 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 themes_processor->Enable(GetProxy()); | 84 themes_processor->Enable(GetProxy()); |
| 87 | 85 |
| 88 base::RunLoop run_loop_; | 86 base::RunLoop run_loop_; |
| 89 run_loop_.RunUntilIdle(); | 87 run_loop_.RunUntilIdle(); |
| 90 | 88 |
| 91 EXPECT_TRUE(themes_processor->IsConnected()); | 89 EXPECT_TRUE(themes_processor->IsConnected()); |
| 92 DisableSync(); | 90 DisableSync(); |
| 93 } | 91 } |
| 94 | 92 |
| 95 } // namespace syncer | 93 } // namespace syncer |
| OLD | NEW |