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

Side by Side Diff: chrome/browser/chromeos/login/login_browsertest.cc

Issue 11364003: Fix the issue of cursor being shown at startup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add tests Created 8 years, 1 month 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
« no previous file with comments | « ash/shell.cc ('k') | chrome/browser/ui/ash/ash_init.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
6 #include "ash/wm/cursor_manager.h"
5 #include "base/command_line.h" 7 #include "base/command_line.h"
6 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" 8 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h"
7 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" 9 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h"
8 #include "chrome/browser/chromeos/cros/mock_network_library.h" 10 #include "chrome/browser/chromeos/cros/mock_network_library.h"
11 #include "chrome/browser/chromeos/login/login_wizard.h"
12 #include "chrome/browser/chromeos/login/wizard_controller.h"
9 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
10 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
11 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
12 #include "chrome/test/base/in_process_browser_test.h" 16 #include "chrome/test/base/in_process_browser_test.h"
13 #include "chrome/test/base/ui_test_utils.h" 17 #include "chrome/test/base/ui_test_utils.h"
14 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
16 20
17 using ::testing::_; 21 using ::testing::_;
18 using ::testing::AnyNumber; 22 using ::testing::AnyNumber;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 class LoginGuestTest : public LoginTestBase { 71 class LoginGuestTest : public LoginTestBase {
68 protected: 72 protected:
69 virtual void SetUpCommandLine(CommandLine* command_line) { 73 virtual void SetUpCommandLine(CommandLine* command_line) {
70 command_line->AppendSwitch(switches::kGuestSession); 74 command_line->AppendSwitch(switches::kGuestSession);
71 command_line->AppendSwitch(switches::kIncognito); 75 command_line->AppendSwitch(switches::kIncognito);
72 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); 76 command_line->AppendSwitchASCII(switches::kLoginProfile, "user");
73 command_line->AppendSwitch(switches::kNoFirstRun); 77 command_line->AppendSwitch(switches::kNoFirstRun);
74 } 78 }
75 }; 79 };
76 80
81 class LoginCursorTest : public LoginTestBase {
82 protected:
83 virtual void SetUpCommandLine(CommandLine* command_line) {
84 command_line->AppendSwitch(switches::kLoginManager);
85 }
86 };
87
77 // After a chrome crash, the session manager will restart chrome with 88 // After a chrome crash, the session manager will restart chrome with
78 // the -login-user flag indicating that the user is already logged in. 89 // the -login-user flag indicating that the user is already logged in.
79 // This profile should NOT be an OTR profile. 90 // This profile should NOT be an OTR profile.
80 IN_PROC_BROWSER_TEST_F(LoginUserTest, UserPassed) { 91 IN_PROC_BROWSER_TEST_F(LoginUserTest, UserPassed) {
81 Profile* profile = browser()->profile(); 92 Profile* profile = browser()->profile();
82 EXPECT_EQ("user", profile->GetPath().BaseName().value()); 93 EXPECT_EQ("user", profile->GetPath().BaseName().value());
83 EXPECT_FALSE(profile->IsOffTheRecord()); 94 EXPECT_FALSE(profile->IsOffTheRecord());
84 } 95 }
85 96
97 // Verifies the cursor is not hidden at startup when user is logged in.
98 IN_PROC_BROWSER_TEST_F(LoginUserTest, CursorShown) {
99 EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->cursor_visible());
100 }
101
86 // After a guest login, we should get the OTR default profile. 102 // After a guest login, we should get the OTR default profile.
87 IN_PROC_BROWSER_TEST_F(LoginGuestTest, GuestIsOTR) { 103 IN_PROC_BROWSER_TEST_F(LoginGuestTest, GuestIsOTR) {
88 Profile* profile = browser()->profile(); 104 Profile* profile = browser()->profile();
89 EXPECT_EQ("Default", profile->GetPath().BaseName().value()); 105 EXPECT_EQ("Default", profile->GetPath().BaseName().value());
90 EXPECT_TRUE(profile->IsOffTheRecord()); 106 EXPECT_TRUE(profile->IsOffTheRecord());
91 // Ensure there's extension service for this profile. 107 // Ensure there's extension service for this profile.
92 EXPECT_TRUE(profile->GetExtensionService()); 108 EXPECT_TRUE(profile->GetExtensionService());
93 } 109 }
94 110
111 // Verifies the cursor is not hidden at startup when running guest session.
112 IN_PROC_BROWSER_TEST_F(LoginGuestTest, CursorShown) {
113 EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->cursor_visible());
114 }
115
116 // Verifies the cursor is hidden at startup on login screen.
117 IN_PROC_BROWSER_TEST_F(LoginCursorTest, CursorHidden) {
118 // Login screen needs to be shown explicitly when running test.
119 ShowLoginWizard(WizardController::kLoginScreenName, gfx::Size());
120
121 // Cursor should be hidden at startup
122 EXPECT_FALSE(ash::Shell::GetInstance()->cursor_manager()->cursor_visible());
123
124 // Cursor should be shown after cursor is moved.
125 EXPECT_TRUE(ui_test_utils::SendMouseMoveSync(gfx::Point()));
126 EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->cursor_visible());
127 }
128
95 } // namespace chromeos 129 } // namespace chromeos
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | chrome/browser/ui/ash/ash_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698