| 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/test/automation/browser_proxy.h" | 7 #include "chrome/test/automation/browser_proxy.h" |
| 7 #include "chrome/test/automation/tab_proxy.h" | 8 #include "chrome/test/automation/tab_proxy.h" |
| 8 #include "chrome/test/automation/window_proxy.h" | 9 #include "chrome/test/automation/window_proxy.h" |
| 9 #include "chrome/test/ui/ui_test.h" | 10 #include "chrome/test/ui/ui_test.h" |
| 10 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
| 11 | 12 |
| 12 // This functionality currently works on Windows and on Linux when | 13 // This functionality currently works on Windows and on Linux when |
| 13 // toolkit_views is defined (i.e. for Chrome OS). It's not needed | 14 // toolkit_views is defined (i.e. for Chrome OS). It's not needed |
| 14 // on the Mac, and it's not yet implemented on Linux. | 15 // on the Mac, and it's not yet implemented on Linux. |
| 15 #if defined(TOOLKIT_VIEWS) | 16 #if defined(TOOLKIT_VIEWS) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_MENU, 0)); | 63 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_MENU, 0)); |
| 63 else | 64 else |
| 64 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_F10, 0)); | 65 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_F10, 0)); |
| 65 | 66 |
| 66 int new_view_id = -1; | 67 int new_view_id = -1; |
| 67 ASSERT_TRUE(window->WaitForFocusedViewIDToChange( | 68 ASSERT_TRUE(window->WaitForFocusedViewIDToChange( |
| 68 original_view_id, &new_view_id)); | 69 original_view_id, &new_view_id)); |
| 69 | 70 |
| 70 ASSERT_TRUE(browser->StartTrackingPopupMenus()); | 71 ASSERT_TRUE(browser->StartTrackingPopupMenus()); |
| 71 | 72 |
| 72 // Press RIGHT to focus the app menu, then RETURN or DOWN to open it. | 73 if (!WrenchMenuModel::IsEnabled()) { |
| 73 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_RIGHT, 0)); | 74 // Press RIGHT to focus the app menu, then RETURN or DOWN to open it. |
| 75 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_RIGHT, 0)); |
| 76 } |
| 74 if (alternate_key_sequence) | 77 if (alternate_key_sequence) |
| 75 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_DOWN, 0)); | 78 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_DOWN, 0)); |
| 76 else | 79 else |
| 77 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_RETURN, 0)); | 80 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_RETURN, 0)); |
| 78 | 81 |
| 79 // Wait until the popup menu actually opens. | 82 // Wait until the popup menu actually opens. |
| 80 ASSERT_TRUE(browser->WaitForPopupMenuToOpen()); | 83 ASSERT_TRUE(browser->WaitForPopupMenuToOpen()); |
| 81 | 84 |
| 82 // Press DOWN to select the first item, then RETURN to select it. | 85 // Press DOWN to select the first item, then RETURN to select it. |
| 83 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_DOWN, 0)); | 86 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_DOWN, 0)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 95 TestMenuKeyboardAccess(false); | 98 TestMenuKeyboardAccess(false); |
| 96 } | 99 } |
| 97 | 100 |
| 98 TEST_F(KeyboardAccessTest, TestAltMenuKeyboardAccess) { | 101 TEST_F(KeyboardAccessTest, TestAltMenuKeyboardAccess) { |
| 99 TestMenuKeyboardAccess(true); | 102 TestMenuKeyboardAccess(true); |
| 100 } | 103 } |
| 101 | 104 |
| 102 } // namespace | 105 } // namespace |
| 103 | 106 |
| 104 #endif // defined(TOOLKIT_VIEWS) | 107 #endif // defined(TOOLKIT_VIEWS) |
| OLD | NEW |