| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This functionality currently works on Windows and on Linux when | 5 // This functionality currently works on Windows and on Linux when |
| 6 // toolkit_views is defined (i.e. for Chrome OS). It's not needed | 6 // toolkit_views is defined (i.e. for Chrome OS). It's not needed |
| 7 // on the Mac, and it's not yet implemented on Linux. | 7 // on the Mac, and it's not yet implemented on Linux. |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // Get the focused view ID, then press a key to activate the | 198 // Get the focused view ID, then press a key to activate the |
| 199 // page menu, then wait until the focused view changes. | 199 // page menu, then wait until the focused view changes. |
| 200 int original_view_id = GetFocusedViewID(); | 200 int original_view_id = GetFocusedViewID(); |
| 201 | 201 |
| 202 content::WindowedNotificationObserver new_tab_observer( | 202 content::WindowedNotificationObserver new_tab_observer( |
| 203 chrome::NOTIFICATION_TAB_ADDED, | 203 chrome::NOTIFICATION_TAB_ADDED, |
| 204 content::Source<content::WebContentsDelegate>(browser())); | 204 content::Source<content::WebContentsDelegate>(browser())); |
| 205 | 205 |
| 206 BrowserView* browser_view = reinterpret_cast<BrowserView*>( | 206 BrowserView* browser_view = reinterpret_cast<BrowserView*>( |
| 207 browser()->window()); | 207 browser()->window()); |
| 208 SendKeysMenuListener menu_listener( | 208 SendKeysMenuListener menu_listener(browser_view->toolbar()->app_menu_button(), |
| 209 browser_view->GetToolbarView()->app_menu_button(), browser(), false); | 209 browser(), false); |
| 210 | 210 |
| 211 if (focus_omnibox) | 211 if (focus_omnibox) |
| 212 browser()->window()->GetLocationBar()->FocusLocation(false); | 212 browser()->window()->GetLocationBar()->FocusLocation(false); |
| 213 | 213 |
| 214 #if defined(OS_CHROMEOS) | 214 #if defined(OS_CHROMEOS) |
| 215 // Chrome OS doesn't have a way to just focus the app menu, so we use Alt+F to | 215 // Chrome OS doesn't have a way to just focus the app menu, so we use Alt+F to |
| 216 // bring up the menu. | 216 // bring up the menu. |
| 217 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 217 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| 218 browser(), ui::VKEY_F, false, shift, true, false)); | 218 browser(), ui::VKEY_F, false, shift, true, false)); |
| 219 #else | 219 #else |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 ui_test_utils::NavigateToURL(browser(), GURL("about:")); | 310 ui_test_utils::NavigateToURL(browser(), GURL("about:")); |
| 311 | 311 |
| 312 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); | 312 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); |
| 313 | 313 |
| 314 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 314 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| 315 | 315 |
| 316 int original_view_id = GetFocusedViewID(); | 316 int original_view_id = GetFocusedViewID(); |
| 317 | 317 |
| 318 BrowserView* browser_view = reinterpret_cast<BrowserView*>( | 318 BrowserView* browser_view = reinterpret_cast<BrowserView*>( |
| 319 browser()->window()); | 319 browser()->window()); |
| 320 SendKeysMenuListener menu_listener( | 320 SendKeysMenuListener menu_listener(browser_view->toolbar()->app_menu_button(), |
| 321 browser_view->GetToolbarView()->app_menu_button(), browser(), true); | 321 browser(), true); |
| 322 | 322 |
| 323 browser()->window()->GetLocationBar()->FocusLocation(false); | 323 browser()->window()->GetLocationBar()->FocusLocation(false); |
| 324 | 324 |
| 325 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 325 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| 326 browser(), ui::VKEY_F10, false, false, false, false)); | 326 browser(), ui::VKEY_F10, false, false, false, false)); |
| 327 | 327 |
| 328 WaitForFocusedViewIDToChange(original_view_id); | 328 WaitForFocusedViewIDToChange(original_view_id); |
| 329 | 329 |
| 330 SendKeyPress(browser(), ui::VKEY_DOWN); | 330 SendKeyPress(browser(), ui::VKEY_DOWN); |
| 331 content::RunMessageLoop(); | 331 content::RunMessageLoop(); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 browser(), ui::VKEY_BROWSER_FORWARD, false, false, false, false)); | 439 browser(), ui::VKEY_BROWSER_FORWARD, false, false, false, false)); |
| 440 | 440 |
| 441 base::string16 after_forward; | 441 base::string16 after_forward; |
| 442 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &after_forward)); | 442 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &after_forward)); |
| 443 | 443 |
| 444 EXPECT_EQ(before_back, after_forward); | 444 EXPECT_EQ(before_back, after_forward); |
| 445 } | 445 } |
| 446 #endif | 446 #endif |
| 447 | 447 |
| 448 } // namespace | 448 } // namespace |
| OLD | NEW |