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/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 Profile* profile, | 56 Profile* profile, |
57 ProfileSyncService* sync_service, | 57 ProfileSyncService* sync_service, |
58 NonFrontendDataTypeControllerMock* mock) | 58 NonFrontendDataTypeControllerMock* mock) |
59 : NonFrontendDataTypeController(base::MessageLoopProxy::current(), | 59 : NonFrontendDataTypeController(base::MessageLoopProxy::current(), |
60 base::Closure(), | 60 base::Closure(), |
61 profile_sync_factory, | 61 profile_sync_factory, |
62 profile, | 62 profile, |
63 sync_service), | 63 sync_service), |
64 mock_(mock) {} | 64 mock_(mock) {} |
65 | 65 |
66 virtual syncer::ModelType type() const OVERRIDE { return syncer::BOOKMARKS; } | 66 virtual syncer::ModelType type() const override { return syncer::BOOKMARKS; } |
67 virtual syncer::ModelSafeGroup model_safe_group() const OVERRIDE { | 67 virtual syncer::ModelSafeGroup model_safe_group() const override { |
68 return syncer::GROUP_DB; | 68 return syncer::GROUP_DB; |
69 } | 69 } |
70 | 70 |
71 private: | 71 private: |
72 virtual ~NonFrontendDataTypeControllerFake() {} | 72 virtual ~NonFrontendDataTypeControllerFake() {} |
73 | 73 |
74 virtual ProfileSyncComponentsFactory::SyncComponents | 74 virtual ProfileSyncComponentsFactory::SyncComponents |
75 CreateSyncComponents() OVERRIDE { | 75 CreateSyncComponents() override { |
76 return profile_sync_factory()-> | 76 return profile_sync_factory()-> |
77 CreateBookmarkSyncComponents(profile_sync_service(), this); | 77 CreateBookmarkSyncComponents(profile_sync_service(), this); |
78 } | 78 } |
79 | 79 |
80 virtual bool PostTaskOnBackendThread( | 80 virtual bool PostTaskOnBackendThread( |
81 const tracked_objects::Location& from_here, | 81 const tracked_objects::Location& from_here, |
82 const base::Closure& task) OVERRIDE { | 82 const base::Closure& task) override { |
83 return BrowserThread::PostTask(BrowserThread::DB, from_here, task); | 83 return BrowserThread::PostTask(BrowserThread::DB, from_here, task); |
84 } | 84 } |
85 | 85 |
86 // We mock the following methods because their default implementations do | 86 // We mock the following methods because their default implementations do |
87 // nothing, but we still want to make sure they're called appropriately. | 87 // nothing, but we still want to make sure they're called appropriately. |
88 virtual bool StartModels() OVERRIDE { | 88 virtual bool StartModels() override { |
89 return mock_->StartModels(); | 89 return mock_->StartModels(); |
90 } | 90 } |
91 virtual void RecordUnrecoverableError( | 91 virtual void RecordUnrecoverableError( |
92 const tracked_objects::Location& from_here, | 92 const tracked_objects::Location& from_here, |
93 const std::string& message) OVERRIDE { | 93 const std::string& message) override { |
94 mock_->RecordUnrecoverableError(from_here, message); | 94 mock_->RecordUnrecoverableError(from_here, message); |
95 } | 95 } |
96 virtual void RecordAssociationTime(base::TimeDelta time) OVERRIDE { | 96 virtual void RecordAssociationTime(base::TimeDelta time) override { |
97 mock_->RecordAssociationTime(time); | 97 mock_->RecordAssociationTime(time); |
98 } | 98 } |
99 virtual void RecordStartFailure( | 99 virtual void RecordStartFailure( |
100 DataTypeController::ConfigureResult result) OVERRIDE { | 100 DataTypeController::ConfigureResult result) override { |
101 mock_->RecordStartFailure(result); | 101 mock_->RecordStartFailure(result); |
102 } | 102 } |
103 virtual void DisconnectProcessor( | 103 virtual void DisconnectProcessor( |
104 sync_driver::ChangeProcessor* processor) OVERRIDE{ | 104 sync_driver::ChangeProcessor* processor) override{ |
105 mock_->DisconnectProcessor(processor); | 105 mock_->DisconnectProcessor(processor); |
106 } | 106 } |
107 | 107 |
108 private: | 108 private: |
109 NonFrontendDataTypeControllerMock* mock_; | 109 NonFrontendDataTypeControllerMock* mock_; |
110 }; | 110 }; |
111 | 111 |
112 class SyncNonFrontendDataTypeControllerTest : public testing::Test { | 112 class SyncNonFrontendDataTypeControllerTest : public testing::Test { |
113 public: | 113 public: |
114 SyncNonFrontendDataTypeControllerTest() | 114 SyncNonFrontendDataTypeControllerTest() |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 syncer::SyncError::DATATYPE_ERROR, | 385 syncer::SyncError::DATATYPE_ERROR, |
386 "error", | 386 "error", |
387 non_frontend_dtc_->type()); | 387 non_frontend_dtc_->type()); |
388 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, base::Bind( | 388 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, base::Bind( |
389 &NonFrontendDataTypeControllerFake::OnSingleDataTypeUnrecoverableError, | 389 &NonFrontendDataTypeControllerFake::OnSingleDataTypeUnrecoverableError, |
390 non_frontend_dtc_.get(), | 390 non_frontend_dtc_.get(), |
391 error)); | 391 error)); |
392 WaitForDTC(); | 392 WaitForDTC(); |
393 EXPECT_EQ(DataTypeController::NOT_RUNNING, non_frontend_dtc_->state()); | 393 EXPECT_EQ(DataTypeController::NOT_RUNNING, non_frontend_dtc_->state()); |
394 } | 394 } |
OLD | NEW |