| OLD | NEW |
| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/chromeos/login/login_manager_test.h" | 8 #include "chrome/browser/chromeos/login/login_manager_test.h" |
| 9 #include "chrome/browser/chromeos/login/startup_utils.h" | 9 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 10 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 10 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 chromeos::StartupUtils::MarkOobeCompleted(); | 80 chromeos::StartupUtils::MarkOobeCompleted(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 IN_PROC_BROWSER_TEST_F(LoginStateNotificationBlockerChromeOSBrowserTest, | 83 IN_PROC_BROWSER_TEST_F(LoginStateNotificationBlockerChromeOSBrowserTest, |
| 84 BaseTest) { | 84 BaseTest) { |
| 85 CreateBlocker(); | 85 CreateBlocker(); |
| 86 message_center::NotifierId notifier_id( | 86 message_center::NotifierId notifier_id( |
| 87 message_center::NotifierId::APPLICATION, "test-notifier"); | 87 message_center::NotifierId::APPLICATION, "test-notifier"); |
| 88 | 88 |
| 89 // Logged in as a normal user. | 89 // Logged in as a normal user. |
| 90 EXPECT_CALL(login_utils(), DoBrowserLaunch(_, _)).Times(1); | |
| 91 LoginUser(kTestUsers[0]); | 90 LoginUser(kTestUsers[0]); |
| 92 EXPECT_EQ(1, GetStateChangedCountAndReset()); | 91 EXPECT_EQ(1, GetStateChangedCountAndReset()); |
| 93 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); | 92 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); |
| 94 | 93 |
| 95 // Multi-login user switch. | 94 // Multi-login user switch. |
| 96 chromeos::UserAddingScreen::Get()->Start(); | 95 chromeos::UserAddingScreen::Get()->Start(); |
| 97 content::RunAllPendingInMessageLoop(); | 96 content::RunAllPendingInMessageLoop(); |
| 98 EXPECT_EQ(1, GetStateChangedCountAndReset()); | 97 EXPECT_EQ(1, GetStateChangedCountAndReset()); |
| 99 EXPECT_FALSE(ShouldShowNotificationAsPopup(notifier_id)); | 98 EXPECT_FALSE(ShouldShowNotificationAsPopup(notifier_id)); |
| 100 | 99 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 115 IN_PROC_BROWSER_TEST_F(LoginStateNotificationBlockerChromeOSBrowserTest, | 114 IN_PROC_BROWSER_TEST_F(LoginStateNotificationBlockerChromeOSBrowserTest, |
| 116 AlwaysAllowedNotifier) { | 115 AlwaysAllowedNotifier) { |
| 117 CreateBlocker(); | 116 CreateBlocker(); |
| 118 | 117 |
| 119 // NOTIFIER_DISPLAY is allowed to shown in the login screen. | 118 // NOTIFIER_DISPLAY is allowed to shown in the login screen. |
| 120 message_center::NotifierId notifier_id( | 119 message_center::NotifierId notifier_id( |
| 121 message_center::NotifierId::SYSTEM_COMPONENT, | 120 message_center::NotifierId::SYSTEM_COMPONENT, |
| 122 ash::system_notifier::kNotifierDisplay); | 121 ash::system_notifier::kNotifierDisplay); |
| 123 | 122 |
| 124 // Logged in as a normal user. | 123 // Logged in as a normal user. |
| 125 EXPECT_CALL(login_utils(), DoBrowserLaunch(_, _)).Times(1); | |
| 126 LoginUser(kTestUsers[0]); | 124 LoginUser(kTestUsers[0]); |
| 127 EXPECT_EQ(1, GetStateChangedCountAndReset()); | 125 EXPECT_EQ(1, GetStateChangedCountAndReset()); |
| 128 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); | 126 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); |
| 129 | 127 |
| 130 // Multi-login user switch. | 128 // Multi-login user switch. |
| 131 chromeos::UserAddingScreen::Get()->Start(); | 129 chromeos::UserAddingScreen::Get()->Start(); |
| 132 content::RunAllPendingInMessageLoop(); | 130 content::RunAllPendingInMessageLoop(); |
| 133 EXPECT_EQ(1, GetStateChangedCountAndReset()); | 131 EXPECT_EQ(1, GetStateChangedCountAndReset()); |
| 134 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); | 132 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); |
| 135 | 133 |
| 136 // Multi-login user switch off. | 134 // Multi-login user switch off. |
| 137 chromeos::UserAddingScreen::Get()->Cancel(); | 135 chromeos::UserAddingScreen::Get()->Cancel(); |
| 138 content::RunAllPendingInMessageLoop(); | 136 content::RunAllPendingInMessageLoop(); |
| 139 EXPECT_EQ(1, GetStateChangedCountAndReset()); | 137 EXPECT_EQ(1, GetStateChangedCountAndReset()); |
| 140 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); | 138 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); |
| 141 } | 139 } |
| OLD | NEW |