Chromium Code Reviews| Index: chrome/browser/chromeos/login/login_browsertest.cc |
| diff --git a/chrome/browser/chromeos/login/login_browsertest.cc b/chrome/browser/chromeos/login/login_browsertest.cc |
| index b61f33d8592c04c88d4a9e2a0ecc19ec67c25388..7644f256ba81a90a18297745f11f975c0dca24c4 100644 |
| --- a/chrome/browser/chromeos/login/login_browsertest.cc |
| +++ b/chrome/browser/chromeos/login/login_browsertest.cc |
| @@ -3,6 +3,7 @@ |
| // found in the LICENSE file. |
| #include "ash/shell.h" |
| +#include "ash/system/tray/system_tray.h" |
| #include "base/command_line.h" |
| #include "base/strings/string_util.h" |
| #include "chrome/browser/chrome_notification_types.h" |
| @@ -144,6 +145,22 @@ class LoginTest : public chromeos::LoginManagerTest { |
| } |
| }; |
| +class LoginManagerTest : public InProcessBrowserTest { |
|
Nikita (slow)
2015/02/13 12:16:17
Please rename this class to something else since L
|
| + protected: |
| + void SetUpCommandLine(base::CommandLine* command_line) override { |
| + command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests); |
|
Nikita (slow)
2015/02/13 12:16:17
As discussed over IM you need both kForceLoginMana
afakhry
2015/02/13 16:59:49
I thought you said having kForceLoginManagerInTest
|
| + } |
| +}; |
| + |
| +// Used to make sure that the system tray is visible and within the screen |
| +// bounds after login. |
| +void TestSystemTrayIsVisible() { |
| + ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); |
| + aura::Window* primary_win = ash::Shell::GetPrimaryRootWindow(); |
| + EXPECT_TRUE(tray->visible()); |
| + EXPECT_TRUE(primary_win->bounds().Contains(tray->GetBoundsInScreen())); |
| +} |
| + |
| // After a chrome crash, the session manager will restart chrome with |
| // the -login-user flag indicating that the user is already logged in. |
| // This profile should NOT be an OTR profile. |
| @@ -153,11 +170,15 @@ IN_PROC_BROWSER_TEST_F(LoginUserTest, UserPassed) { |
| profile_base_path.insert(0, chrome::kProfileDirPrefix); |
| EXPECT_EQ(profile_base_path, profile->GetPath().BaseName().value()); |
| EXPECT_FALSE(profile->IsOffTheRecord()); |
| + |
| + TestSystemTrayIsVisible(); |
| } |
| // Verifies the cursor is not hidden at startup when user is logged in. |
| IN_PROC_BROWSER_TEST_F(LoginUserTest, CursorShown) { |
| EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible()); |
| + |
| + TestSystemTrayIsVisible(); |
| } |
| // After a guest login, we should get the OTR default profile. |
| @@ -166,11 +187,15 @@ IN_PROC_BROWSER_TEST_F(LoginGuestTest, GuestIsOTR) { |
| EXPECT_TRUE(profile->IsOffTheRecord()); |
| // Ensure there's extension service for this profile. |
| EXPECT_TRUE(extensions::ExtensionSystem::Get(profile)->extension_service()); |
| + |
| + TestSystemTrayIsVisible(); |
| } |
| // Verifies the cursor is not hidden at startup when running guest session. |
| IN_PROC_BROWSER_TEST_F(LoginGuestTest, CursorShown) { |
| EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible()); |
| + |
| + TestSystemTrayIsVisible(); |
| } |
| // Verifies the cursor is hidden at startup on login screen. |
| @@ -187,6 +212,8 @@ IN_PROC_BROWSER_TEST_F(LoginCursorTest, CursorHidden) { |
| base::MessageLoop::current()->DeleteSoon( |
| FROM_HERE, chromeos::LoginDisplayHostImpl::default_host()); |
| + |
| + TestSystemTrayIsVisible(); |
| } |
| // Verifies that the webui for login comes up successfully. |
| @@ -223,4 +250,9 @@ IN_PROC_BROWSER_TEST_F(LoginTest, GaiaAuthOffline) { |
| content::NotificationService::AllSources()).Wait(); |
| } |
| +// Verifies that the system tray is visible for login manager. |
| +IN_PROC_BROWSER_TEST_F(LoginManagerTest, SysTrayIsVisible) { |
| + TestSystemTrayIsVisible(); |
| +} |
| + |
| } // namespace |