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

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

Issue 13542003: Add browser test for new user CrOS login flow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
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 "chrome/browser/chrome_browser_main.h" 7 #include "chrome/browser/chrome_browser_main.h"
8 #include "chrome/browser/chrome_browser_main_extra_parts.h" 8 #include "chrome/browser/chrome_browser_main_extra_parts.h"
9 #include "chrome/browser/chrome_content_browser_client.h" 9 #include "chrome/browser/chrome_content_browser_client.h"
10 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" 10 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h"
(...skipping 14 matching lines...) Expand all
25 #include "content/public/browser/notification_registrar.h" 25 #include "content/public/browser/notification_registrar.h"
26 #include "content/public/browser/notification_service.h" 26 #include "content/public/browser/notification_service.h"
27 #include "content/public/test/test_utils.h" 27 #include "content/public/test/test_utils.h"
28 #include "testing/gmock/include/gmock/gmock.h" 28 #include "testing/gmock/include/gmock/gmock.h"
29 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
30 30
31 using ::testing::_; 31 using ::testing::_;
32 using ::testing::AnyNumber; 32 using ::testing::AnyNumber;
33 using ::testing::Return; 33 using ::testing::Return;
34 34
35 namespace chromeos { 35 namespace {
36 36
37 class LoginTestBase : public CrosInProcessBrowserTest { 37 class LoginTestBase : public chromeos::CrosInProcessBrowserTest {
38 public: 38 public:
39 LoginTestBase() 39 LoginTestBase()
40 : mock_cryptohome_library_(NULL), 40 : mock_cryptohome_library_(NULL),
41 mock_network_library_(NULL) { 41 mock_network_library_(NULL) {
42 } 42 }
43 43
44 protected: 44 protected:
45 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 45 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
46 cros_mock_->InitStatusAreaMocks(); 46 cros_mock_->InitStatusAreaMocks();
47 cros_mock_->SetStatusAreaMocksExpectations(); 47 cros_mock_->SetStatusAreaMocksExpectations();
48 cros_mock_->InitMockCryptohomeLibrary(); 48 cros_mock_->InitMockCryptohomeLibrary();
49 mock_cryptohome_library_ = cros_mock_->mock_cryptohome_library(); 49 mock_cryptohome_library_ = cros_mock_->mock_cryptohome_library();
50 mock_network_library_ = cros_mock_->mock_network_library(); 50 mock_network_library_ = cros_mock_->mock_network_library();
51 EXPECT_CALL(*mock_cryptohome_library_, GetSystemSalt()) 51 EXPECT_CALL(*mock_cryptohome_library_, GetSystemSalt())
52 .WillRepeatedly(Return(std::string("stub_system_salt"))); 52 .WillRepeatedly(Return(std::string("stub_system_salt")));
53 EXPECT_CALL(*mock_cryptohome_library_, InstallAttributesIsReady()) 53 EXPECT_CALL(*mock_cryptohome_library_, InstallAttributesIsReady())
54 .WillRepeatedly(Return(false)); 54 .WillRepeatedly(Return(false));
55 EXPECT_CALL(*mock_network_library_, AddUserActionObserver(_)) 55 EXPECT_CALL(*mock_network_library_, AddUserActionObserver(_))
56 .Times(AnyNumber()); 56 .Times(AnyNumber());
57 EXPECT_CALL(*mock_network_library_, LoadOncNetworks(_, _, _, _)) 57 EXPECT_CALL(*mock_network_library_, LoadOncNetworks(_, _, _, _))
58 .WillRepeatedly(Return(true)); 58 .WillRepeatedly(Return(true));
59 } 59 }
60 60
61 MockCryptohomeLibrary* mock_cryptohome_library_; 61 chromeos::MockCryptohomeLibrary* mock_cryptohome_library_;
62 MockNetworkLibrary* mock_network_library_; 62 chromeos::MockNetworkLibrary* mock_network_library_;
63 63
64 private: 64 private:
65 DISALLOW_COPY_AND_ASSIGN(LoginTestBase); 65 DISALLOW_COPY_AND_ASSIGN(LoginTestBase);
66 }; 66 };
67 67
68 class LoginUserTest : public LoginTestBase { 68 class LoginUserTest : public LoginTestBase {
69 protected: 69 protected:
70 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 70 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
71 LoginTestBase::SetUpInProcessBrowserTestFixture(); 71 LoginTestBase::SetUpInProcessBrowserTestFixture();
72 } 72 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 return main_parts; 140 return main_parts;
141 } 141 }
142 142
143 TestBrowserMainExtraParts* browser_main_extra_parts_; 143 TestBrowserMainExtraParts* browser_main_extra_parts_;
144 144
145 private: 145 private:
146 DISALLOW_COPY_AND_ASSIGN(TestContentBrowserClient); 146 DISALLOW_COPY_AND_ASSIGN(TestContentBrowserClient);
147 }; 147 };
148 148
149 149
150 class LoginSigninTest : public CrosInProcessBrowserTest { 150 class LoginSigninTest : public chromeos::CrosInProcessBrowserTest {
151 protected: 151 protected:
152 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 152 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
153 command_line->AppendSwitch(switches::kLoginManager); 153 command_line->AppendSwitch(switches::kLoginManager);
154 command_line->AppendSwitch(switches::kForceLoginManagerInTests); 154 command_line->AppendSwitch(switches::kForceLoginManagerInTests);
155 } 155 }
156 156
157 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 157 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
158 content_browser_client_.reset(new TestContentBrowserClient()); 158 content_browser_client_.reset(new TestContentBrowserClient());
159 original_content_browser_client_ = content::GetContentClient()->browser(); 159 original_content_browser_client_ = content::GetContentClient()->browser();
160 content::GetContentClient()->set_browser_for_testing( 160 content::GetContentClient()->set_browser_for_testing(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 194 }
195 195
196 // Verifies the cursor is not hidden at startup when running guest session. 196 // Verifies the cursor is not hidden at startup when running guest session.
197 IN_PROC_BROWSER_TEST_F(LoginGuestTest, CursorShown) { 197 IN_PROC_BROWSER_TEST_F(LoginGuestTest, CursorShown) {
198 EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible()); 198 EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible());
199 } 199 }
200 200
201 // Verifies the cursor is hidden at startup on login screen. 201 // Verifies the cursor is hidden at startup on login screen.
202 IN_PROC_BROWSER_TEST_F(LoginCursorTest, CursorHidden) { 202 IN_PROC_BROWSER_TEST_F(LoginCursorTest, CursorHidden) {
203 // Login screen needs to be shown explicitly when running test. 203 // Login screen needs to be shown explicitly when running test.
204 ShowLoginWizard(WizardController::kLoginScreenName, gfx::Size()); 204 chromeos::ShowLoginWizard(chromeos::WizardController::kLoginScreenName,
205 gfx::Size());
205 206
206 // Cursor should be hidden at startup 207 // Cursor should be hidden at startup
207 EXPECT_FALSE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible()); 208 EXPECT_FALSE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible());
208 209
209 // Cursor should be shown after cursor is moved. 210 // Cursor should be shown after cursor is moved.
210 EXPECT_TRUE(ui_test_utils::SendMouseMoveSync(gfx::Point())); 211 EXPECT_TRUE(ui_test_utils::SendMouseMoveSync(gfx::Point()));
211 EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible()); 212 EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible());
212 213
213 MessageLoop::current()->DeleteSoon(FROM_HERE, 214 MessageLoop::current()->DeleteSoon(
214 BaseLoginDisplayHost::default_host()); 215 FROM_HERE, chromeos::BaseLoginDisplayHost::default_host());
215 } 216 }
216 217
217 // Verifies that the webui for login comes up successfully. 218 // Verifies that the webui for login comes up successfully.
218 IN_PROC_BROWSER_TEST_F(LoginSigninTest, WebUIVisible) { 219 IN_PROC_BROWSER_TEST_F(LoginSigninTest, WebUIVisible) {
219 scoped_refptr<content::MessageLoopRunner> runner = 220 scoped_refptr<content::MessageLoopRunner> runner =
220 new content::MessageLoopRunner; 221 new content::MessageLoopRunner;
221 content_browser_client_->browser_main_extra_parts_->set_quit_task( 222 content_browser_client_->browser_main_extra_parts_->set_quit_task(
222 runner->QuitClosure()); 223 runner->QuitClosure());
223 runner->Run(); 224 runner->Run();
224 } 225 }
225 226
226 } // namespace chromeos 227 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/oobe_browsertest.cc » ('j') | chrome/chrome_tests.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698