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 "components/sync_driver/non_blocking_data_type_controller.h" | 5 #include "components/sync_driver/non_blocking_data_type_controller.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/callback.h" | 10 #include "base/callback.h" |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
11 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
12 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
13 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
14 #include "base/sequenced_task_runner.h" | 16 #include "base/sequenced_task_runner.h" |
15 #include "base/test/test_simple_task_runner.h" | 17 #include "base/test/test_simple_task_runner.h" |
16 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 NOTREACHED() << "Not implemented."; | 141 NOTREACHED() << "Not implemented."; |
140 } | 142 } |
141 | 143 |
142 void ActivateNonBlockingDataType( | 144 void ActivateNonBlockingDataType( |
143 syncer::ModelType type, | 145 syncer::ModelType type, |
144 scoped_ptr<syncer_v2::ActivationContext> activation_context) override { | 146 scoped_ptr<syncer_v2::ActivationContext> activation_context) override { |
145 // Post on Sync thread just like the real implementation does. | 147 // Post on Sync thread just like the real implementation does. |
146 sync_task_runner_->PostTask( | 148 sync_task_runner_->PostTask( |
147 FROM_HERE, | 149 FROM_HERE, |
148 base::Bind(&MockSyncBackend::Connect, base::Unretained(backend_), type, | 150 base::Bind(&MockSyncBackend::Connect, base::Unretained(backend_), type, |
149 base::Passed(activation_context.Pass()))); | 151 base::Passed(std::move(activation_context)))); |
150 } | 152 } |
151 | 153 |
152 void DeactivateNonBlockingDataType(syncer::ModelType type) override { | 154 void DeactivateNonBlockingDataType(syncer::ModelType type) override { |
153 sync_task_runner_->PostTask(FROM_HERE, | 155 sync_task_runner_->PostTask(FROM_HERE, |
154 base::Bind(&MockSyncBackend::Disconnect, | 156 base::Bind(&MockSyncBackend::Disconnect, |
155 base::Unretained(backend_), type)); | 157 base::Unretained(backend_), type)); |
156 } | 158 } |
157 | 159 |
158 private: | 160 private: |
159 MockSyncBackend* backend_; | 161 MockSyncBackend* backend_; |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 StartAssociating(); | 410 StartAssociating(); |
409 ActivateDataType(); | 411 ActivateDataType(); |
410 TestTypeProcessor(true, true); // enabled, connected. | 412 TestTypeProcessor(true, true); // enabled, connected. |
411 | 413 |
412 DeactivateDataTypeAndStop(); | 414 DeactivateDataTypeAndStop(); |
413 EXPECT_EQ(sync_driver::DataTypeController::NOT_RUNNING, controller_->state()); | 415 EXPECT_EQ(sync_driver::DataTypeController::NOT_RUNNING, controller_->state()); |
414 TestTypeProcessor(true, false); // enabled, not connected. | 416 TestTypeProcessor(true, false); // enabled, not connected. |
415 } | 417 } |
416 | 418 |
417 } // namespace sync_driver_v2 | 419 } // namespace sync_driver_v2 |
OLD | NEW |