| OLD | NEW |
| 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 "base/keyboard_codes.h" | 5 #include "base/keyboard_codes.h" |
| 6 #include "chrome/browser/wrench_menu_model.h" | 6 #include "chrome/browser/wrench_menu_model.h" |
| 7 #include "chrome/test/automation/browser_proxy.h" | 7 #include "chrome/test/automation/browser_proxy.h" |
| 8 #include "chrome/test/automation/tab_proxy.h" | 8 #include "chrome/test/automation/tab_proxy.h" |
| 9 #include "chrome/test/automation/window_proxy.h" | 9 #include "chrome/test/automation/window_proxy.h" |
| 10 #include "chrome/test/ui/ui_test.h" | 10 #include "chrome/test/ui/ui_test.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // The initial tab index should be 0. | 52 // The initial tab index should be 0. |
| 53 int tab_index = -1; | 53 int tab_index = -1; |
| 54 ASSERT_TRUE(browser->GetActiveTabIndex(&tab_index)); | 54 ASSERT_TRUE(browser->GetActiveTabIndex(&tab_index)); |
| 55 ASSERT_EQ(0, tab_index); | 55 ASSERT_EQ(0, tab_index); |
| 56 | 56 |
| 57 // Get the focused view ID, then press a key to activate the | 57 // Get the focused view ID, then press a key to activate the |
| 58 // page menu, then wait until the focused view changes. | 58 // page menu, then wait until the focused view changes. |
| 59 int original_view_id = -1; | 59 int original_view_id = -1; |
| 60 ASSERT_TRUE(window->GetFocusedViewID(&original_view_id)); | 60 ASSERT_TRUE(window->GetFocusedViewID(&original_view_id)); |
| 61 | 61 |
| 62 if (alternate_key_sequence) | 62 base::KeyboardCode menu_key = |
| 63 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_MENU, 0)); | 63 alternate_key_sequence ? base::VKEY_MENU : base::VKEY_F10; |
| 64 else | 64 #if defined(OS_CHROMEOS) |
| 65 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_F10, 0)); | 65 // Chrome OS has different function key accelerators, so we always use the |
| 66 // menu key there. |
| 67 menu_key = base::VKEY_MENU; |
| 68 #endif |
| 69 ASSERT_TRUE(window->SimulateOSKeyPress(menu_key, 0)); |
| 66 | 70 |
| 67 int new_view_id = -1; | 71 int new_view_id = -1; |
| 68 ASSERT_TRUE(window->WaitForFocusedViewIDToChange( | 72 ASSERT_TRUE(window->WaitForFocusedViewIDToChange( |
| 69 original_view_id, &new_view_id)); | 73 original_view_id, &new_view_id)); |
| 70 | 74 |
| 71 ASSERT_TRUE(browser->StartTrackingPopupMenus()); | 75 ASSERT_TRUE(browser->StartTrackingPopupMenus()); |
| 72 | 76 |
| 73 if (!WrenchMenuModel::IsEnabled()) { | 77 if (!WrenchMenuModel::IsEnabled()) { |
| 74 // Press RIGHT to focus the app menu, then RETURN or DOWN to open it. | 78 // Press RIGHT to focus the app menu, then RETURN or DOWN to open it. |
| 75 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_RIGHT, 0)); | 79 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_RIGHT, 0)); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 98 TestMenuKeyboardAccess(false); | 102 TestMenuKeyboardAccess(false); |
| 99 } | 103 } |
| 100 | 104 |
| 101 TEST_F(KeyboardAccessTest, TestAltMenuKeyboardAccess) { | 105 TEST_F(KeyboardAccessTest, TestAltMenuKeyboardAccess) { |
| 102 TestMenuKeyboardAccess(true); | 106 TestMenuKeyboardAccess(true); |
| 103 } | 107 } |
| 104 | 108 |
| 105 } // namespace | 109 } // namespace |
| 106 | 110 |
| 107 #endif // defined(TOOLKIT_VIEWS) | 111 #endif // defined(TOOLKIT_VIEWS) |
| OLD | NEW |