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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/tracked_objects.h" | 10 #include "base/tracked_objects.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 // test the basic functionality of all UIDataTypeControllers. We'll need to have | 26 // test the basic functionality of all UIDataTypeControllers. We'll need to have |
27 // intelligent default values for the methods queried in the dependent services | 27 // intelligent default values for the methods queried in the dependent services |
28 // (e.g. those queried in StartModels). | 28 // (e.g. those queried in StartModels). |
29 class SyncUIDataTypeControllerTest : public testing::Test, | 29 class SyncUIDataTypeControllerTest : public testing::Test, |
30 public SyncApiComponentFactory { | 30 public SyncApiComponentFactory { |
31 public: | 31 public: |
32 SyncUIDataTypeControllerTest() | 32 SyncUIDataTypeControllerTest() |
33 : type_(syncer::PREFERENCES), | 33 : type_(syncer::PREFERENCES), |
34 change_processor_(NULL) {} | 34 change_processor_(NULL) {} |
35 | 35 |
36 virtual void SetUp() { | 36 void SetUp() override { |
37 preference_dtc_ = | 37 preference_dtc_ = |
38 new UIDataTypeController( | 38 new UIDataTypeController( |
39 base::MessageLoopProxy::current(), | 39 base::MessageLoopProxy::current(), |
40 base::Closure(), | 40 base::Closure(), |
41 type_, | 41 type_, |
42 this); | 42 this); |
43 SetStartExpectations(); | 43 SetStartExpectations(); |
44 } | 44 } |
45 | 45 |
46 virtual void TearDown() { | 46 void TearDown() override { |
47 // Must be done before we pump the loop. | 47 // Must be done before we pump the loop. |
48 syncable_service_.StopSyncing(type_); | 48 syncable_service_.StopSyncing(type_); |
49 preference_dtc_ = NULL; | 49 preference_dtc_ = NULL; |
50 PumpLoop(); | 50 PumpLoop(); |
51 } | 51 } |
52 | 52 |
53 base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType( | 53 base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType( |
54 syncer::ModelType type) override { | 54 syncer::ModelType type) override { |
55 return syncable_service_.AsWeakPtr(); | 55 return syncable_service_.AsWeakPtr(); |
56 } | 56 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 EXPECT_CALL(model_load_callback_, Run(_, _)); | 191 EXPECT_CALL(model_load_callback_, Run(_, _)); |
192 syncer::SyncError error(FROM_HERE, | 192 syncer::SyncError error(FROM_HERE, |
193 syncer::SyncError::DATATYPE_ERROR, | 193 syncer::SyncError::DATATYPE_ERROR, |
194 "error", | 194 "error", |
195 syncer::PREFERENCES); | 195 syncer::PREFERENCES); |
196 preference_dtc_->OnSingleDataTypeUnrecoverableError(error); | 196 preference_dtc_->OnSingleDataTypeUnrecoverableError(error); |
197 } | 197 } |
198 | 198 |
199 } // namespace | 199 } // namespace |
200 } // namespace sync_driver | 200 } // namespace sync_driver |
OLD | NEW |