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

Side by Side Diff: chrome/browser/browser_keyevents_browsertest.cc

Issue 1576008: Enable interactive_ui_tests (Closed)
Patch Set: include Created 10 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/keyboard_codes.h" 8 #include "base/keyboard_codes.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 void GetNativeWindow(gfx::NativeWindow* native_window) { 127 void GetNativeWindow(gfx::NativeWindow* native_window) {
128 BrowserWindow* window = browser()->window(); 128 BrowserWindow* window = browser()->window();
129 ASSERT_TRUE(window); 129 ASSERT_TRUE(window);
130 *native_window = window->GetNativeHandle(); 130 *native_window = window->GetNativeHandle();
131 ASSERT_TRUE(*native_window); 131 ASSERT_TRUE(*native_window);
132 } 132 }
133 133
134 void SendKey(base::KeyboardCode key, bool control, bool shift, bool alt) { 134 void SendKey(base::KeyboardCode key, bool control, bool shift, bool alt) {
135 gfx::NativeWindow window = NULL; 135 gfx::NativeWindow window = NULL;
136 ASSERT_NO_FATAL_FAILURE(GetNativeWindow(&window)); 136 ASSERT_NO_FATAL_FAILURE(GetNativeWindow(&window));
137 ui_controls::SendKeyPressNotifyWhenDone(window, key, control, shift, alt, 137 EXPECT_TRUE(ui_controls::SendKeyPressNotifyWhenDone(
138 new MessageLoop::QuitTask()); 138 window, key, control, shift, alt, new MessageLoop::QuitTask()));
139 ui_test_utils::RunMessageLoop(); 139 ui_test_utils::RunMessageLoop();
140 } 140 }
141 141
142 bool IsViewFocused(ViewID vid) { 142 bool IsViewFocused(ViewID vid) {
143 return ui_test_utils::IsViewFocused(browser(), vid); 143 return ui_test_utils::IsViewFocused(browser(), vid);
144 } 144 }
145 145
146 void ClickOnView(ViewID vid) { 146 void ClickOnView(ViewID vid) {
147 ui_test_utils::ClickOnView(browser(), vid); 147 ui_test_utils::ClickOnView(browser(), vid);
148 } 148 }
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 440
441 // Press Ctrl+F with keydown suppressed shall not open the find box. 441 // Press Ctrl+F with keydown suppressed shall not open the find box.
442 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlFSuppressKeyDown)); 442 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlFSuppressKeyDown));
443 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 443 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
444 444
445 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlZ)); 445 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlZ));
446 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlZSuppressKeyDown)); 446 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlZSuppressKeyDown));
447 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlEnter)); 447 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlEnter));
448 } 448 }
449 449
450 IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, AccessKeys) { 450 #if defined(OS_CHROMEOS)
451 // See http://crbug.com/40037 for details.
452 #define MAYBE_AccessKeys DISABLED_AccessKeys
453 #else
454 #define MAYBE_AccessKeys AccessKeys
455 #endif
456
457 IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_AccessKeys) {
451 static const KeyEventTestData kTestAltA = { 458 static const KeyEventTestData kTestAltA = {
452 base::VKEY_A, false, false, true, 459 base::VKEY_A, false, false, true,
453 false, false, false, false, 4, 460 false, false, false, false, 4,
454 { "D 18 0 false false true", 461 { "D 18 0 false false true",
455 "D 65 0 false false true", 462 "D 65 0 false false true",
456 "U 65 0 false false true", 463 "U 65 0 false false true",
457 "U 18 0 false false true" } 464 "U 18 0 false false true" }
458 }; 465 };
459 466
460 static const KeyEventTestData kTestAltD = { 467 static const KeyEventTestData kTestAltD = {
(...skipping 19 matching lines...) Expand all
480 "D 49 0 false false true", 487 "D 49 0 false false true",
481 "U 49 0 false false true", 488 "U 49 0 false false true",
482 "U 18 0 false false true" } 489 "U 18 0 false false true" }
483 }; 490 };
484 491
485 HTTPTestServer* server = StartHTTPServer(); 492 HTTPTestServer* server = StartHTTPServer();
486 493
487 GURL url = server->TestServerPageW(kTestingPage); 494 GURL url = server->TestServerPageW(kTestingPage);
488 ui_test_utils::NavigateToURL(browser(), url); 495 ui_test_utils::NavigateToURL(browser(), url);
489 496
497 ui_test_utils::RunAllPendingInMessageLoop();
490 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); 498 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
491 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 499 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
492 500
493 int tab_index = browser()->selected_index(); 501 int tab_index = browser()->selected_index();
494 // Make sure no element is focused. 502 // Make sure no element is focused.
495 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"")); 503 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L""));
496 // Alt+A should focus the element with accesskey = "A". 504 // Alt+A should focus the element with accesskey = "A".
497 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltA)); 505 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltA));
498 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"A")); 506 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"A"));
499 507
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 ASSERT_EQ(0, browser()->selected_index()); 641 ASSERT_EQ(0, browser()->selected_index());
634 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(0, kTestCtrlWBlocked)); 642 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(0, kTestCtrlWBlocked));
635 ASSERT_EQ(2, browser()->tab_count()); 643 ASSERT_EQ(2, browser()->tab_count());
636 644
637 // Ctrl+F4 to close the tab. 645 // Ctrl+F4 to close the tab.
638 ASSERT_NO_FATAL_FAILURE(SuppressAllEvents(0, true)); 646 ASSERT_NO_FATAL_FAILURE(SuppressAllEvents(0, true));
639 ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_F4, true, false, false)); 647 ASSERT_NO_FATAL_FAILURE(SendKey(base::VKEY_F4, true, false, false));
640 ASSERT_EQ(1, browser()->tab_count()); 648 ASSERT_EQ(1, browser()->tab_count());
641 #endif 649 #endif
642 } 650 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_focus_uitest.cc ('k') | chrome/browser/views/find_bar_host_interactive_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698