OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "ash/common/system/tray/system_tray.h" | 7 #include "ash/common/system/tray/system_tray.h" |
| 8 #include "ash/common/wm_shell.h" |
8 #include "ash/shell.h" | 9 #include "ash/shell.h" |
9 #include "ash/sticky_keys/sticky_keys_controller.h" | 10 #include "ash/sticky_keys/sticky_keys_controller.h" |
10 #include "ash/sticky_keys/sticky_keys_overlay.h" | 11 #include "ash/sticky_keys/sticky_keys_overlay.h" |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 14 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
17 #include "chrome/browser/ui/location_bar/location_bar.h" | 18 #include "chrome/browser/ui/location_bar/location_bar.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 EnableStickyKeys(); | 154 EnableStickyKeys(); |
154 | 155 |
155 OmniboxView* omnibox = | 156 OmniboxView* omnibox = |
156 browser()->window()->GetLocationBar()->GetOmniboxView(); | 157 browser()->window()->GetLocationBar()->GetOmniboxView(); |
157 | 158 |
158 // Give the omnibox focus. | 159 // Give the omnibox focus. |
159 omnibox->ShowURL(); | 160 omnibox->ShowURL(); |
160 | 161 |
161 // Make sure that the AppList is not erronously displayed and the omnibox | 162 // Make sure that the AppList is not erronously displayed and the omnibox |
162 // doesn't lost focus | 163 // doesn't lost focus |
163 EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); | 164 EXPECT_FALSE(ash::WmShell::Get()->GetAppListTargetVisibility()); |
164 EXPECT_TRUE(omnibox->GetNativeView()->HasFocus()); | 165 EXPECT_TRUE(omnibox->GetNativeView()->HasFocus()); |
165 | 166 |
166 // Type 'foo'. | 167 // Type 'foo'. |
167 SendKeyPress(ui::VKEY_F); | 168 SendKeyPress(ui::VKEY_F); |
168 SendKeyPress(ui::VKEY_O); | 169 SendKeyPress(ui::VKEY_O); |
169 SendKeyPress(ui::VKEY_O); | 170 SendKeyPress(ui::VKEY_O); |
170 | 171 |
171 // Verify the location of the caret. | 172 // Verify the location of the caret. |
172 size_t start, end; | 173 size_t start, end; |
173 omnibox->GetSelectionBounds(&start, &end); | 174 omnibox->GetSelectionBounds(&start, &end); |
174 ASSERT_EQ(3U, start); | 175 ASSERT_EQ(3U, start); |
175 ASSERT_EQ(3U, end); | 176 ASSERT_EQ(3U, end); |
176 | 177 |
177 EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); | 178 EXPECT_FALSE(ash::WmShell::Get()->GetAppListTargetVisibility()); |
178 EXPECT_TRUE(omnibox->GetNativeView()->HasFocus()); | 179 EXPECT_TRUE(omnibox->GetNativeView()->HasFocus()); |
179 | 180 |
180 // Hit Home by sequencing Search (left Windows) and Left (arrow). | 181 // Hit Home by sequencing Search (left Windows) and Left (arrow). |
181 SendKeyPress(ui::VKEY_LWIN); | 182 SendKeyPress(ui::VKEY_LWIN); |
182 SendKeyPress(ui::VKEY_LEFT); | 183 SendKeyPress(ui::VKEY_LEFT); |
183 | 184 |
184 EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); | 185 EXPECT_FALSE(ash::WmShell::Get()->GetAppListTargetVisibility()); |
185 EXPECT_TRUE(omnibox->GetNativeView()->HasFocus()); | 186 EXPECT_TRUE(omnibox->GetNativeView()->HasFocus()); |
186 | 187 |
187 // Verify caret moved to the beginning. | 188 // Verify caret moved to the beginning. |
188 omnibox->GetSelectionBounds(&start, &end); | 189 omnibox->GetSelectionBounds(&start, &end); |
189 ASSERT_EQ(0U, start); | 190 ASSERT_EQ(0U, start); |
190 ASSERT_EQ(0U, end); | 191 ASSERT_EQ(0U, end); |
191 } | 192 } |
192 | 193 |
193 IN_PROC_BROWSER_TEST_F(StickyKeysBrowserTest, OverlayShown) { | 194 IN_PROC_BROWSER_TEST_F(StickyKeysBrowserTest, OverlayShown) { |
194 const ui::KeyboardCode modifier_keys[] = { ui::VKEY_CONTROL, | 195 const ui::KeyboardCode modifier_keys[] = { ui::VKEY_CONTROL, |
(...skipping 27 matching lines...) Expand all Loading... |
222 EXPECT_TRUE(sticky_keys_overlay->is_visible()); | 223 EXPECT_TRUE(sticky_keys_overlay->is_visible()); |
223 DisableStickyKeys(); | 224 DisableStickyKeys(); |
224 EXPECT_FALSE(controller->GetOverlayForTest()); | 225 EXPECT_FALSE(controller->GetOverlayForTest()); |
225 for (auto key_code : modifier_keys) { | 226 for (auto key_code : modifier_keys) { |
226 SendKeyPress(key_code); | 227 SendKeyPress(key_code); |
227 EXPECT_FALSE(controller->GetOverlayForTest()); | 228 EXPECT_FALSE(controller->GetOverlayForTest()); |
228 } | 229 } |
229 } | 230 } |
230 | 231 |
231 } // namespace chromeos | 232 } // namespace chromeos |
OLD | NEW |