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

Side by Side Diff: chrome/browser/notifications/login_state_notification_blocker_chromeos_unittest.cc

Issue 371033005: Remove unused LOGGED_IN_OOBE LoggedInState. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "ash/shell.h" 5 #include "ash/shell.h"
6 #include "ash/system/system_notifier.h" 6 #include "ash/system/system_notifier.h"
7 #include "ash/test/ash_test_base.h" 7 #include "ash/test/ash_test_base.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "chrome/browser/notifications/login_state_notification_blocker_chromeos .h" 9 #include "chrome/browser/notifications/login_state_notification_blocker_chromeos .h"
10 #include "chromeos/login/login_state.h" 10 #include "chromeos/login/login_state.h"
(...skipping 18 matching lines...) Expand all
29 blocker_->AddObserver(this); 29 blocker_->AddObserver(this);
30 } 30 }
31 31
32 virtual void TearDown() OVERRIDE { 32 virtual void TearDown() OVERRIDE {
33 blocker_->RemoveObserver(this); 33 blocker_->RemoveObserver(this);
34 blocker_.reset(); 34 blocker_.reset();
35 ash::test::AshTestBase::TearDown(); 35 ash::test::AshTestBase::TearDown();
36 chromeos::LoginState::Shutdown(); 36 chromeos::LoginState::Shutdown();
37 } 37 }
38 38
39 // message_center::NotificationBlocker::Observer ovverrides: 39 // message_center::NotificationBlocker::Observer overrides:
40 virtual void OnBlockingStateChanged( 40 virtual void OnBlockingStateChanged(
41 message_center::NotificationBlocker* blocker) OVERRIDE { 41 message_center::NotificationBlocker* blocker) OVERRIDE {
42 state_changed_count_++; 42 state_changed_count_++;
43 } 43 }
44 44
45 int GetStateChangedCountAndReset() { 45 int GetStateChangedCountAndReset() {
46 int result = state_changed_count_; 46 int result = state_changed_count_;
47 state_changed_count_ = 0; 47 state_changed_count_ = 0;
48 return result; 48 return result;
49 } 49 }
(...skipping 13 matching lines...) Expand all
63 TEST_F(LoginStateNotificationBlockerChromeOSTest, BaseTest) { 63 TEST_F(LoginStateNotificationBlockerChromeOSTest, BaseTest) {
64 // Default status: OOBE. 64 // Default status: OOBE.
65 message_center::NotifierId notifier_id( 65 message_center::NotifierId notifier_id(
66 message_center::NotifierId::APPLICATION, "test-notifier"); 66 message_center::NotifierId::APPLICATION, "test-notifier");
67 EXPECT_FALSE(ShouldShowNotificationAsPopup(notifier_id)); 67 EXPECT_FALSE(ShouldShowNotificationAsPopup(notifier_id));
68 68
69 // Login screen. 69 // Login screen.
70 chromeos::LoginState::Get()->SetLoggedInState( 70 chromeos::LoginState::Get()->SetLoggedInState(
71 chromeos::LoginState::LOGGED_IN_NONE, 71 chromeos::LoginState::LOGGED_IN_NONE,
72 chromeos::LoginState::LOGGED_IN_USER_NONE); 72 chromeos::LoginState::LOGGED_IN_USER_NONE);
73 EXPECT_EQ(1, GetStateChangedCountAndReset()); 73 EXPECT_EQ(0, GetStateChangedCountAndReset());
74 EXPECT_FALSE(ShouldShowNotificationAsPopup(notifier_id)); 74 EXPECT_FALSE(ShouldShowNotificationAsPopup(notifier_id));
75 75
76 // Logged in as a normal user. 76 // Logged in as a normal user.
77 chromeos::LoginState::Get()->SetLoggedInState( 77 chromeos::LoginState::Get()->SetLoggedInState(
78 chromeos::LoginState::LOGGED_IN_ACTIVE, 78 chromeos::LoginState::LOGGED_IN_ACTIVE,
79 chromeos::LoginState::LOGGED_IN_USER_REGULAR); 79 chromeos::LoginState::LOGGED_IN_USER_REGULAR);
80 EXPECT_EQ(1, GetStateChangedCountAndReset()); 80 EXPECT_EQ(1, GetStateChangedCountAndReset());
81 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); 81 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id));
82 82
83 // Lock. 83 // Lock.
(...skipping 13 matching lines...) Expand all
97 message_center::NotifierId::SYSTEM_COMPONENT, 97 message_center::NotifierId::SYSTEM_COMPONENT,
98 ash::system_notifier::kNotifierDisplay); 98 ash::system_notifier::kNotifierDisplay);
99 99
100 // Default status: OOBE. 100 // Default status: OOBE.
101 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); 101 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id));
102 102
103 // Login screen. 103 // Login screen.
104 chromeos::LoginState::Get()->SetLoggedInState( 104 chromeos::LoginState::Get()->SetLoggedInState(
105 chromeos::LoginState::LOGGED_IN_NONE, 105 chromeos::LoginState::LOGGED_IN_NONE,
106 chromeos::LoginState::LOGGED_IN_USER_NONE); 106 chromeos::LoginState::LOGGED_IN_USER_NONE);
107 EXPECT_EQ(1, GetStateChangedCountAndReset()); 107 EXPECT_EQ(0, GetStateChangedCountAndReset());
108 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); 108 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id));
109 109
110 // Logged in as a normal user. 110 // Logged in as a normal user.
111 chromeos::LoginState::Get()->SetLoggedInState( 111 chromeos::LoginState::Get()->SetLoggedInState(
112 chromeos::LoginState::LOGGED_IN_ACTIVE, 112 chromeos::LoginState::LOGGED_IN_ACTIVE,
113 chromeos::LoginState::LOGGED_IN_USER_REGULAR); 113 chromeos::LoginState::LOGGED_IN_USER_REGULAR);
114 EXPECT_EQ(1, GetStateChangedCountAndReset()); 114 EXPECT_EQ(1, GetStateChangedCountAndReset());
115 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); 115 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id));
116 116
117 // Lock. 117 // Lock.
118 ash::Shell::GetInstance()->OnLockStateChanged(true); 118 ash::Shell::GetInstance()->OnLockStateChanged(true);
119 EXPECT_EQ(1, GetStateChangedCountAndReset()); 119 EXPECT_EQ(1, GetStateChangedCountAndReset());
120 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); 120 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id));
121 121
122 // Unlock. 122 // Unlock.
123 ash::Shell::GetInstance()->OnLockStateChanged(false); 123 ash::Shell::GetInstance()->OnLockStateChanged(false);
124 EXPECT_EQ(1, GetStateChangedCountAndReset()); 124 EXPECT_EQ(1, GetStateChangedCountAndReset());
125 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); 125 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id));
126 } 126 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/ui/login_display_host_impl.cc ('k') | chromeos/login/login_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698