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" |
11 #include "chrome/browser/notifications/login_state_notification_blocker_chromeos
.h" | 11 #include "chrome/browser/notifications/login_state_notification_blocker_chromeos
.h" |
12 #include "chrome/common/chrome_switches.h" | |
13 #include "content/public/test/test_utils.h" | 12 #include "content/public/test/test_utils.h" |
14 #include "ui/message_center/message_center.h" | 13 #include "ui/message_center/message_center.h" |
15 | 14 |
16 using namespace testing; | 15 using namespace testing; |
17 | 16 |
18 namespace { | 17 namespace { |
19 | 18 |
20 const char* kTestUsers[] = {"test-user@gmail.com", | 19 const char* kTestUsers[] = {"test-user@gmail.com", |
21 "test-user1@gmail.com"}; | 20 "test-user1@gmail.com"}; |
22 | 21 |
23 } // anonymous namespace | 22 } // anonymous namespace |
24 | 23 |
25 class LoginStateNotificationBlockerChromeOSBrowserTest | 24 class LoginStateNotificationBlockerChromeOSBrowserTest |
26 : public chromeos::LoginManagerTest, | 25 : public chromeos::LoginManagerTest, |
27 public message_center::NotificationBlocker::Observer { | 26 public message_center::NotificationBlocker::Observer { |
28 public: | 27 public: |
29 LoginStateNotificationBlockerChromeOSBrowserTest() | 28 LoginStateNotificationBlockerChromeOSBrowserTest() |
30 : chromeos::LoginManagerTest(false), | 29 : chromeos::LoginManagerTest(false), |
31 state_changed_count_(0) {} | 30 state_changed_count_(0) {} |
32 virtual ~LoginStateNotificationBlockerChromeOSBrowserTest() {} | 31 virtual ~LoginStateNotificationBlockerChromeOSBrowserTest() {} |
33 | 32 |
34 // InProcessBrowserTest overrides: | |
35 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | |
36 LoginManagerTest::SetUpCommandLine(command_line); | |
37 command_line->AppendSwitch(::switches::kMultiProfiles); | |
38 } | |
39 | |
40 virtual void SetUpOnMainThread() OVERRIDE { | 33 virtual void SetUpOnMainThread() OVERRIDE { |
41 chromeos::LoginState::Get()->set_always_logged_in(false); | 34 chromeos::LoginState::Get()->set_always_logged_in(false); |
42 chromeos::LoginManagerTest::SetUpOnMainThread(); | 35 chromeos::LoginManagerTest::SetUpOnMainThread(); |
43 } | 36 } |
44 | 37 |
45 virtual void CleanUpOnMainThread() OVERRIDE { | 38 virtual void CleanUpOnMainThread() OVERRIDE { |
46 if (blocker_) | 39 if (blocker_) |
47 blocker_->RemoveObserver(this); | 40 blocker_->RemoveObserver(this); |
48 blocker_.reset(); | 41 blocker_.reset(); |
49 chromeos::LoginManagerTest::CleanUpOnMainThread(); | 42 chromeos::LoginManagerTest::CleanUpOnMainThread(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 content::RunAllPendingInMessageLoop(); | 132 content::RunAllPendingInMessageLoop(); |
140 EXPECT_EQ(1, GetStateChangedCountAndReset()); | 133 EXPECT_EQ(1, GetStateChangedCountAndReset()); |
141 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); | 134 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); |
142 | 135 |
143 // Multi-login user switch off. | 136 // Multi-login user switch off. |
144 chromeos::UserAddingScreen::Get()->Cancel(); | 137 chromeos::UserAddingScreen::Get()->Cancel(); |
145 content::RunAllPendingInMessageLoop(); | 138 content::RunAllPendingInMessageLoop(); |
146 EXPECT_EQ(1, GetStateChangedCountAndReset()); | 139 EXPECT_EQ(1, GetStateChangedCountAndReset()); |
147 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); | 140 EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id)); |
148 } | 141 } |
OLD | NEW |