Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: chrome/browser/ui/views/keyboard_access_browsertest.cc

Issue 246633004: Remove non USE_AURA code from views files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Just revert changes to ui/app_list/. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 ViewFocusChangeWaiter waiter(focus_manager, original_view_id); 162 ViewFocusChangeWaiter waiter(focus_manager, original_view_id);
163 waiter.Wait(); 163 waiter.Wait();
164 } 164 }
165 165
166 #if defined(OS_WIN) 166 #if defined(OS_WIN)
167 // Opens the system menu on Windows with the Alt Space combination and selects 167 // Opens the system menu on Windows with the Alt Space combination and selects
168 // the New Tab option from the menu. 168 // the New Tab option from the menu.
169 void TestSystemMenuWithKeyboard(); 169 void TestSystemMenuWithKeyboard();
170 #endif 170 #endif
171 171
172 #if defined(USE_AURA)
173 // Uses the keyboard to select the wrench menu i.e. with the F10 key. 172 // Uses the keyboard to select the wrench menu i.e. with the F10 key.
174 // It verifies that the menu when dismissed by sending the ESC key it does 173 // It verifies that the menu when dismissed by sending the ESC key it does
175 // not display twice. 174 // not display twice.
176 void TestMenuKeyboardAccessAndDismiss(); 175 void TestMenuKeyboardAccessAndDismiss();
177 #endif
178 176
179 DISALLOW_COPY_AND_ASSIGN(KeyboardAccessTest); 177 DISALLOW_COPY_AND_ASSIGN(KeyboardAccessTest);
180 }; 178 };
181 179
182 void KeyboardAccessTest::TestMenuKeyboardAccess(bool alternate_key_sequence, 180 void KeyboardAccessTest::TestMenuKeyboardAccess(bool alternate_key_sequence,
183 bool shift, 181 bool shift,
184 bool focus_omnibox) { 182 bool focus_omnibox) {
185 // Navigate to a page in the first tab, which makes sure that focus is 183 // Navigate to a page in the first tab, which makes sure that focus is
186 // set to the browser window. 184 // set to the browser window.
187 ui_test_utils::NavigateToURL(browser(), GURL("about:")); 185 ui_test_utils::NavigateToURL(browser(), GURL("about:"));
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 if (ret) { 293 if (ret) {
296 // Wait for the new tab to appear. 294 // Wait for the new tab to appear.
297 new_tab_observer.Wait(); 295 new_tab_observer.Wait();
298 // Make sure that the new tab index is 1. 296 // Make sure that the new tab index is 1.
299 ASSERT_EQ(1, browser()->tab_strip_model()->active_index()); 297 ASSERT_EQ(1, browser()->tab_strip_model()->active_index());
300 } 298 }
301 ::UnhookWindowsHookEx(cbt_hook); 299 ::UnhookWindowsHookEx(cbt_hook);
302 } 300 }
303 #endif 301 #endif
304 302
305 #if defined(USE_AURA)
306 void KeyboardAccessTest::TestMenuKeyboardAccessAndDismiss() { 303 void KeyboardAccessTest::TestMenuKeyboardAccessAndDismiss() {
307 ui_test_utils::NavigateToURL(browser(), GURL("about:")); 304 ui_test_utils::NavigateToURL(browser(), GURL("about:"));
308 305
309 ASSERT_EQ(0, browser()->tab_strip_model()->active_index()); 306 ASSERT_EQ(0, browser()->tab_strip_model()->active_index());
310 307
311 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 308 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
312 309
313 int original_view_id = GetFocusedViewID(); 310 int original_view_id = GetFocusedViewID();
314 311
315 BrowserView* browser_view = reinterpret_cast<BrowserView*>( 312 BrowserView* browser_view = reinterpret_cast<BrowserView*>(
316 browser()->window()); 313 browser()->window());
317 ToolbarView* toolbar_view = browser_view->GetToolbarView(); 314 ToolbarView* toolbar_view = browser_view->GetToolbarView();
318 SendKeysMenuListener menu_listener(toolbar_view, browser(), true); 315 SendKeysMenuListener menu_listener(toolbar_view, browser(), true);
319 316
320 browser()->window()->GetLocationBar()->FocusLocation(false); 317 browser()->window()->GetLocationBar()->FocusLocation(false);
321 318
322 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( 319 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
323 browser(), ui::VKEY_F10, false, false, false, false)); 320 browser(), ui::VKEY_F10, false, false, false, false));
324 321
325 WaitForFocusedViewIDToChange(original_view_id); 322 WaitForFocusedViewIDToChange(original_view_id);
326 323
327 SendKeyPress(browser(), ui::VKEY_DOWN); 324 SendKeyPress(browser(), ui::VKEY_DOWN);
328 content::RunMessageLoop(); 325 content::RunMessageLoop();
329 ASSERT_EQ(1, menu_listener.menu_open_count()); 326 ASSERT_EQ(1, menu_listener.menu_open_count());
330 } 327 }
331 #endif
332 328
333 // http://crbug.com/62310. 329 // http://crbug.com/62310.
334 #if defined(OS_CHROMEOS) 330 #if defined(OS_CHROMEOS)
335 #define MAYBE_TestMenuKeyboardAccess DISABLED_TestMenuKeyboardAccess 331 #define MAYBE_TestMenuKeyboardAccess DISABLED_TestMenuKeyboardAccess
336 #else 332 #else
337 #define MAYBE_TestMenuKeyboardAccess TestMenuKeyboardAccess 333 #define MAYBE_TestMenuKeyboardAccess TestMenuKeyboardAccess
338 #endif 334 #endif
339 335
340 IN_PROC_BROWSER_TEST_F(KeyboardAccessTest, MAYBE_TestMenuKeyboardAccess) { 336 IN_PROC_BROWSER_TEST_F(KeyboardAccessTest, MAYBE_TestMenuKeyboardAccess) {
341 TestMenuKeyboardAccess(false, false, false); 337 TestMenuKeyboardAccess(false, false, false);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 browser(), ui::VKEY_BROWSER_FORWARD, false, false, false, false)); 432 browser(), ui::VKEY_BROWSER_FORWARD, false, false, false, false));
437 433
438 base::string16 after_forward; 434 base::string16 after_forward;
439 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &after_forward)); 435 ASSERT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &after_forward));
440 436
441 EXPECT_EQ(before_back, after_forward); 437 EXPECT_EQ(before_back, after_forward);
442 } 438 }
443 #endif 439 #endif
444 440
445 } // namespace 441 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698