| 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/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 // The initial tab index should be 0. | 142 // The initial tab index should be 0. |
| 143 ASSERT_EQ(0, browser()->active_index()); | 143 ASSERT_EQ(0, browser()->active_index()); |
| 144 | 144 |
| 145 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 145 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| 146 | 146 |
| 147 // Get the focused view ID, then press a key to activate the | 147 // Get the focused view ID, then press a key to activate the |
| 148 // page menu, then wait until the focused view changes. | 148 // page menu, then wait until the focused view changes. |
| 149 int original_view_id = GetFocusedViewID(); | 149 int original_view_id = GetFocusedViewID(); |
| 150 | 150 |
| 151 ui_test_utils::WindowedNotificationObserver new_tab_observer( | 151 content::WindowedNotificationObserver new_tab_observer( |
| 152 chrome::NOTIFICATION_TAB_ADDED, | 152 chrome::NOTIFICATION_TAB_ADDED, |
| 153 content::Source<content::WebContentsDelegate>(browser())); | 153 content::Source<content::WebContentsDelegate>(browser())); |
| 154 | 154 |
| 155 BrowserView* browser_view = reinterpret_cast<BrowserView*>( | 155 BrowserView* browser_view = reinterpret_cast<BrowserView*>( |
| 156 browser()->window()); | 156 browser()->window()); |
| 157 ToolbarView* toolbar_view = browser_view->GetToolbarView(); | 157 ToolbarView* toolbar_view = browser_view->GetToolbarView(); |
| 158 SendKeysMenuListener menu_listener(toolbar_view, browser()); | 158 SendKeysMenuListener menu_listener(toolbar_view, browser()); |
| 159 | 159 |
| 160 #if defined(OS_CHROMEOS) | 160 #if defined(OS_CHROMEOS) |
| 161 // Chrome OS doesn't have a way to just focus the wrench menu, so we use Alt+F | 161 // Chrome OS doesn't have a way to just focus the wrench menu, so we use Alt+F |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 browser(), url, NEW_FOREGROUND_TAB, | 255 browser(), url, NEW_FOREGROUND_TAB, |
| 256 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 256 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 257 ASSERT_EQ(2, browser()->active_index()); | 257 ASSERT_EQ(2, browser()->active_index()); |
| 258 | 258 |
| 259 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 259 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| 260 browser(), ui::VKEY_W, true, false, false, false)); | 260 browser(), ui::VKEY_W, true, false, false, false)); |
| 261 ASSERT_EQ(0, browser()->active_index()); | 261 ASSERT_EQ(0, browser()->active_index()); |
| 262 } | 262 } |
| 263 | 263 |
| 264 } // namespace | 264 } // namespace |
| OLD | NEW |