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

Side by Side Diff: chrome/browser/ui/views/aura/status_area_host_aura_browsertest.cc

Issue 9570044: Rename chrome/browser/ui/views/{aura => ash}/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ash/shell.h"
6 #include "base/command_line.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/chromeos/status/status_area_button.h"
9 #include "chrome/browser/profiles/profile_manager.h"
10 #include "chrome/browser/chromeos/system/runtime_environment.h"
11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/browser_window.h"
13 #include "chrome/browser/ui/views/aura/chrome_shell_delegate.h"
14 #include "chrome/browser/ui/views/aura/status_area_host_aura.h"
15 #include "chrome/common/chrome_notification_types.h"
16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/test/base/in_process_browser_test.h"
18 #include "chrome/test/base/ui_test_utils.h"
19 #include "content/public/browser/notification_service.h"
20 #include "ui/gfx/size.h"
21
22 #if defined(OS_CHROMEOS)
23 #include "chrome/browser/chromeos/login/screen_locker.h"
24 #include "chrome/browser/chromeos/login/screen_locker_tester.h"
25 #include "chrome/browser/chromeos/login/user_manager.h"
26 #endif
27
28 typedef InProcessBrowserTest StatusAreaHostAuraTest;
29
30 IN_PROC_BROWSER_TEST_F(StatusAreaHostAuraTest, TextStyle) {
31 ChromeShellDelegate* delegate = static_cast<ChromeShellDelegate*>(
32 ash::Shell::GetInstance()->delegate());
33 StatusAreaHostAura* host = delegate->status_area_host();
34
35 #if defined(OS_CHROMEOS)
36 ASSERT_FALSE(chromeos::UserManager::Get()->user_is_logged_in());
37 if (chromeos::system::runtime_environment::IsRunningOnChromeOS()) {
38 EXPECT_EQ(StatusAreaButton::GRAY_PLAIN_LIGHT,
39 host->GetStatusAreaTextStyle());
40 EXPECT_EQ(StatusAreaHostAura::GetCompactModeLoginAndLockOffset().ToString(),
41 ash::Shell::GetInstance()->compact_status_area_offset().
42 ToString());
43 } else {
44 EXPECT_EQ(StatusAreaButton::WHITE_HALOED_BOLD,
45 host->GetStatusAreaTextStyle());
46 EXPECT_EQ(StatusAreaHostAura::GetCompactModeBrowserOffset().ToString(),
47 ash::Shell::GetInstance()->compact_status_area_offset().
48 ToString());
49 }
50
51 // ProfileManager expects a profile dir to be set on Chrome OS.
52 CommandLine::ForCurrentProcess()->AppendSwitchNative(
53 switches::kLoginProfile, "StatusAreaHostAuraTest");
54 chromeos::UserManager::Get()->UserLoggedIn("foo@example.com");
55 ASSERT_TRUE(chromeos::UserManager::Get()->user_is_logged_in());
56 #endif
57
58 Browser* browser = CreateBrowser(ProfileManager::GetDefaultProfile());
59
60 if (ash::Shell::GetInstance()->IsWindowModeCompact()) {
61 EXPECT_EQ(StatusAreaButton::GRAY_EMBOSSED_BOLD,
62 host->GetStatusAreaTextStyle());
63
64 Browser* incognito_browser = CreateIncognitoBrowser();
65 EXPECT_EQ(StatusAreaButton::WHITE_PLAIN_BOLD,
66 host->GetStatusAreaTextStyle());
67
68 incognito_browser->CloseWindow();
69 EXPECT_EQ(StatusAreaButton::GRAY_EMBOSSED_BOLD,
70 host->GetStatusAreaTextStyle());
71 } else {
72 EXPECT_EQ(StatusAreaButton::WHITE_HALOED_BOLD,
73 host->GetStatusAreaTextStyle());
74 }
75
76 EXPECT_EQ(StatusAreaHostAura::GetCompactModeBrowserOffset().ToString(),
77 ash::Shell::GetInstance()->compact_status_area_offset().ToString());
78
79 #if defined(OS_CHROMEOS)
80 // Lock the screen.
81 chromeos::ScreenLocker::Show();
82 scoped_ptr<chromeos::test::ScreenLockerTester> tester(
83 chromeos::ScreenLocker::GetTester());
84 tester->EmulateWindowManagerReady();
85 ui_test_utils::WindowedNotificationObserver lock_state_observer(
86 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
87 content::NotificationService::AllSources());
88 if (!tester->IsLocked())
89 lock_state_observer.Wait();
90 ASSERT_TRUE(tester->IsLocked());
91 EXPECT_EQ(StatusAreaButton::GRAY_PLAIN_LIGHT, host->GetStatusAreaTextStyle());
92 EXPECT_EQ(StatusAreaHostAura::GetCompactModeLoginAndLockOffset().ToString(),
93 ash::Shell::GetInstance()->compact_status_area_offset().ToString());
94
95 chromeos::ScreenLocker::Hide();
96 ui_test_utils::RunAllPendingInMessageLoop();
97 ASSERT_FALSE(tester->IsLocked());
98
99 if (ash::Shell::GetInstance()->IsWindowModeCompact()) {
100 EXPECT_EQ(StatusAreaButton::GRAY_EMBOSSED_BOLD,
101 host->GetStatusAreaTextStyle());
102 } else {
103 EXPECT_EQ(StatusAreaButton::WHITE_HALOED_BOLD,
104 host->GetStatusAreaTextStyle());
105 }
106 EXPECT_EQ(StatusAreaHostAura::GetCompactModeBrowserOffset().ToString(),
107 ash::Shell::GetInstance()->compact_status_area_offset().ToString());
108 #endif
109
110 browser->CloseWindow();
111 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/aura/status_area_host_aura.cc ('k') | chrome/browser/ui/views/aura/volume_controller_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698