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

Side by Side Diff: chrome/browser/sync/sync_startup_tracker_unittest.cc

Issue 686563003: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "chrome/browser/sync/profile_sync_service_factory.h" 6 #include "chrome/browser/sync/profile_sync_service_factory.h"
7 #include "chrome/browser/sync/profile_sync_service_mock.h" 7 #include "chrome/browser/sync/profile_sync_service_mock.h"
8 #include "chrome/browser/sync/sync_startup_tracker.h" 8 #include "chrome/browser/sync/sync_startup_tracker.h"
9 #include "content/public/test/test_browser_thread_bundle.h" 9 #include "content/public/test/test_browser_thread_bundle.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 11 matching lines...) Expand all
22 public: 22 public:
23 MOCK_METHOD0(SyncStartupCompleted, void(void)); 23 MOCK_METHOD0(SyncStartupCompleted, void(void));
24 MOCK_METHOD0(SyncStartupFailed, void(void)); 24 MOCK_METHOD0(SyncStartupFailed, void(void));
25 }; 25 };
26 26
27 class SyncStartupTrackerTest : public testing::Test { 27 class SyncStartupTrackerTest : public testing::Test {
28 public: 28 public:
29 SyncStartupTrackerTest() : 29 SyncStartupTrackerTest() :
30 no_error_(GoogleServiceAuthError::NONE) { 30 no_error_(GoogleServiceAuthError::NONE) {
31 } 31 }
32 virtual void SetUp() override { 32 void SetUp() override {
33 profile_.reset(new TestingProfile()); 33 profile_.reset(new TestingProfile());
34 mock_pss_ = static_cast<ProfileSyncServiceMock*>( 34 mock_pss_ = static_cast<ProfileSyncServiceMock*>(
35 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( 35 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
36 profile_.get(), 36 profile_.get(),
37 ProfileSyncServiceMock::BuildMockProfileSyncService)); 37 ProfileSyncServiceMock::BuildMockProfileSyncService));
38 38
39 // Make gmock not spam the output with information about these uninteresting 39 // Make gmock not spam the output with information about these uninteresting
40 // calls. 40 // calls.
41 EXPECT_CALL(*mock_pss_, AddObserver(_)).Times(AnyNumber()); 41 EXPECT_CALL(*mock_pss_, AddObserver(_)).Times(AnyNumber());
42 EXPECT_CALL(*mock_pss_, RemoveObserver(_)).Times(AnyNumber()); 42 EXPECT_CALL(*mock_pss_, RemoveObserver(_)).Times(AnyNumber());
43 EXPECT_CALL(*mock_pss_, GetAuthError()). 43 EXPECT_CALL(*mock_pss_, GetAuthError()).
44 WillRepeatedly(ReturnRef(no_error_)); 44 WillRepeatedly(ReturnRef(no_error_));
45 ON_CALL(*mock_pss_, GetRegisteredDataTypes()) 45 ON_CALL(*mock_pss_, GetRegisteredDataTypes())
46 .WillByDefault(Return(syncer::ModelTypeSet())); 46 .WillByDefault(Return(syncer::ModelTypeSet()));
47 mock_pss_->Initialize(); 47 mock_pss_->Initialize();
48 } 48 }
49 49
50 virtual void TearDown() override { 50 void TearDown() override { profile_.reset(); }
51 profile_.reset();
52 }
53 51
54 void SetupNonInitializedPSS() { 52 void SetupNonInitializedPSS() {
55 EXPECT_CALL(*mock_pss_, GetAuthError()) 53 EXPECT_CALL(*mock_pss_, GetAuthError())
56 .WillRepeatedly(ReturnRef(no_error_)); 54 .WillRepeatedly(ReturnRef(no_error_));
57 EXPECT_CALL(*mock_pss_, backend_initialized()) 55 EXPECT_CALL(*mock_pss_, backend_initialized())
58 .WillRepeatedly(Return(false)); 56 .WillRepeatedly(Return(false));
59 EXPECT_CALL(*mock_pss_, HasUnrecoverableError()) 57 EXPECT_CALL(*mock_pss_, HasUnrecoverableError())
60 .WillRepeatedly(Return(false)); 58 .WillRepeatedly(Return(false));
61 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) 59 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn())
62 .WillRepeatedly(Return(true)); 60 .WillRepeatedly(Return(true));
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()).WillRepeatedly( 145 EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()).WillRepeatedly(
148 Return(true)); 146 Return(true));
149 GoogleServiceAuthError error( 147 GoogleServiceAuthError error(
150 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); 148 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
151 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error)); 149 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error));
152 EXPECT_CALL(observer_, SyncStartupFailed()); 150 EXPECT_CALL(observer_, SyncStartupFailed());
153 tracker.OnStateChanged(); 151 tracker.OnStateChanged();
154 } 152 }
155 153
156 } // namespace 154 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_global_error_unittest.cc ('k') | chrome/browser/sync/test/integration/cross_platform_sync_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698