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 "base/keyboard_codes.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 NavigateMainTabTo("window_blur_test.html"); | 244 NavigateMainTabTo("window_blur_test.html"); |
245 SimulateClickInCenterOf(window_); | 245 SimulateClickInCenterOf(window_); |
246 | 246 |
247 // Wait for the popup window to open. | 247 // Wait for the popup window to open. |
248 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 1000)); | 248 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2, 1000)); |
249 | 249 |
250 // We popup shouldn't be closed by the onblur handler. | 250 // We popup shouldn't be closed by the onblur handler. |
251 ASSERT_FALSE(automation()->WaitForWindowCountToBecome(1, 1500)); | 251 ASSERT_FALSE(automation()->WaitForWindowCountToBecome(1, 1500)); |
252 } | 252 } |
253 | 253 |
254 #if !defined(OS_MACOSX) // see BrowserWindowCocoa::GetCommandId | |
255 // Tests that tab related keyboard accelerators are reserved by the app. | 254 // Tests that tab related keyboard accelerators are reserved by the app. |
256 | 255 |
257 class BrowserInteractiveTest : public UITest { | 256 class BrowserInteractiveTest : public UITest { |
258 }; | 257 }; |
259 | 258 |
260 TEST_F(BrowserInteractiveTest, ReserveKeyboardAccelerators) { | 259 TEST_F(BrowserInteractiveTest, ReserveKeyboardAccelerators) { |
261 const std::string kBadPage = | 260 const std::string kBadPage = |
262 "<html><script>" | 261 "<html><script>" |
263 "document.onkeydown = function() {" | 262 "document.onkeydown = function() {" |
264 " event.preventDefault();" | 263 " event.preventDefault();" |
265 " return false;" | 264 " return false;" |
266 "}" | 265 "}" |
267 "</script></html>"; | 266 "</script></html>"; |
268 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 267 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
269 browser->AppendTab(GURL("data:text/html," + kBadPage)); | 268 browser->AppendTab(GURL("data:text/html," + kBadPage)); |
270 int tab_count = 0; | 269 int tab_count = 0; |
271 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 270 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
272 ASSERT_EQ(tab_count, 2); | 271 ASSERT_EQ(tab_count, 2); |
273 | 272 |
274 int active_tab = 0; | 273 int active_tab = 0; |
275 ASSERT_TRUE(browser->GetActiveTabIndex(&active_tab)); | 274 ASSERT_TRUE(browser->GetActiveTabIndex(&active_tab)); |
276 ASSERT_EQ(active_tab, 1); | 275 ASSERT_EQ(active_tab, 1); |
277 | 276 |
278 scoped_refptr<WindowProxy> window(browser->GetWindow()); | 277 scoped_refptr<WindowProxy> window(browser->GetWindow()); |
279 ASSERT_TRUE(window->SimulateOSKeyPress( | 278 ASSERT_TRUE(window->SimulateOSKeyPress( |
280 base::VKEY_TAB, views::Event::EF_CONTROL_DOWN)); | 279 base::VKEY_TAB, views::Event::EF_CONTROL_DOWN)); |
281 ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, action_max_timeout_ms())); | 280 ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, action_max_timeout_ms())); |
282 | 281 |
| 282 #if !defined(OS_MACOSX) // see BrowserWindowCocoa::GetCommandId |
283 ASSERT_TRUE(browser->ActivateTab(1)); | 283 ASSERT_TRUE(browser->ActivateTab(1)); |
284 ASSERT_TRUE(window->SimulateOSKeyPress( | 284 ASSERT_TRUE(window->SimulateOSKeyPress( |
285 base::VKEY_W, views::Event::EF_CONTROL_DOWN)); | 285 base::VKEY_W, views::Event::EF_CONTROL_DOWN)); |
286 ASSERT_TRUE(browser->WaitForTabCountToBecome(1, action_max_timeout_ms())); | 286 ASSERT_TRUE(browser->WaitForTabCountToBecome(1, action_max_timeout_ms())); |
| 287 #endif |
287 } | 288 } |
288 #endif | |
OLD | NEW |