| 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/model_association_manager.h" | 5 #include "components/sync/driver/model_association_manager.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 void(ModelType, const SyncError& error)); | 29 void(ModelType, const SyncError& error)); |
| 30 MOCK_METHOD1(OnModelAssociationDone, | 30 MOCK_METHOD1(OnModelAssociationDone, |
| 31 void(const DataTypeManager::ConfigureResult& result)); | 31 void(const DataTypeManager::ConfigureResult& result)); |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 FakeDataTypeController* GetController( | 34 FakeDataTypeController* GetController( |
| 35 const DataTypeController::TypeMap& controllers, | 35 const DataTypeController::TypeMap& controllers, |
| 36 ModelType model_type) { | 36 ModelType model_type) { |
| 37 DataTypeController::TypeMap::const_iterator it = controllers.find(model_type); | 37 DataTypeController::TypeMap::const_iterator it = controllers.find(model_type); |
| 38 if (it == controllers.end()) { | 38 if (it == controllers.end()) { |
| 39 return NULL; | 39 return nullptr; |
| 40 } | 40 } |
| 41 return static_cast<FakeDataTypeController*>(it->second.get()); | 41 return static_cast<FakeDataTypeController*>(it->second.get()); |
| 42 } | 42 } |
| 43 | 43 |
| 44 ACTION_P(VerifyResult, expected_result) { | 44 ACTION_P(VerifyResult, expected_result) { |
| 45 EXPECT_EQ(arg0.status, expected_result.status); | 45 EXPECT_EQ(arg0.status, expected_result.status); |
| 46 EXPECT_EQ(expected_result.requested_types, arg0.requested_types); | 46 EXPECT_EQ(expected_result.requested_types, arg0.requested_types); |
| 47 } | 47 } |
| 48 | 48 |
| 49 class SyncModelAssociationManagerTest : public testing::Test { | 49 class SyncModelAssociationManagerTest : public testing::Test { |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 | 463 |
| 464 EXPECT_CALL(delegate_, OnAllDataTypesReadyForConfigure()); | 464 EXPECT_CALL(delegate_, OnAllDataTypesReadyForConfigure()); |
| 465 // Finish loading BOOKMARKS. This should trigger | 465 // Finish loading BOOKMARKS. This should trigger |
| 466 // OnAllDataTypesReadyForConfigure(). | 466 // OnAllDataTypesReadyForConfigure(). |
| 467 GetController(controllers_, BOOKMARKS)->SimulateModelLoadFinishing(); | 467 GetController(controllers_, BOOKMARKS)->SimulateModelLoadFinishing(); |
| 468 EXPECT_EQ(GetController(controllers_, BOOKMARKS)->state(), | 468 EXPECT_EQ(GetController(controllers_, BOOKMARKS)->state(), |
| 469 DataTypeController::MODEL_LOADED); | 469 DataTypeController::MODEL_LOADED); |
| 470 } | 470 } |
| 471 | 471 |
| 472 } // namespace syncer | 472 } // namespace syncer |
| OLD | NEW |