OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 <string> | 5 #include <string> |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/gfx/rect.h" | 9 #include "base/gfx/rect.h" |
| 10 #include "base/keyboard_codes.h" |
10 #include "chrome/browser/view_ids.h" | 11 #include "chrome/browser/view_ids.h" |
11 #include "chrome/common/chrome_constants.h" | 12 #include "chrome/common/chrome_constants.h" |
12 #include "chrome/test/automation/automation_constants.h" | 13 #include "chrome/test/automation/automation_constants.h" |
13 #include "chrome/test/automation/browser_proxy.h" | 14 #include "chrome/test/automation/browser_proxy.h" |
14 #include "chrome/test/automation/tab_proxy.h" | 15 #include "chrome/test/automation/tab_proxy.h" |
15 #include "chrome/test/automation/window_proxy.h" | 16 #include "chrome/test/automation/window_proxy.h" |
16 #include "chrome/test/ui/ui_test.h" | 17 #include "chrome/test/ui/ui_test.h" |
17 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
18 #include "net/base/net_util.h" | 19 #include "net/base/net_util.h" |
19 #include "views/event.h" | 20 #include "views/event.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 TEST_F(BlockedPopupContainerInteractiveTest, DontBreakOnBlur) { | 243 TEST_F(BlockedPopupContainerInteractiveTest, DontBreakOnBlur) { |
243 NavigateMainTabTo("window_blur_test.html"); | 244 NavigateMainTabTo("window_blur_test.html"); |
244 SimulateClickInCenterOf(window_); | 245 SimulateClickInCenterOf(window_); |
245 | 246 |
246 // Wait for the popup window to open. | 247 // Wait for the popup window to open. |
247 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 1000)); | 248 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 1000)); |
248 | 249 |
249 // We popup shouldn't be closed by the onblur handler. | 250 // We popup shouldn't be closed by the onblur handler. |
250 ASSERT_FALSE(automation()->WaitForWindowCountToBecome(1, 1500)); | 251 ASSERT_FALSE(automation()->WaitForWindowCountToBecome(1, 1500)); |
251 } | 252 } |
| 253 |
| 254 #if !defined(OS_MACOSX) // see BrowserWindowCocoa::GetCommandId |
| 255 // Tests that tab related keyboard accelerators are reserved by the app. |
| 256 |
| 257 class BrowserInteractiveTest : public UITest { |
| 258 }; |
| 259 |
| 260 TEST_F(BrowserInteractiveTest, ReserveKeyboardAccelerators) { |
| 261 const std::string kBadPage = |
| 262 "<html><script>" |
| 263 "document.onkeydown = function() {" |
| 264 " event.preventDefault();" |
| 265 " return false;" |
| 266 "}" |
| 267 "</script></html>"; |
| 268 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 269 browser->AppendTab(GURL("data:text/html," + kBadPage)); |
| 270 int tab_count = 0; |
| 271 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
| 272 ASSERT_EQ(tab_count, 2); |
| 273 |
| 274 int active_tab = 0; |
| 275 ASSERT_TRUE(browser->GetActiveTabIndex(&active_tab)); |
| 276 ASSERT_EQ(active_tab, 1); |
| 277 |
| 278 scoped_refptr<WindowProxy> window(browser->GetWindow()); |
| 279 ASSERT_TRUE(window->SimulateOSKeyPress( |
| 280 base::VKEY_TAB, views::Event::EF_CONTROL_DOWN)); |
| 281 ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, action_max_timeout_ms())); |
| 282 |
| 283 ASSERT_TRUE(browser->ActivateTab(1)); |
| 284 ASSERT_TRUE(window->SimulateOSKeyPress( |
| 285 base::VKEY_W, views::Event::EF_CONTROL_DOWN)); |
| 286 ASSERT_TRUE(browser->WaitForTabCountToBecome(1, action_max_timeout_ms())); |
| 287 } |
| 288 #endif |
OLD | NEW |