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

Side by Side Diff: chromeos/login/login_state_unittest.cc

Issue 856563004: Update {virtual,override,final} to follow C++11 style in chromeos. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 "chromeos/login/login_state.h" 5 #include "chromeos/login/login_state.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "chromeos/chromeos_switches.h" 9 #include "chromeos/chromeos_switches.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace { 12 namespace {
13 const char kTestUserHash[] = "testuserhash"; 13 const char kTestUserHash[] = "testuserhash";
14 } // namespace 14 } // namespace
15 15
16 namespace chromeos { 16 namespace chromeos {
17 17
18 class LoginStateTest : public testing::Test, 18 class LoginStateTest : public testing::Test,
19 public LoginState::Observer { 19 public LoginState::Observer {
20 public: 20 public:
21 LoginStateTest() : logged_in_user_type_(LoginState::LOGGED_IN_USER_NONE), 21 LoginStateTest() : logged_in_user_type_(LoginState::LOGGED_IN_USER_NONE),
22 login_state_changes_count_(0) { 22 login_state_changes_count_(0) {
23 } 23 }
24 virtual ~LoginStateTest() { 24 ~LoginStateTest() override {}
25 }
26 25
27 // testing::Test 26 // testing::Test
28 virtual void SetUp() override { 27 void SetUp() override {
29 LoginState::Initialize(); 28 LoginState::Initialize();
30 LoginState::Get()->set_always_logged_in(false); 29 LoginState::Get()->set_always_logged_in(false);
31 LoginState::Get()->AddObserver(this); 30 LoginState::Get()->AddObserver(this);
32 } 31 }
33 32
34 virtual void TearDown() override { 33 void TearDown() override {
35 LoginState::Get()->RemoveObserver(this); 34 LoginState::Get()->RemoveObserver(this);
36 LoginState::Shutdown(); 35 LoginState::Shutdown();
37 } 36 }
38 37
39 // LoginState::Observer 38 // LoginState::Observer
40 virtual void LoggedInStateChanged() override { 39 void LoggedInStateChanged() override {
41 ++login_state_changes_count_; 40 ++login_state_changes_count_;
42 logged_in_user_type_ = LoginState::Get()->GetLoggedInUserType(); 41 logged_in_user_type_ = LoginState::Get()->GetLoggedInUserType();
43 } 42 }
44 43
45 protected: 44 protected:
46 // Returns number of times the login state changed since the last call to 45 // Returns number of times the login state changed since the last call to
47 // this method. 46 // this method.
48 unsigned int GetNewLoginStateChangesCount() { 47 unsigned int GetNewLoginStateChangesCount() {
49 unsigned int result = login_state_changes_count_; 48 unsigned int result = login_state_changes_count_;
50 login_state_changes_count_ = 0; 49 login_state_changes_count_ = 0;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 LoginState::Get()->GetLoggedInUserType()); 143 LoginState::Get()->GetLoggedInUserType());
145 EXPECT_TRUE(LoginState::Get()->IsUserLoggedIn()); 144 EXPECT_TRUE(LoginState::Get()->IsUserLoggedIn());
146 EXPECT_FALSE(LoginState::Get()->IsInSafeMode()); 145 EXPECT_FALSE(LoginState::Get()->IsInSafeMode());
147 EXPECT_EQ(kTestUserHash, LoginState::Get()->primary_user_hash()); 146 EXPECT_EQ(kTestUserHash, LoginState::Get()->primary_user_hash());
148 147
149 EXPECT_EQ(1U, GetNewLoginStateChangesCount()); 148 EXPECT_EQ(1U, GetNewLoginStateChangesCount());
150 EXPECT_EQ(LoginState::LOGGED_IN_USER_REGULAR, logged_in_user_type_); 149 EXPECT_EQ(LoginState::LOGGED_IN_USER_REGULAR, logged_in_user_type_);
151 } 150 }
152 151
153 } // namespace chromeos 152 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/login/auth/test_attempt_state.h ('k') | chromeos/process_proxy/process_output_watcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698