OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/system/ime/tray_ime_chromeos.h" | 5 #include "ash/system/ime/tray_ime_chromeos.h" |
6 | 6 |
7 #include "ash/accessibility_delegate.h" | 7 #include "ash/accessibility_delegate.h" |
8 #include "ash/accessibility_types.h" | 8 #include "ash/accessibility_types.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_port.h" |
10 #include "ash/system/ime_menu/ime_list_view.h" | 11 #include "ash/system/ime_menu/ime_list_view.h" |
11 #include "ash/system/tray/system_tray_notifier.h" | 12 #include "ash/system/tray/system_tray_notifier.h" |
12 #include "ash/test/ash_test_base.h" | 13 #include "ash/test/ash_test_base.h" |
13 #include "ash/wm_shell.h" | |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "ui/events/devices/device_data_manager.h" | 15 #include "ui/events/devices/device_data_manager.h" |
16 #include "ui/keyboard/keyboard_util.h" | 16 #include "ui/keyboard/keyboard_util.h" |
17 | 17 |
18 namespace ash { | 18 namespace ash { |
19 | 19 |
20 class TrayIMETest : public test::AshTestBase { | 20 class TrayIMETest : public test::AshTestBase { |
21 public: | 21 public: |
22 TrayIMETest() {} | 22 TrayIMETest() {} |
23 ~TrayIMETest() override {} | 23 ~TrayIMETest() override {} |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 SetIMELength(1); | 154 SetIMELength(1); |
155 EXPECT_TRUE(default_view()->visible()); | 155 EXPECT_TRUE(default_view()->visible()); |
156 SetIMELength(2); | 156 SetIMELength(2); |
157 EXPECT_TRUE(default_view()->visible()); | 157 EXPECT_TRUE(default_view()->visible()); |
158 } | 158 } |
159 | 159 |
160 // Tests that if no IMEs are present the default view is hidden when a11y is | 160 // Tests that if no IMEs are present the default view is hidden when a11y is |
161 // enabled. | 161 // enabled. |
162 TEST_F(TrayIMETest, HidesOnA11yEnabled) { | 162 TEST_F(TrayIMETest, HidesOnA11yEnabled) { |
163 // TODO: investigate failure in mash. http://crbug.com/695561. | 163 // TODO: investigate failure in mash. http://crbug.com/695561. |
164 if (WmShell::Get()->IsRunningInMash()) | 164 if (ShellPort::Get()->IsRunningInMash()) |
165 return; | 165 return; |
166 | 166 |
167 SetIMELength(0); | 167 SetIMELength(0); |
168 SuppressKeyboard(); | 168 SuppressKeyboard(); |
169 EXPECT_TRUE(default_view()->visible()); | 169 EXPECT_TRUE(default_view()->visible()); |
170 // Enable a11y keyboard. | 170 // Enable a11y keyboard. |
171 SetAccessibilityKeyboardEnabled(true); | 171 SetAccessibilityKeyboardEnabled(true); |
172 EXPECT_FALSE(default_view()->visible()); | 172 EXPECT_FALSE(default_view()->visible()); |
173 // Disable the a11y keyboard. | 173 // Disable the a11y keyboard. |
174 SetAccessibilityKeyboardEnabled(false); | 174 SetAccessibilityKeyboardEnabled(false); |
175 EXPECT_TRUE(default_view()->visible()); | 175 EXPECT_TRUE(default_view()->visible()); |
176 } | 176 } |
177 | 177 |
178 // Tests that clicking on the keyboard toggle causes the virtual keyboard | 178 // Tests that clicking on the keyboard toggle causes the virtual keyboard |
179 // to toggle between enabled and disabled. | 179 // to toggle between enabled and disabled. |
180 TEST_F(TrayIMETest, PerformActionOnDetailedView) { | 180 TEST_F(TrayIMETest, PerformActionOnDetailedView) { |
181 // TODO: investigate failure in mash. http://crbug.com/695561. | 181 // TODO: investigate failure in mash. http://crbug.com/695561. |
182 if (WmShell::Get()->IsRunningInMash()) | 182 if (ShellPort::Get()->IsRunningInMash()) |
183 return; | 183 return; |
184 | 184 |
185 SetIMELength(0); | 185 SetIMELength(0); |
186 SuppressKeyboard(); | 186 SuppressKeyboard(); |
187 EXPECT_FALSE(keyboard::IsKeyboardEnabled()); | 187 EXPECT_FALSE(keyboard::IsKeyboardEnabled()); |
188 views::View* toggle = GetToggleView(); | 188 views::View* toggle = GetToggleView(); |
189 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), | 189 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), |
190 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); | 190 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); |
191 // Enable the keyboard. | 191 // Enable the keyboard. |
192 toggle->OnGestureEvent(&tap); | 192 toggle->OnGestureEvent(&tap); |
193 EXPECT_TRUE(keyboard::IsKeyboardEnabled()); | 193 EXPECT_TRUE(keyboard::IsKeyboardEnabled()); |
194 EXPECT_TRUE(default_view()->visible()); | 194 EXPECT_TRUE(default_view()->visible()); |
195 | 195 |
196 // Clicking again should disable the keyboard. | 196 // Clicking again should disable the keyboard. |
197 toggle = GetToggleView(); | 197 toggle = GetToggleView(); |
198 tap = ui::GestureEvent(0, 0, 0, base::TimeTicks(), | 198 tap = ui::GestureEvent(0, 0, 0, base::TimeTicks(), |
199 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); | 199 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); |
200 toggle->OnGestureEvent(&tap); | 200 toggle->OnGestureEvent(&tap); |
201 EXPECT_FALSE(keyboard::IsKeyboardEnabled()); | 201 EXPECT_FALSE(keyboard::IsKeyboardEnabled()); |
202 EXPECT_TRUE(default_view()->visible()); | 202 EXPECT_TRUE(default_view()->visible()); |
203 } | 203 } |
204 | 204 |
205 } // namespace ash | 205 } // namespace ash |
OLD | NEW |