OLD | NEW |
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 // This functionality currently works on Windows and on Linux when | 5 // This functionality currently works on Windows and on Linux when |
6 // toolkit_views is defined (i.e. for Chrome OS). It's not needed | 6 // toolkit_views is defined (i.e. for Chrome OS). It's not needed |
7 // on the Mac, and it's not yet implemented on Linux. | 7 // on the Mac, and it's not yet implemented on Linux. |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 IN_PROC_BROWSER_TEST_F(KeyboardAccessTest, ReserveKeyboardAccelerators) { | 392 IN_PROC_BROWSER_TEST_F(KeyboardAccessTest, ReserveKeyboardAccelerators) { |
393 const std::string kBadPage = | 393 const std::string kBadPage = |
394 "<html><script>" | 394 "<html><script>" |
395 "document.onkeydown = function() {" | 395 "document.onkeydown = function() {" |
396 " event.preventDefault();" | 396 " event.preventDefault();" |
397 " return false;" | 397 " return false;" |
398 "}" | 398 "}" |
399 "</script></html>"; | 399 "</script></html>"; |
400 GURL url("data:text/html," + kBadPage); | 400 GURL url("data:text/html," + kBadPage); |
401 ui_test_utils::NavigateToURLWithDisposition( | 401 ui_test_utils::NavigateToURLWithDisposition( |
402 browser(), url, NEW_FOREGROUND_TAB, | 402 browser(), url, WindowOpenDisposition::NEW_FOREGROUND_TAB, |
403 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 403 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
404 | 404 |
405 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 405 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
406 browser(), ui::VKEY_TAB, true, false, false, false)); | 406 browser(), ui::VKEY_TAB, true, false, false, false)); |
407 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); | 407 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); |
408 | 408 |
409 ui_test_utils::NavigateToURLWithDisposition( | 409 ui_test_utils::NavigateToURLWithDisposition( |
410 browser(), url, NEW_FOREGROUND_TAB, | 410 browser(), url, WindowOpenDisposition::NEW_FOREGROUND_TAB, |
411 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 411 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
412 ASSERT_EQ(2, browser()->tab_strip_model()->active_index()); | 412 ASSERT_EQ(2, browser()->tab_strip_model()->active_index()); |
413 | 413 |
414 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 414 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
415 browser(), ui::VKEY_W, true, false, false, false)); | 415 browser(), ui::VKEY_W, true, false, false, false)); |
416 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); | 416 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); |
417 } | 417 } |
418 | 418 |
419 #if defined(OS_WIN) // These keys are Windows-only. | 419 #if defined(OS_WIN) // These keys are Windows-only. |
420 IN_PROC_BROWSER_TEST_F(KeyboardAccessTest, BackForwardKeys) { | 420 IN_PROC_BROWSER_TEST_F(KeyboardAccessTest, BackForwardKeys) { |
(...skipping 18 matching lines...) Expand all Loading... |
439 browser(), ui::VKEY_BROWSER_FORWARD, false, false, false, false)); | 439 browser(), ui::VKEY_BROWSER_FORWARD, false, false, false, false)); |
440 | 440 |
441 base::string16 after_forward; | 441 base::string16 after_forward; |
442 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &after_forward)); | 442 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &after_forward)); |
443 | 443 |
444 EXPECT_EQ(before_back, after_forward); | 444 EXPECT_EQ(before_back, after_forward); |
445 } | 445 } |
446 #endif | 446 #endif |
447 | 447 |
448 } // namespace | 448 } // namespace |
OLD | NEW |