| 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/test/automation/browser_proxy.h" | 6 #include "chrome/test/automation/browser_proxy.h" |
| 7 #include "chrome/test/automation/tab_proxy.h" | 7 #include "chrome/test/automation/tab_proxy.h" |
| 8 #include "chrome/test/automation/window_proxy.h" | 8 #include "chrome/test/automation/window_proxy.h" |
| 9 #include "chrome/test/ui/ui_test.h" | 9 #include "chrome/test/ui/ui_test.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 TEST_F(KeyboardAccessTest, ReserveKeyboardAccelerators) { | 105 TEST_F(KeyboardAccessTest, ReserveKeyboardAccelerators) { |
| 106 const std::string kBadPage = | 106 const std::string kBadPage = |
| 107 "<html><script>" | 107 "<html><script>" |
| 108 "document.onkeydown = function() {" | 108 "document.onkeydown = function() {" |
| 109 " event.preventDefault();" | 109 " event.preventDefault();" |
| 110 " return false;" | 110 " return false;" |
| 111 "}" | 111 "}" |
| 112 "</script></html>"; | 112 "</script></html>"; |
| 113 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 113 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 114 ASSERT_TRUE(browser); | 114 ASSERT_TRUE(browser); |
| 115 browser->AppendTab(GURL("data:text/html," + kBadPage)); | 115 ASSERT_TRUE(browser->AppendTab(GURL("data:text/html," + kBadPage))); |
| 116 int tab_count = 0; | 116 int tab_count = 0; |
| 117 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 117 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
| 118 ASSERT_EQ(tab_count, 2); | 118 ASSERT_EQ(tab_count, 2); |
| 119 | 119 |
| 120 int active_tab = 0; | 120 int active_tab = 0; |
| 121 ASSERT_TRUE(browser->GetActiveTabIndex(&active_tab)); | 121 ASSERT_TRUE(browser->GetActiveTabIndex(&active_tab)); |
| 122 ASSERT_EQ(active_tab, 1); | 122 ASSERT_EQ(active_tab, 1); |
| 123 | 123 |
| 124 scoped_refptr<WindowProxy> window(browser->GetWindow()); | 124 scoped_refptr<WindowProxy> window(browser->GetWindow()); |
| 125 ASSERT_TRUE(window); | 125 ASSERT_TRUE(window); |
| 126 ASSERT_TRUE(window->SimulateOSKeyPress( | 126 ASSERT_TRUE(window->SimulateOSKeyPress( |
| 127 base::VKEY_TAB, views::Event::EF_CONTROL_DOWN)); | 127 base::VKEY_TAB, views::Event::EF_CONTROL_DOWN)); |
| 128 ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, action_max_timeout_ms())); | 128 ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, action_max_timeout_ms())); |
| 129 | 129 |
| 130 #if !defined(OS_MACOSX) // see BrowserWindowCocoa::GetCommandId | 130 #if !defined(OS_MACOSX) // see BrowserWindowCocoa::GetCommandId |
| 131 ASSERT_TRUE(browser->ActivateTab(1)); | 131 ASSERT_TRUE(browser->ActivateTab(1)); |
| 132 ASSERT_TRUE(window->SimulateOSKeyPress( | 132 ASSERT_TRUE(window->SimulateOSKeyPress( |
| 133 base::VKEY_F4, views::Event::EF_CONTROL_DOWN)); | 133 base::VKEY_F4, views::Event::EF_CONTROL_DOWN)); |
| 134 ASSERT_TRUE(browser->WaitForTabCountToBecome(1, action_max_timeout_ms())); | 134 ASSERT_TRUE(browser->WaitForTabCountToBecome(1, action_max_timeout_ms())); |
| 135 #endif | 135 #endif |
| 136 } | 136 } |
| 137 | 137 |
| 138 } // namespace | 138 } // namespace |
| 139 | 139 |
| 140 #endif // defined(TOOLKIT_VIEWS) | 140 #endif // defined(TOOLKIT_VIEWS) |
| OLD | NEW |