OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/callback.h" | 5 #include "base/callback.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "chrome/browser/sync/glue/fake_data_type_controller.h" | 7 #include "chrome/browser/sync/glue/fake_data_type_controller.h" |
8 #include "chrome/browser/sync/glue/model_association_manager.h" | 8 #include "chrome/browser/sync/glue/model_association_manager.h" |
9 #include "content/public/test/test_browser_thread.h" | 9 #include "content/public/test/test_browser_thread.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // Make a type fail model association and verify correctness. | 164 // Make a type fail model association and verify correctness. |
165 TEST_F(SyncModelAssociationManagerTest, TypeFailModelAssociation) { | 165 TEST_F(SyncModelAssociationManagerTest, TypeFailModelAssociation) { |
166 controllers_[syncer::BOOKMARKS] = | 166 controllers_[syncer::BOOKMARKS] = |
167 new FakeDataTypeController(syncer::BOOKMARKS); | 167 new FakeDataTypeController(syncer::BOOKMARKS); |
168 ModelAssociationManager model_association_manager( | 168 ModelAssociationManager model_association_manager( |
169 &controllers_, | 169 &controllers_, |
170 &result_processor_); | 170 &result_processor_); |
171 syncer::ModelTypeSet types; | 171 syncer::ModelTypeSet types; |
172 types.Put(syncer::BOOKMARKS); | 172 types.Put(syncer::BOOKMARKS); |
173 std::map<syncer::ModelType, syncer::SyncError> errors; | 173 std::map<syncer::ModelType, syncer::SyncError> errors; |
174 syncer::SyncError error(FROM_HERE, "Failed", syncer::BOOKMARKS); | 174 syncer::SyncError error(FROM_HERE, |
| 175 syncer::SyncError::DATATYPE_ERROR, |
| 176 "Failed", |
| 177 syncer::BOOKMARKS); |
175 errors[syncer::BOOKMARKS] = error; | 178 errors[syncer::BOOKMARKS] = error; |
176 DataTypeManager::ConfigureResult expected_result( | 179 DataTypeManager::ConfigureResult expected_result( |
177 DataTypeManager::PARTIAL_SUCCESS, | 180 DataTypeManager::PARTIAL_SUCCESS, |
178 types, | 181 types, |
179 errors, | 182 errors, |
180 syncer::ModelTypeSet(), | 183 syncer::ModelTypeSet(), |
181 syncer::ModelTypeSet()); | 184 syncer::ModelTypeSet()); |
182 EXPECT_CALL(result_processor_, OnModelAssociationDone(_)). | 185 EXPECT_CALL(result_processor_, OnModelAssociationDone(_)). |
183 WillOnce(VerifyResult(expected_result)); | 186 WillOnce(VerifyResult(expected_result)); |
184 | 187 |
(...skipping 10 matching lines...) Expand all Loading... |
195 // Ensure configuring stops when a type returns a unrecoverable error. | 198 // Ensure configuring stops when a type returns a unrecoverable error. |
196 TEST_F(SyncModelAssociationManagerTest, TypeReturnUnrecoverableError) { | 199 TEST_F(SyncModelAssociationManagerTest, TypeReturnUnrecoverableError) { |
197 controllers_[syncer::BOOKMARKS] = | 200 controllers_[syncer::BOOKMARKS] = |
198 new FakeDataTypeController(syncer::BOOKMARKS); | 201 new FakeDataTypeController(syncer::BOOKMARKS); |
199 ModelAssociationManager model_association_manager( | 202 ModelAssociationManager model_association_manager( |
200 &controllers_, | 203 &controllers_, |
201 &result_processor_); | 204 &result_processor_); |
202 syncer::ModelTypeSet types; | 205 syncer::ModelTypeSet types; |
203 types.Put(syncer::BOOKMARKS); | 206 types.Put(syncer::BOOKMARKS); |
204 std::map<syncer::ModelType, syncer::SyncError> errors; | 207 std::map<syncer::ModelType, syncer::SyncError> errors; |
205 syncer::SyncError error(FROM_HERE, "Failed", syncer::BOOKMARKS); | 208 syncer::SyncError error(FROM_HERE, |
| 209 syncer::SyncError::DATATYPE_ERROR, |
| 210 "Failed", |
| 211 syncer::BOOKMARKS); |
206 errors[syncer::BOOKMARKS] = error; | 212 errors[syncer::BOOKMARKS] = error; |
207 DataTypeManager::ConfigureResult expected_result( | 213 DataTypeManager::ConfigureResult expected_result( |
208 DataTypeManager::UNRECOVERABLE_ERROR, | 214 DataTypeManager::UNRECOVERABLE_ERROR, |
209 types, | 215 types, |
210 errors, | 216 errors, |
211 syncer::ModelTypeSet(), | 217 syncer::ModelTypeSet(), |
212 syncer::ModelTypeSet()); | 218 syncer::ModelTypeSet()); |
213 EXPECT_CALL(result_processor_, OnModelAssociationDone(_)). | 219 EXPECT_CALL(result_processor_, OnModelAssociationDone(_)). |
214 WillOnce(VerifyResult(expected_result)); | 220 WillOnce(VerifyResult(expected_result)); |
215 | 221 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 syncer::ModelTypeSet(syncer::APPS)); | 423 syncer::ModelTypeSet(syncer::APPS)); |
418 EXPECT_EQ(GetController(controllers_, syncer::APPS)->state(), | 424 EXPECT_EQ(GetController(controllers_, syncer::APPS)->state(), |
419 DataTypeController::ASSOCIATING); | 425 DataTypeController::ASSOCIATING); |
420 GetController(controllers_, syncer::APPS)->FinishStart( | 426 GetController(controllers_, syncer::APPS)->FinishStart( |
421 DataTypeController::OK); | 427 DataTypeController::OK); |
422 EXPECT_EQ(GetController(controllers_, syncer::APPS)->state(), | 428 EXPECT_EQ(GetController(controllers_, syncer::APPS)->state(), |
423 DataTypeController::RUNNING); | 429 DataTypeController::RUNNING); |
424 } | 430 } |
425 | 431 |
426 } // namespace browser_sync | 432 } // namespace browser_sync |
OLD | NEW |