OLD | NEW |
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 "ash/shell.h" | 5 #include "ash/shell.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "chrome/browser/chromeos/status/status_area_button.h" | 8 #include "chrome/browser/chromeos/status/status_area_button.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 typedef InProcessBrowserTest StatusAreaHostAuraTest; | 25 typedef InProcessBrowserTest StatusAreaHostAuraTest; |
26 | 26 |
27 IN_PROC_BROWSER_TEST_F(StatusAreaHostAuraTest, TextStyle) { | 27 IN_PROC_BROWSER_TEST_F(StatusAreaHostAuraTest, TextStyle) { |
28 ChromeShellDelegate* delegate = static_cast<ChromeShellDelegate*>( | 28 ChromeShellDelegate* delegate = static_cast<ChromeShellDelegate*>( |
29 ash::Shell::GetInstance()->delegate()); | 29 ash::Shell::GetInstance()->delegate()); |
30 StatusAreaHostAura* host = delegate->status_area_host_for_test(); | 30 StatusAreaHostAura* host = delegate->status_area_host_for_test(); |
31 | 31 |
32 #if defined(OS_CHROMEOS) | 32 #if defined(OS_CHROMEOS) |
33 ASSERT_FALSE(chromeos::UserManager::Get()->user_is_logged_in()); | 33 ASSERT_FALSE(chromeos::UserManager::Get()->user_is_logged_in()); |
34 EXPECT_EQ(StatusAreaButton::GRAY_PLAIN, host->GetStatusAreaTextStyle()); | 34 EXPECT_EQ(StatusAreaButton::GRAY_PLAIN_LIGHT, host->GetStatusAreaTextStyle()); |
35 | 35 |
36 // ProfileManager expects a profile dir to be set on Chrome OS. | 36 // ProfileManager expects a profile dir to be set on Chrome OS. |
37 CommandLine::ForCurrentProcess()->AppendSwitchNative( | 37 CommandLine::ForCurrentProcess()->AppendSwitchNative( |
38 switches::kLoginProfile, "StatusAreaHostAuraTest"); | 38 switches::kLoginProfile, "StatusAreaHostAuraTest"); |
39 chromeos::UserManager::Get()->UserLoggedIn("foo@example.com"); | 39 chromeos::UserManager::Get()->UserLoggedIn("foo@example.com"); |
40 ASSERT_TRUE(chromeos::UserManager::Get()->user_is_logged_in()); | 40 ASSERT_TRUE(chromeos::UserManager::Get()->user_is_logged_in()); |
41 #endif | 41 #endif |
42 | 42 |
43 if (ash::Shell::GetInstance()->IsWindowModeCompact()) { | 43 if (ash::Shell::GetInstance()->IsWindowModeCompact()) { |
44 EXPECT_EQ(StatusAreaButton::GRAY_EMBOSSED, host->GetStatusAreaTextStyle()); | 44 EXPECT_EQ(StatusAreaButton::GRAY_EMBOSSED_BOLD, |
| 45 host->GetStatusAreaTextStyle()); |
45 | 46 |
46 Browser* incognito_browser = CreateIncognitoBrowser(); | 47 Browser* incognito_browser = CreateIncognitoBrowser(); |
47 EXPECT_EQ(StatusAreaButton::WHITE_PLAIN, host->GetStatusAreaTextStyle()); | 48 EXPECT_EQ(StatusAreaButton::WHITE_PLAIN_BOLD, |
| 49 host->GetStatusAreaTextStyle()); |
48 | 50 |
49 incognito_browser->CloseWindow(); | 51 incognito_browser->CloseWindow(); |
50 EXPECT_EQ(StatusAreaButton::GRAY_EMBOSSED, host->GetStatusAreaTextStyle()); | 52 EXPECT_EQ(StatusAreaButton::GRAY_EMBOSSED_BOLD, |
| 53 host->GetStatusAreaTextStyle()); |
51 } else { | 54 } else { |
52 EXPECT_EQ(StatusAreaButton::WHITE_HALOED, host->GetStatusAreaTextStyle()); | 55 EXPECT_EQ(StatusAreaButton::WHITE_HALOED_BOLD, |
| 56 host->GetStatusAreaTextStyle()); |
53 } | 57 } |
54 | 58 |
55 #if defined(OS_CHROMEOS) | 59 #if defined(OS_CHROMEOS) |
56 // Lock the screen. | 60 // Lock the screen. |
57 chromeos::ScreenLocker::Show(); | 61 chromeos::ScreenLocker::Show(); |
58 scoped_ptr<chromeos::test::ScreenLockerTester> tester( | 62 scoped_ptr<chromeos::test::ScreenLockerTester> tester( |
59 chromeos::ScreenLocker::GetTester()); | 63 chromeos::ScreenLocker::GetTester()); |
60 tester->EmulateWindowManagerReady(); | 64 tester->EmulateWindowManagerReady(); |
61 ui_test_utils::WindowedNotificationObserver lock_state_observer( | 65 ui_test_utils::WindowedNotificationObserver lock_state_observer( |
62 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, | 66 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, |
63 content::NotificationService::AllSources()); | 67 content::NotificationService::AllSources()); |
64 if (!tester->IsLocked()) | 68 if (!tester->IsLocked()) |
65 lock_state_observer.Wait(); | 69 lock_state_observer.Wait(); |
66 ASSERT_TRUE(tester->IsLocked()); | 70 ASSERT_TRUE(tester->IsLocked()); |
67 EXPECT_EQ(StatusAreaButton::GRAY_PLAIN, host->GetStatusAreaTextStyle()); | 71 EXPECT_EQ(StatusAreaButton::GRAY_PLAIN_LIGHT, host->GetStatusAreaTextStyle()); |
68 | 72 |
69 chromeos::ScreenLocker::Hide(); | 73 chromeos::ScreenLocker::Hide(); |
70 ui_test_utils::RunAllPendingInMessageLoop(); | 74 ui_test_utils::RunAllPendingInMessageLoop(); |
71 ASSERT_FALSE(tester->IsLocked()); | 75 ASSERT_FALSE(tester->IsLocked()); |
72 #endif | 76 #endif |
73 } | 77 } |
OLD | NEW |