OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_menu/ime_menu_tray.h" | 5 #include "ash/system/ime_menu/ime_menu_tray.h" |
6 | 6 |
7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
8 #include "ash/accessibility_delegate.h" | 8 #include "ash/accessibility_delegate.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/system/ime_menu/ime_list_view.h" | 10 #include "ash/system/ime_menu/ime_list_view.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 info2.short_name = UTF8ToUTF16("UK"); | 130 info2.short_name = UTF8ToUTF16("UK"); |
131 info2.third_party = true; | 131 info2.third_party = true; |
132 info2.selected = true; | 132 info2.selected = true; |
133 GetSystemTrayDelegate()->SetCurrentIME(info2); | 133 GetSystemTrayDelegate()->SetCurrentIME(info2); |
134 Shell::Get()->system_tray_notifier()->NotifyRefreshIME(); | 134 Shell::Get()->system_tray_notifier()->NotifyRefreshIME(); |
135 EXPECT_EQ(UTF8ToUTF16("UK*"), GetTrayText()); | 135 EXPECT_EQ(UTF8ToUTF16("UK*"), GetTrayText()); |
136 } | 136 } |
137 | 137 |
138 // Tests that IME menu tray changes background color when tapped/clicked. And | 138 // Tests that IME menu tray changes background color when tapped/clicked. And |
139 // tests that the background color becomes 'inactive' when disabling the IME | 139 // tests that the background color becomes 'inactive' when disabling the IME |
140 // menu feature. | 140 // menu feature. Also makes sure that the shelf won't autohide as long as the |
| 141 // IME menu is open. |
141 TEST_F(ImeMenuTrayTest, PerformAction) { | 142 TEST_F(ImeMenuTrayTest, PerformAction) { |
142 Shell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(true); | 143 Shell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(true); |
143 ASSERT_TRUE(IsVisible()); | 144 ASSERT_TRUE(IsVisible()); |
144 ASSERT_FALSE(IsTrayBackgroundActive()); | 145 ASSERT_FALSE(IsTrayBackgroundActive()); |
| 146 StatusAreaWidget* status = StatusAreaWidgetTestHelper::GetStatusAreaWidget(); |
| 147 EXPECT_FALSE(status->ShouldShowShelf()); |
145 | 148 |
146 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), | 149 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), |
147 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); | 150 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); |
148 GetTray()->PerformAction(tap); | 151 GetTray()->PerformAction(tap); |
149 EXPECT_TRUE(IsTrayBackgroundActive()); | 152 EXPECT_TRUE(IsTrayBackgroundActive()); |
150 EXPECT_TRUE(IsBubbleShown()); | 153 EXPECT_TRUE(IsBubbleShown()); |
151 | 154 |
| 155 // Auto-hidden shelf would be forced to be visible as long as the bubble is |
| 156 // open. |
| 157 EXPECT_TRUE(status->ShouldShowShelf()); |
| 158 |
152 GetTray()->PerformAction(tap); | 159 GetTray()->PerformAction(tap); |
153 EXPECT_FALSE(IsTrayBackgroundActive()); | 160 EXPECT_FALSE(IsTrayBackgroundActive()); |
154 EXPECT_FALSE(IsBubbleShown()); | 161 EXPECT_FALSE(IsBubbleShown()); |
155 | 162 |
156 // If disabling the IME menu feature when the menu tray is activated, the tray | 163 // If disabling the IME menu feature when the menu tray is activated, the tray |
157 // element will be deactivated. | 164 // element will be deactivated. |
158 GetTray()->PerformAction(tap); | 165 GetTray()->PerformAction(tap); |
159 EXPECT_TRUE(IsTrayBackgroundActive()); | 166 EXPECT_TRUE(IsTrayBackgroundActive()); |
160 Shell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(false); | 167 Shell::Get()->system_tray_notifier()->NotifyRefreshIMEMenu(false); |
161 EXPECT_FALSE(IsVisible()); | 168 EXPECT_FALSE(IsVisible()); |
162 EXPECT_FALSE(IsBubbleShown()); | 169 EXPECT_FALSE(IsBubbleShown()); |
163 EXPECT_FALSE(IsTrayBackgroundActive()); | 170 EXPECT_FALSE(IsTrayBackgroundActive()); |
| 171 EXPECT_FALSE(status->ShouldShowShelf()); |
164 } | 172 } |
165 | 173 |
166 // Tests that IME menu list updates when changing the current IME. This should | 174 // Tests that IME menu list updates when changing the current IME. This should |
167 // only happen by using shortcuts (Ctrl + Space / Ctrl + Shift + Space) to | 175 // only happen by using shortcuts (Ctrl + Space / Ctrl + Shift + Space) to |
168 // switch IMEs. | 176 // switch IMEs. |
169 TEST_F(ImeMenuTrayTest, RefreshImeWithListViewCreated) { | 177 TEST_F(ImeMenuTrayTest, RefreshImeWithListViewCreated) { |
170 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), | 178 ui::GestureEvent tap(0, 0, 0, base::TimeTicks(), |
171 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); | 179 ui::GestureEventDetails(ui::ET_GESTURE_TAP)); |
172 GetTray()->PerformAction(tap); | 180 GetTray()->PerformAction(tap); |
173 | 181 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 input_method_manager = chromeos::input_method::InputMethodManager::Get(); | 314 input_method_manager = chromeos::input_method::InputMethodManager::Get(); |
307 EXPECT_TRUE(input_method_manager && | 315 EXPECT_TRUE(input_method_manager && |
308 input_method_manager->IsEmojiHandwritingVoiceOnImeMenuEnabled()); | 316 input_method_manager->IsEmojiHandwritingVoiceOnImeMenuEnabled()); |
309 EXPECT_TRUE(GetTray()->ShouldShowEmojiHandwritingVoiceButtons()); | 317 EXPECT_TRUE(GetTray()->ShouldShowEmojiHandwritingVoiceButtons()); |
310 | 318 |
311 FocusInInputContext(ui::TEXT_INPUT_TYPE_PASSWORD); | 319 FocusInInputContext(ui::TEXT_INPUT_TYPE_PASSWORD); |
312 EXPECT_FALSE(GetTray()->ShouldShowEmojiHandwritingVoiceButtons()); | 320 EXPECT_FALSE(GetTray()->ShouldShowEmojiHandwritingVoiceButtons()); |
313 } | 321 } |
314 | 322 |
315 } // namespace ash | 323 } // namespace ash |
OLD | NEW |