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

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

Issue 2862006: Added browser test for accelerators on wizard screen.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 6 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
« no previous file with comments | « no previous file | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/l10n_util.h" 5 #include "app/l10n_util.h"
6 #include "chrome/browser/browser_process.h" 6 #include "chrome/browser/browser_process.h"
7 #include "chrome/browser/chromeos/login/account_screen.h" 7 #include "chrome/browser/chromeos/login/account_screen.h"
8 #include "chrome/browser/chromeos/login/language_switch_model.h" 8 #include "chrome/browser/chromeos/login/language_switch_model.h"
9 #include "chrome/browser/chromeos/login/login_screen.h" 9 #include "chrome/browser/chromeos/login/login_screen.h"
10 #include "chrome/browser/chromeos/login/mock_update_screen.h" 10 #include "chrome/browser/chromeos/login/mock_update_screen.h"
11 #include "chrome/browser/chromeos/login/network_screen.h" 11 #include "chrome/browser/chromeos/login/network_screen.h"
12 #include "chrome/browser/chromeos/login/network_selection_view.h" 12 #include "chrome/browser/chromeos/login/network_selection_view.h"
13 #include "chrome/browser/chromeos/login/user_image_screen.h"
13 #include "chrome/browser/chromeos/login/wizard_controller.h" 14 #include "chrome/browser/chromeos/login/wizard_controller.h"
14 #include "chrome/browser/chromeos/login/wizard_in_process_browser_test.h" 15 #include "chrome/browser/chromeos/login/wizard_in_process_browser_test.h"
15 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/notification_service.h" 17 #include "chrome/common/notification_service.h"
17 #include "chrome/test/ui_test_utils.h" 18 #include "chrome/test/ui_test_utils.h"
18 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
19 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 #include "unicode/locid.h" 22 #include "unicode/locid.h"
23 #include "views/accelerator.h"
22 24
23 namespace { 25 namespace {
24 26
25 template <class T> 27 template <class T>
26 class MockOutShowHide : public T { 28 class MockOutShowHide : public T {
27 public: 29 public:
28 template <class P> MockOutShowHide(P p) : T(p) {} 30 template <class P> MockOutShowHide(P p) : T(p) {}
29 template <class P1, class P2> MockOutShowHide(P1 p1, P2 p2) : T(p1, p2) {} 31 template <class P1, class P2> MockOutShowHide(P1 p1, P2 p2) : T(p1, p2) {}
30 MOCK_METHOD0(Show, void()); 32 MOCK_METHOD0(Show, void());
31 MOCK_METHOD0(Hide, void()); 33 MOCK_METHOD0(Hide, void());
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } 171 }
170 172
171 IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, ControlFlowErrorNetwork) { 173 IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, ControlFlowErrorNetwork) {
172 EXPECT_EQ(controller()->GetNetworkScreen(), controller()->current_screen()); 174 EXPECT_EQ(controller()->GetNetworkScreen(), controller()->current_screen());
173 EXPECT_CALL(*mock_login_screen_, Show()).Times(1); 175 EXPECT_CALL(*mock_login_screen_, Show()).Times(1);
174 EXPECT_CALL(*mock_network_screen_, Hide()).Times(1); 176 EXPECT_CALL(*mock_network_screen_, Hide()).Times(1);
175 controller()->OnExit(chromeos::ScreenObserver::NETWORK_OFFLINE); 177 controller()->OnExit(chromeos::ScreenObserver::NETWORK_OFFLINE);
176 EXPECT_EQ(controller()->GetLoginScreen(), controller()->current_screen()); 178 EXPECT_EQ(controller()->GetLoginScreen(), controller()->current_screen());
177 } 179 }
178 180
181 IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, Accelerators) {
182 EXPECT_EQ(controller()->GetNetworkScreen(), controller()->current_screen());
183
184 views::FocusManager* focus_manager =
185 controller()->contents()->GetFocusManager();
186 views::Accelerator accel_account_screen(base::VKEY_A, false, true, true);
187 views::Accelerator accel_login_screen(base::VKEY_L, false, true, true);
188 views::Accelerator accel_network_screen(base::VKEY_N, false, true, true);
189 views::Accelerator accel_update_screen(base::VKEY_U, false, true, true);
190 views::Accelerator accel_image_screen(base::VKEY_I, false, true, true);
191
192 EXPECT_CALL(*mock_network_screen_, Hide()).Times(1);
193 EXPECT_CALL(*mock_account_screen_, Show()).Times(1);
194 EXPECT_TRUE(focus_manager->ProcessAccelerator(accel_account_screen));
195 EXPECT_EQ(controller()->GetAccountScreen(), controller()->current_screen());
196
197 EXPECT_CALL(*mock_account_screen_, Hide()).Times(1);
198 EXPECT_CALL(*mock_login_screen_, Show()).Times(1);
199 EXPECT_TRUE(focus_manager->ProcessAccelerator(accel_login_screen));
200 EXPECT_EQ(controller()->GetLoginScreen(), controller()->current_screen());
201
202 EXPECT_CALL(*mock_login_screen_, Hide()).Times(1);
203 EXPECT_CALL(*mock_network_screen_, Show()).Times(1);
204 EXPECT_TRUE(focus_manager->ProcessAccelerator(accel_network_screen));
205 EXPECT_EQ(controller()->GetNetworkScreen(), controller()->current_screen());
206
207 EXPECT_CALL(*mock_network_screen_, Hide()).Times(1);
208 EXPECT_CALL(*mock_update_screen_, Show()).Times(1);
209 EXPECT_TRUE(focus_manager->ProcessAccelerator(accel_update_screen));
210 EXPECT_EQ(controller()->GetUpdateScreen(), controller()->current_screen());
211
212 EXPECT_CALL(*mock_update_screen_, Hide()).Times(1);
213 EXPECT_TRUE(focus_manager->ProcessAccelerator(accel_image_screen));
214 EXPECT_EQ(controller()->GetUserImageScreen(), controller()->current_screen());
215 }
216
179 COMPILE_ASSERT(chromeos::ScreenObserver::EXIT_CODES_COUNT == 14, 217 COMPILE_ASSERT(chromeos::ScreenObserver::EXIT_CODES_COUNT == 14,
180 add_tests_for_new_control_flow_you_just_introduced); 218 add_tests_for_new_control_flow_you_just_introduced);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698