Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: chrome/browser/sync/glue/non_frontend_data_type_controller_unittest.cc

Issue 12212048: Linux/ChromeOS Chromium style checker cleanup, chrome/browser edition. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 NonFrontendDataTypeControllerFake( 54 NonFrontendDataTypeControllerFake(
55 ProfileSyncComponentsFactory* profile_sync_factory, 55 ProfileSyncComponentsFactory* profile_sync_factory,
56 Profile* profile, 56 Profile* profile,
57 ProfileSyncService* sync_service, 57 ProfileSyncService* sync_service,
58 NonFrontendDataTypeControllerMock* mock) 58 NonFrontendDataTypeControllerMock* mock)
59 : NonFrontendDataTypeController(profile_sync_factory, 59 : NonFrontendDataTypeController(profile_sync_factory,
60 profile, 60 profile,
61 sync_service), 61 sync_service),
62 mock_(mock) {} 62 mock_(mock) {}
63 63
64 virtual syncer::ModelType type() const { return syncer::BOOKMARKS; } 64 virtual syncer::ModelType type() const OVERRIDE { return syncer::BOOKMARKS; }
65 virtual syncer::ModelSafeGroup model_safe_group() const { 65 virtual syncer::ModelSafeGroup model_safe_group() const OVERRIDE {
66 return syncer::GROUP_DB; 66 return syncer::GROUP_DB;
67 } 67 }
68 68
69 private: 69 private:
70 virtual ~NonFrontendDataTypeControllerFake() {} 70 virtual ~NonFrontendDataTypeControllerFake() {}
71 71
72 virtual void CreateSyncComponents() OVERRIDE { 72 virtual void CreateSyncComponents() OVERRIDE {
73 ProfileSyncComponentsFactory::SyncComponents sync_components = 73 ProfileSyncComponentsFactory::SyncComponents sync_components =
74 profile_sync_factory()-> 74 profile_sync_factory()->
75 CreateBookmarkSyncComponents(profile_sync_service(), this); 75 CreateBookmarkSyncComponents(profile_sync_service(), this);
(...skipping 10 matching lines...) Expand all
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 StopModels() OVERRIDE { 91 virtual void StopModels() OVERRIDE {
92 mock_->StopModels(); 92 mock_->StopModels();
93 } 93 }
94 virtual void RecordUnrecoverableError( 94 virtual void RecordUnrecoverableError(
95 const tracked_objects::Location& from_here, 95 const tracked_objects::Location& from_here,
96 const std::string& message) { 96 const std::string& message) OVERRIDE {
97 mock_->RecordUnrecoverableError(from_here, message); 97 mock_->RecordUnrecoverableError(from_here, message);
98 } 98 }
99 virtual void RecordAssociationTime(base::TimeDelta time) { 99 virtual void RecordAssociationTime(base::TimeDelta time) OVERRIDE {
100 mock_->RecordAssociationTime(time); 100 mock_->RecordAssociationTime(time);
101 } 101 }
102 virtual void RecordStartFailure(DataTypeController::StartResult result) { 102 virtual void RecordStartFailure(
103 DataTypeController::StartResult result) OVERRIDE {
103 mock_->RecordStartFailure(result); 104 mock_->RecordStartFailure(result);
104 } 105 }
105 private: 106 private:
106 NonFrontendDataTypeControllerMock* mock_; 107 NonFrontendDataTypeControllerMock* mock_;
107 }; 108 };
108 109
109 class SyncNonFrontendDataTypeControllerTest : public testing::Test { 110 class SyncNonFrontendDataTypeControllerTest : public testing::Test {
110 public: 111 public:
111 SyncNonFrontendDataTypeControllerTest() 112 SyncNonFrontendDataTypeControllerTest()
112 : ui_thread_(BrowserThread::UI, &message_loop_), 113 : ui_thread_(BrowserThread::UI, &message_loop_),
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 EXPECT_EQ(DataTypeController::RUNNING, non_frontend_dtc_->state()); 379 EXPECT_EQ(DataTypeController::RUNNING, non_frontend_dtc_->state());
379 // This should cause non_frontend_dtc_->Stop() to be called. 380 // This should cause non_frontend_dtc_->Stop() to be called.
380 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, base::Bind( 381 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, base::Bind(
381 &NonFrontendDataTypeControllerFake::OnSingleDatatypeUnrecoverableError, 382 &NonFrontendDataTypeControllerFake::OnSingleDatatypeUnrecoverableError,
382 non_frontend_dtc_.get(), 383 non_frontend_dtc_.get(),
383 FROM_HERE, 384 FROM_HERE,
384 std::string("Test"))); 385 std::string("Test")));
385 WaitForDTC(); 386 WaitForDTC();
386 EXPECT_EQ(DataTypeController::NOT_RUNNING, non_frontend_dtc_->state()); 387 EXPECT_EQ(DataTypeController::NOT_RUNNING, non_frontend_dtc_->state());
387 } 388 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698