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/data_type_manager_impl.h" | 5 #include "components/sync_driver/data_type_manager_impl.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "components/sync_driver/backend_data_type_configurer.h" | 9 #include "components/sync_driver/backend_data_type_configurer.h" |
10 #include "components/sync_driver/data_type_controller.h" | 10 #include "components/sync_driver/data_type_controller.h" |
11 #include "components/sync_driver/data_type_encryption_handler.h" | 11 #include "components/sync_driver/data_type_encryption_handler.h" |
12 #include "components/sync_driver/data_type_manager_observer.h" | 12 #include "components/sync_driver/data_type_manager_observer.h" |
13 #include "components/sync_driver/failed_data_types_handler.h" | 13 #include "components/sync_driver/failed_data_types_handler.h" |
14 #include "components/sync_driver/fake_data_type_controller.h" | 14 #include "components/sync_driver/fake_data_type_controller.h" |
15 #include "sync/internal_api/public/base/model_type.h" | 15 #include "sync/internal_api/public/base/model_type.h" |
16 #include "sync/internal_api/public/configure_reason.h" | 16 #include "sync/internal_api/public/configure_reason.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 | 19 |
20 namespace browser_sync { | 20 namespace sync_driver { |
21 | 21 |
22 using syncer::ModelType; | 22 using syncer::ModelType; |
23 using syncer::ModelTypeSet; | 23 using syncer::ModelTypeSet; |
24 using syncer::ModelTypeToString; | 24 using syncer::ModelTypeToString; |
25 using syncer::BOOKMARKS; | 25 using syncer::BOOKMARKS; |
26 using syncer::APPS; | 26 using syncer::APPS; |
27 using syncer::PASSWORDS; | 27 using syncer::PASSWORDS; |
28 using syncer::PREFERENCES; | 28 using syncer::PREFERENCES; |
29 using syncer::NIGORI; | 29 using syncer::NIGORI; |
30 using testing::_; | 30 using testing::_; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 syncer::ModelTypeSet activated_types_; | 97 syncer::ModelTypeSet activated_types_; |
98 }; | 98 }; |
99 | 99 |
100 // Mock DataTypeManagerObserver implementation. | 100 // Mock DataTypeManagerObserver implementation. |
101 class DataTypeManagerObserverMock : public DataTypeManagerObserver { | 101 class DataTypeManagerObserverMock : public DataTypeManagerObserver { |
102 public: | 102 public: |
103 DataTypeManagerObserverMock() {} | 103 DataTypeManagerObserverMock() {} |
104 virtual ~DataTypeManagerObserverMock() {} | 104 virtual ~DataTypeManagerObserverMock() {} |
105 | 105 |
106 MOCK_METHOD1(OnConfigureDone, | 106 MOCK_METHOD1(OnConfigureDone, |
107 void(const browser_sync::DataTypeManager::ConfigureResult&)); | 107 void(const DataTypeManager::ConfigureResult&)); |
108 MOCK_METHOD0(OnConfigureRetry, void()); | 108 MOCK_METHOD0(OnConfigureRetry, void()); |
109 MOCK_METHOD0(OnConfigureStart, void()); | 109 MOCK_METHOD0(OnConfigureStart, void()); |
110 }; | 110 }; |
111 | 111 |
112 class FakeDataTypeEncryptionHandler : public DataTypeEncryptionHandler { | 112 class FakeDataTypeEncryptionHandler : public DataTypeEncryptionHandler { |
113 public: | 113 public: |
114 FakeDataTypeEncryptionHandler(); | 114 FakeDataTypeEncryptionHandler(); |
115 virtual ~FakeDataTypeEncryptionHandler(); | 115 virtual ~FakeDataTypeEncryptionHandler(); |
116 | 116 |
117 virtual bool IsPassphraseRequired() const OVERRIDE; | 117 virtual bool IsPassphraseRequired() const OVERRIDE; |
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 EXPECT_EQ(DataTypeManager::DOWNLOAD_PENDING, dtm_->state()); | 1189 EXPECT_EQ(DataTypeManager::DOWNLOAD_PENDING, dtm_->state()); |
1190 FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet()); | 1190 FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet()); |
1191 FinishDownload(*dtm_, ModelTypeSet(BOOKMARKS), ModelTypeSet()); | 1191 FinishDownload(*dtm_, ModelTypeSet(BOOKMARKS), ModelTypeSet()); |
1192 EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state()); | 1192 EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state()); |
1193 GetController(BOOKMARKS)->FinishStart(DataTypeController::OK); | 1193 GetController(BOOKMARKS)->FinishStart(DataTypeController::OK); |
1194 EXPECT_EQ(DataTypeManager::CONFIGURED, dtm_->state()); | 1194 EXPECT_EQ(DataTypeManager::CONFIGURED, dtm_->state()); |
1195 EXPECT_EQ(DataTypeController::RUNNING, GetController(PREFERENCES)->state()); | 1195 EXPECT_EQ(DataTypeController::RUNNING, GetController(PREFERENCES)->state()); |
1196 EXPECT_EQ(DataTypeController::RUNNING, GetController(BOOKMARKS)->state()); | 1196 EXPECT_EQ(DataTypeController::RUNNING, GetController(BOOKMARKS)->state()); |
1197 } | 1197 } |
1198 | 1198 |
1199 } // namespace browser_sync | 1199 } // namespace sync_driver |
OLD | NEW |