| 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 ProfileSyncComponentsFactory* profile_sync_factory, | 40 ProfileSyncComponentsFactory* profile_sync_factory, |
| 41 Profile* profile, | 41 Profile* profile, |
| 42 ProfileSyncService* sync_service, | 42 ProfileSyncService* sync_service, |
| 43 FrontendDataTypeControllerMock* mock) | 43 FrontendDataTypeControllerMock* mock) |
| 44 : FrontendDataTypeController(base::MessageLoopProxy::current(), | 44 : FrontendDataTypeController(base::MessageLoopProxy::current(), |
| 45 base::Closure(), | 45 base::Closure(), |
| 46 profile_sync_factory, | 46 profile_sync_factory, |
| 47 profile, | 47 profile, |
| 48 sync_service), | 48 sync_service), |
| 49 mock_(mock) {} | 49 mock_(mock) {} |
| 50 virtual syncer::ModelType type() const OVERRIDE { return syncer::BOOKMARKS; } | 50 virtual syncer::ModelType type() const override { return syncer::BOOKMARKS; } |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 virtual void CreateSyncComponents() OVERRIDE { | 53 virtual void CreateSyncComponents() override { |
| 54 ProfileSyncComponentsFactory::SyncComponents sync_components = | 54 ProfileSyncComponentsFactory::SyncComponents sync_components = |
| 55 profile_sync_factory_-> | 55 profile_sync_factory_-> |
| 56 CreateBookmarkSyncComponents(sync_service_, this); | 56 CreateBookmarkSyncComponents(sync_service_, this); |
| 57 model_associator_.reset(sync_components.model_associator); | 57 model_associator_.reset(sync_components.model_associator); |
| 58 change_processor_.reset(sync_components.change_processor); | 58 change_processor_.reset(sync_components.change_processor); |
| 59 } | 59 } |
| 60 | 60 |
| 61 // We mock the following methods because their default implementations do | 61 // We mock the following methods because their default implementations do |
| 62 // nothing, but we still want to make sure they're called appropriately. | 62 // nothing, but we still want to make sure they're called appropriately. |
| 63 virtual bool StartModels() OVERRIDE { | 63 virtual bool StartModels() override { |
| 64 return mock_->StartModels(); | 64 return mock_->StartModels(); |
| 65 } | 65 } |
| 66 virtual void CleanUpState() OVERRIDE { | 66 virtual void CleanUpState() override { |
| 67 mock_->CleanUpState(); | 67 mock_->CleanUpState(); |
| 68 } | 68 } |
| 69 virtual void RecordUnrecoverableError( | 69 virtual void RecordUnrecoverableError( |
| 70 const tracked_objects::Location& from_here, | 70 const tracked_objects::Location& from_here, |
| 71 const std::string& message) OVERRIDE { | 71 const std::string& message) override { |
| 72 mock_->RecordUnrecoverableError(from_here, message); | 72 mock_->RecordUnrecoverableError(from_here, message); |
| 73 } | 73 } |
| 74 virtual void RecordAssociationTime(base::TimeDelta time) OVERRIDE { | 74 virtual void RecordAssociationTime(base::TimeDelta time) override { |
| 75 mock_->RecordAssociationTime(time); | 75 mock_->RecordAssociationTime(time); |
| 76 } | 76 } |
| 77 virtual void RecordStartFailure( | 77 virtual void RecordStartFailure( |
| 78 DataTypeController::ConfigureResult result) OVERRIDE { | 78 DataTypeController::ConfigureResult result) override { |
| 79 mock_->RecordStartFailure(result); | 79 mock_->RecordStartFailure(result); |
| 80 } | 80 } |
| 81 private: | 81 private: |
| 82 virtual ~FrontendDataTypeControllerFake() {} | 82 virtual ~FrontendDataTypeControllerFake() {} |
| 83 FrontendDataTypeControllerMock* mock_; | 83 FrontendDataTypeControllerMock* mock_; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 class SyncFrontendDataTypeControllerTest : public testing::Test { | 86 class SyncFrontendDataTypeControllerTest : public testing::Test { |
| 87 public: | 87 public: |
| 88 SyncFrontendDataTypeControllerTest() | 88 SyncFrontendDataTypeControllerTest() |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 SetStartExpectations(); | 247 SetStartExpectations(); |
| 248 SetAssociateExpectations(); | 248 SetAssociateExpectations(); |
| 249 SetActivateExpectations(DataTypeController::OK); | 249 SetActivateExpectations(DataTypeController::OK); |
| 250 SetStopExpectations(); | 250 SetStopExpectations(); |
| 251 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); | 251 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); |
| 252 Start(); | 252 Start(); |
| 253 EXPECT_EQ(DataTypeController::RUNNING, frontend_dtc_->state()); | 253 EXPECT_EQ(DataTypeController::RUNNING, frontend_dtc_->state()); |
| 254 frontend_dtc_->Stop(); | 254 frontend_dtc_->Stop(); |
| 255 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); | 255 EXPECT_EQ(DataTypeController::NOT_RUNNING, frontend_dtc_->state()); |
| 256 } | 256 } |
| OLD | NEW |