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/ui_data_type_controller.h" | 5 #include "components/sync/driver/ui_data_type_controller.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/run_loop.h" |
12 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
13 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
14 #include "base/tracked_objects.h" | 15 #include "base/tracked_objects.h" |
15 #include "components/sync/api/fake_syncable_service.h" | 16 #include "components/sync/api/fake_syncable_service.h" |
16 #include "components/sync/base/model_type.h" | 17 #include "components/sync/base/model_type.h" |
17 #include "components/sync/driver/data_type_controller_mock.h" | 18 #include "components/sync/driver/data_type_controller_mock.h" |
18 #include "components/sync/driver/fake_generic_change_processor.h" | 19 #include "components/sync/driver/fake_generic_change_processor.h" |
19 #include "components/sync/driver/fake_sync_client.h" | 20 #include "components/sync/driver/fake_sync_client.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
21 | 22 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 69 } |
69 | 70 |
70 void Start() { | 71 void Start() { |
71 preference_dtc_->LoadModels(base::Bind( | 72 preference_dtc_->LoadModels(base::Bind( |
72 &ModelLoadCallbackMock::Run, base::Unretained(&model_load_callback_))); | 73 &ModelLoadCallbackMock::Run, base::Unretained(&model_load_callback_))); |
73 preference_dtc_->StartAssociating(base::Bind( | 74 preference_dtc_->StartAssociating(base::Bind( |
74 &StartCallbackMock::Run, base::Unretained(&start_callback_))); | 75 &StartCallbackMock::Run, base::Unretained(&start_callback_))); |
75 PumpLoop(); | 76 PumpLoop(); |
76 } | 77 } |
77 | 78 |
78 void PumpLoop() { message_loop_.RunUntilIdle(); } | 79 void PumpLoop() { base::RunLoop().RunUntilIdle(); } |
79 | 80 |
80 base::MessageLoopForUI message_loop_; | 81 base::MessageLoopForUI message_loop_; |
81 const syncer::ModelType type_; | 82 const syncer::ModelType type_; |
82 StartCallbackMock start_callback_; | 83 StartCallbackMock start_callback_; |
83 ModelLoadCallbackMock model_load_callback_; | 84 ModelLoadCallbackMock model_load_callback_; |
84 scoped_refptr<UIDataTypeController> preference_dtc_; | 85 scoped_refptr<UIDataTypeController> preference_dtc_; |
85 FakeGenericChangeProcessor* change_processor_; | 86 FakeGenericChangeProcessor* change_processor_; |
86 syncer::FakeSyncableService syncable_service_; | 87 syncer::FakeSyncableService syncable_service_; |
87 }; | 88 }; |
88 | 89 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 190 |
190 testing::Mock::VerifyAndClearExpectations(&start_callback_); | 191 testing::Mock::VerifyAndClearExpectations(&start_callback_); |
191 EXPECT_CALL(model_load_callback_, Run(_, _)); | 192 EXPECT_CALL(model_load_callback_, Run(_, _)); |
192 syncer::SyncError error(FROM_HERE, syncer::SyncError::DATATYPE_ERROR, "error", | 193 syncer::SyncError error(FROM_HERE, syncer::SyncError::DATATYPE_ERROR, "error", |
193 syncer::PREFERENCES); | 194 syncer::PREFERENCES); |
194 preference_dtc_->OnSingleDataTypeUnrecoverableError(error); | 195 preference_dtc_->OnSingleDataTypeUnrecoverableError(error); |
195 } | 196 } |
196 | 197 |
197 } // namespace | 198 } // namespace |
198 } // namespace sync_driver | 199 } // namespace sync_driver |
OLD | NEW |