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

Side by Side Diff: chrome/test/interactive_ui/keyboard_access_uitest.cc

Issue 3165064: Move the keyboard files from base/ to app/. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: latest merge Created 10 years, 4 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/keyboard_codes.h" 5 #include "app/keyboard_codes.h"
6 #include "chrome/test/automation/browser_proxy.h" 6 #include "chrome/test/automation/browser_proxy.h"
7 #include "chrome/test/automation/tab_proxy.h" 7 #include "chrome/test/automation/tab_proxy.h"
8 #include "chrome/test/automation/window_proxy.h" 8 #include "chrome/test/automation/window_proxy.h"
9 #include "chrome/test/ui/ui_test.h" 9 #include "chrome/test/ui/ui_test.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
11 #include "views/event.h" 11 #include "views/event.h"
12 12
13 // This functionality currently works on Windows and on Linux when 13 // This functionality currently works on Windows and on Linux when
14 // toolkit_views is defined (i.e. for Chrome OS). It's not needed 14 // toolkit_views is defined (i.e. for Chrome OS). It's not needed
15 // on the Mac, and it's not yet implemented on Linux. 15 // on the Mac, and it's not yet implemented on Linux.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // The initial tab index should be 0. 52 // The initial tab index should be 0.
53 int tab_index = -1; 53 int tab_index = -1;
54 ASSERT_TRUE(browser->GetActiveTabIndex(&tab_index)); 54 ASSERT_TRUE(browser->GetActiveTabIndex(&tab_index));
55 ASSERT_EQ(0, tab_index); 55 ASSERT_EQ(0, tab_index);
56 56
57 // Get the focused view ID, then press a key to activate the 57 // Get the focused view ID, then press a key to activate the
58 // page menu, then wait until the focused view changes. 58 // page menu, then wait until the focused view changes.
59 int original_view_id = -1; 59 int original_view_id = -1;
60 ASSERT_TRUE(window->GetFocusedViewID(&original_view_id)); 60 ASSERT_TRUE(window->GetFocusedViewID(&original_view_id));
61 61
62 base::KeyboardCode menu_key = 62 app::KeyboardCode menu_key =
63 alternate_key_sequence ? base::VKEY_MENU : base::VKEY_F10; 63 alternate_key_sequence ? app::VKEY_MENU : app::VKEY_F10;
64 #if defined(OS_CHROMEOS) 64 #if defined(OS_CHROMEOS)
65 // Chrome OS has different function key accelerators, so we always use the 65 // Chrome OS has different function key accelerators, so we always use the
66 // menu key there. 66 // menu key there.
67 menu_key = base::VKEY_MENU; 67 menu_key = app::VKEY_MENU;
68 #endif 68 #endif
69 ASSERT_TRUE(window->SimulateOSKeyPress(menu_key, 0)); 69 ASSERT_TRUE(window->SimulateOSKeyPress(menu_key, 0));
70 70
71 int new_view_id = -1; 71 int new_view_id = -1;
72 ASSERT_TRUE(window->WaitForFocusedViewIDToChange( 72 ASSERT_TRUE(window->WaitForFocusedViewIDToChange(
73 original_view_id, &new_view_id)); 73 original_view_id, &new_view_id));
74 74
75 ASSERT_TRUE(browser->StartTrackingPopupMenus()); 75 ASSERT_TRUE(browser->StartTrackingPopupMenus());
76 76
77 if (alternate_key_sequence) 77 if (alternate_key_sequence)
78 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_DOWN, 0)); 78 ASSERT_TRUE(window->SimulateOSKeyPress(app::VKEY_DOWN, 0));
79 else 79 else
80 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_RETURN, 0)); 80 ASSERT_TRUE(window->SimulateOSKeyPress(app::VKEY_RETURN, 0));
81 81
82 // Wait until the popup menu actually opens. 82 // Wait until the popup menu actually opens.
83 ASSERT_TRUE(browser->WaitForPopupMenuToOpen()); 83 ASSERT_TRUE(browser->WaitForPopupMenuToOpen());
84 84
85 // Press DOWN to select the first item, then RETURN to select it. 85 // Press DOWN to select the first item, then RETURN to select it.
86 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_DOWN, 0)); 86 ASSERT_TRUE(window->SimulateOSKeyPress(app::VKEY_DOWN, 0));
87 ASSERT_TRUE(window->SimulateOSKeyPress(base::VKEY_RETURN, 0)); 87 ASSERT_TRUE(window->SimulateOSKeyPress(app::VKEY_RETURN, 0));
88 88
89 // Wait for the new tab to appear. 89 // Wait for the new tab to appear.
90 ASSERT_TRUE(browser->WaitForTabCountToBecome(2, action_timeout_ms())); 90 ASSERT_TRUE(browser->WaitForTabCountToBecome(2, action_timeout_ms()));
91 91
92 // Make sure that the new tab index is 1. 92 // Make sure that the new tab index is 1.
93 ASSERT_TRUE(browser->GetActiveTabIndex(&tab_index)); 93 ASSERT_TRUE(browser->GetActiveTabIndex(&tab_index));
94 ASSERT_EQ(1, tab_index); 94 ASSERT_EQ(1, tab_index);
95 } 95 }
96 96
97 TEST_F(KeyboardAccessTest, TestMenuKeyboardAccess) { 97 TEST_F(KeyboardAccessTest, TestMenuKeyboardAccess) {
(...skipping 20 matching lines...) Expand all
118 ASSERT_TRUE(browser->GetTabCount(&tab_count)); 118 ASSERT_TRUE(browser->GetTabCount(&tab_count));
119 ASSERT_EQ(tab_count, 2); 119 ASSERT_EQ(tab_count, 2);
120 120
121 int active_tab = 0; 121 int active_tab = 0;
122 ASSERT_TRUE(browser->GetActiveTabIndex(&active_tab)); 122 ASSERT_TRUE(browser->GetActiveTabIndex(&active_tab));
123 ASSERT_EQ(active_tab, 1); 123 ASSERT_EQ(active_tab, 1);
124 124
125 scoped_refptr<WindowProxy> window(browser->GetWindow()); 125 scoped_refptr<WindowProxy> window(browser->GetWindow());
126 ASSERT_TRUE(window); 126 ASSERT_TRUE(window);
127 ASSERT_TRUE(window->SimulateOSKeyPress( 127 ASSERT_TRUE(window->SimulateOSKeyPress(
128 base::VKEY_TAB, views::Event::EF_CONTROL_DOWN)); 128 app::VKEY_TAB, views::Event::EF_CONTROL_DOWN));
129 ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, action_max_timeout_ms())); 129 ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, action_max_timeout_ms()));
130 130
131 #if !defined(OS_MACOSX) // see BrowserWindowCocoa::GetCommandId 131 #if !defined(OS_MACOSX) // see BrowserWindowCocoa::GetCommandId
132 ASSERT_TRUE(browser->ActivateTab(1)); 132 ASSERT_TRUE(browser->ActivateTab(1));
133 ASSERT_TRUE(window->SimulateOSKeyPress( 133 ASSERT_TRUE(window->SimulateOSKeyPress(
134 base::VKEY_F4, views::Event::EF_CONTROL_DOWN)); 134 app::VKEY_F4, views::Event::EF_CONTROL_DOWN));
135 ASSERT_TRUE(browser->WaitForTabCountToBecome(1, action_max_timeout_ms())); 135 ASSERT_TRUE(browser->WaitForTabCountToBecome(1, action_max_timeout_ms()));
136 #endif 136 #endif
137 } 137 }
138 138
139 } // namespace 139 } // namespace
140 140
141 #endif // defined(TOOLKIT_VIEWS) 141 #endif // defined(TOOLKIT_VIEWS)
OLDNEW
« no previous file with comments | « chrome/test/automation/window_proxy.cc ('k') | chrome/test/interactive_ui/npapi_interactive_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698