| 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 "sync/internal_api/sync_context_proxy_impl.h" | 5 #include "sync/internal_api/sync_context_proxy_impl.h" |
| 6 | 6 |
| 7 #include <utility> |
| 7 #include <vector> | 8 #include <vector> |
| 8 | 9 |
| 9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 11 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 12 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
| 13 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
| 14 #include "sync/internal_api/public/activation_context.h" | 15 #include "sync/internal_api/public/activation_context.h" |
| 15 #include "sync/internal_api/public/base/model_type.h" | 16 #include "sync/internal_api/public/base/model_type.h" |
| 16 #include "sync/internal_api/public/shared_model_type_processor.h" | 17 #include "sync/internal_api/public/shared_model_type_processor.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 47 // function simulates such an event. | 48 // function simulates such an event. |
| 48 void DisableSync() { registry_.reset(); } | 49 void DisableSync() { registry_.reset(); } |
| 49 | 50 |
| 50 void Start(SharedModelTypeProcessor* processor) { | 51 void Start(SharedModelTypeProcessor* processor) { |
| 51 processor->Start(base::Bind(&SyncContextProxyImplTest::StartDone, | 52 processor->Start(base::Bind(&SyncContextProxyImplTest::StartDone, |
| 52 base::Unretained(this))); | 53 base::Unretained(this))); |
| 53 } | 54 } |
| 54 | 55 |
| 55 void StartDone(syncer::SyncError error, | 56 void StartDone(syncer::SyncError error, |
| 56 scoped_ptr<ActivationContext> context) { | 57 scoped_ptr<ActivationContext> context) { |
| 57 context_proxy_->ConnectTypeToSync(syncer::THEMES, context.Pass()); | 58 context_proxy_->ConnectTypeToSync(syncer::THEMES, std::move(context)); |
| 58 } | 59 } |
| 59 | 60 |
| 60 scoped_ptr<SharedModelTypeProcessor> CreateModelTypeProcessor() { | 61 scoped_ptr<SharedModelTypeProcessor> CreateModelTypeProcessor() { |
| 61 return make_scoped_ptr(new SharedModelTypeProcessor(syncer::THEMES, this)); | 62 return make_scoped_ptr(new SharedModelTypeProcessor(syncer::THEMES, this)); |
| 62 } | 63 } |
| 63 | 64 |
| 64 private: | 65 private: |
| 65 base::MessageLoop loop_; | 66 base::MessageLoop loop_; |
| 66 scoped_refptr<base::SingleThreadTaskRunner> sync_task_runner_; | 67 scoped_refptr<base::SingleThreadTaskRunner> sync_task_runner_; |
| 67 scoped_refptr<base::SingleThreadTaskRunner> type_task_runner_; | 68 scoped_refptr<base::SingleThreadTaskRunner> type_task_runner_; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 Start(processor.get()); | 115 Start(processor.get()); |
| 115 | 116 |
| 116 base::RunLoop run_loop_; | 117 base::RunLoop run_loop_; |
| 117 run_loop_.RunUntilIdle(); | 118 run_loop_.RunUntilIdle(); |
| 118 | 119 |
| 119 EXPECT_TRUE(processor->IsConnected()); | 120 EXPECT_TRUE(processor->IsConnected()); |
| 120 DisableSync(); | 121 DisableSync(); |
| 121 } | 122 } |
| 122 | 123 |
| 123 } // namespace syncer_v2 | 124 } // namespace syncer_v2 |
| OLD | NEW |