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

Side by Side Diff: chrome/browser/signin/signin_manager_unittest.cc

Issue 629603002: replace OVERRIDE and FINAL with override and final in chrome/browser/[r-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 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
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 "components/signin/core/browser/signin_manager.h" 5 #include "components/signin/core/browser/signin_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 virtual ~TestSigninManagerObserver() {} 64 virtual ~TestSigninManagerObserver() {}
65 65
66 int num_failed_signins_; 66 int num_failed_signins_;
67 int num_successful_signins_; 67 int num_successful_signins_;
68 int num_signouts_; 68 int num_signouts_;
69 69
70 private: 70 private:
71 // SigninManagerBase::Observer: 71 // SigninManagerBase::Observer:
72 virtual void GoogleSigninFailed( 72 virtual void GoogleSigninFailed(
73 const GoogleServiceAuthError& error) OVERRIDE { 73 const GoogleServiceAuthError& error) override {
74 num_failed_signins_++; 74 num_failed_signins_++;
75 } 75 }
76 76
77 virtual void GoogleSigninSucceeded( 77 virtual void GoogleSigninSucceeded(
78 const std::string& account_id, 78 const std::string& account_id,
79 const std::string& username, 79 const std::string& username,
80 const std::string& password) OVERRIDE { 80 const std::string& password) override {
81 num_successful_signins_++; 81 num_successful_signins_++;
82 } 82 }
83 83
84 virtual void GoogleSignedOut(const std::string& account_id, 84 virtual void GoogleSignedOut(const std::string& account_id,
85 const std::string& username) OVERRIDE { 85 const std::string& username) override {
86 num_signouts_++; 86 num_signouts_++;
87 } 87 }
88 }; 88 };
89 89
90 } // namespace 90 } // namespace
91 91
92 92
93 class SigninManagerTest : public testing::Test { 93 class SigninManagerTest : public testing::Test {
94 public: 94 public:
95 SigninManagerTest() : manager_(NULL) {} 95 SigninManagerTest() : manager_(NULL) {}
96 virtual ~SigninManagerTest() {} 96 virtual ~SigninManagerTest() {}
97 97
98 virtual void SetUp() OVERRIDE { 98 virtual void SetUp() override {
99 manager_ = NULL; 99 manager_ = NULL;
100 prefs_.reset(new TestingPrefServiceSimple); 100 prefs_.reset(new TestingPrefServiceSimple);
101 chrome::RegisterLocalState(prefs_->registry()); 101 chrome::RegisterLocalState(prefs_->registry());
102 TestingBrowserProcess::GetGlobal()->SetLocalState( 102 TestingBrowserProcess::GetGlobal()->SetLocalState(
103 prefs_.get()); 103 prefs_.get());
104 TestingProfile::Builder builder; 104 TestingProfile::Builder builder;
105 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), 105 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
106 BuildFakeProfileOAuth2TokenService); 106 BuildFakeProfileOAuth2TokenService);
107 builder.AddTestingFactory(ChromeSigninClientFactory::GetInstance(), 107 builder.AddTestingFactory(ChromeSigninClientFactory::GetInstance(),
108 signin::BuildTestSigninClient); 108 signin::BuildTestSigninClient);
109 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), 109 builder.AddTestingFactory(SigninManagerFactory::GetInstance(),
110 SigninManagerBuild); 110 SigninManagerBuild);
111 profile_ = builder.Build(); 111 profile_ = builder.Build();
112 112
113 static_cast<TestSigninClient*>( 113 static_cast<TestSigninClient*>(
114 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile()))-> 114 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile()))->
115 SetURLRequestContext(profile_->GetRequestContext()); 115 SetURLRequestContext(profile_->GetRequestContext());
116 } 116 }
117 117
118 virtual void TearDown() OVERRIDE { 118 virtual void TearDown() override {
119 if (manager_) 119 if (manager_)
120 manager_->RemoveObserver(&test_observer_); 120 manager_->RemoveObserver(&test_observer_);
121 121
122 // Destroy the SigninManager here, because it relies on profile() which is 122 // Destroy the SigninManager here, because it relies on profile() which is
123 // freed in the base class. 123 // freed in the base class.
124 if (naked_manager_) { 124 if (naked_manager_) {
125 naked_manager_->Shutdown(); 125 naked_manager_->Shutdown();
126 naked_manager_.reset(NULL); 126 naked_manager_.reset(NULL);
127 } 127 }
128 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); 128 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL);
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 profile()->GetPrefs()->GetString(prefs::kGoogleServicesUsername)); 344 profile()->GetPrefs()->GetString(prefs::kGoogleServicesUsername));
345 EXPECT_EQ("external@example.com", manager_->GetAuthenticatedUsername()); 345 EXPECT_EQ("external@example.com", manager_->GetAuthenticatedUsername());
346 } 346 }
347 347
348 TEST_F(SigninManagerTest, SigninNotAllowed) { 348 TEST_F(SigninManagerTest, SigninNotAllowed) {
349 std::string user("user@google.com"); 349 std::string user("user@google.com");
350 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, user); 350 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, user);
351 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); 351 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false);
352 SetUpSigninManagerAsService(); 352 SetUpSigninManagerAsService();
353 } 353 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_manager_factory.h ('k') | chrome/browser/signin/signin_names_io_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698