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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 8 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
9 #include "chrome/browser/chromeos/input_method/mode_indicator_controller.h" | 9 #include "chrome/browser/chromeos/input_method/mode_indicator_controller.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } // namespace | 126 } // namespace |
127 | 127 |
128 IN_PROC_BROWSER_TEST_F(ModeIndicatorBrowserTest, Bounds) { | 128 IN_PROC_BROWSER_TEST_F(ModeIndicatorBrowserTest, Bounds) { |
129 InitializeIMF(); | 129 InitializeIMF(); |
130 | 130 |
131 InputMethodManager* imm = InputMethodManager::Get(); | 131 InputMethodManager* imm = InputMethodManager::Get(); |
132 ASSERT_TRUE(imm); | 132 ASSERT_TRUE(imm); |
133 | 133 |
134 std::vector<std::string> keyboard_layouts; | 134 std::vector<std::string> keyboard_layouts; |
135 keyboard_layouts.push_back( | 135 keyboard_layouts.push_back( |
136 extension_ime_util::GetInputMethodIDByKeyboardLayout("xkb:fr::fra")); | 136 extension_ime_util::GetInputMethodIDByEngineID("xkb:fr::fra")); |
137 | 137 |
138 // Add keyboard layouts to enable the mode indicator. | 138 // Add keyboard layouts to enable the mode indicator. |
139 imm->EnableLoginLayouts("fr", keyboard_layouts); | 139 imm->EnableLoginLayouts("fr", keyboard_layouts); |
140 ASSERT_LT(1UL, imm->GetNumActiveInputMethods()); | 140 ASSERT_LT(1UL, imm->GetNumActiveInputMethods()); |
141 | 141 |
142 chromeos::IMECandidateWindowHandlerInterface* candidate_window = | 142 chromeos::IMECandidateWindowHandlerInterface* candidate_window = |
143 chromeos::IMEBridge::Get()->GetCandidateWindowHandler(); | 143 chromeos::IMEBridge::Get()->GetCandidateWindowHandler(); |
144 candidate_window->FocusStateChanged(true); | 144 candidate_window->FocusStateChanged(true); |
145 | 145 |
146 // Check if the size of the mode indicator is expected. | 146 // Check if the size of the mode indicator is expected. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 } | 194 } |
195 | 195 |
196 IN_PROC_BROWSER_TEST_F(ModeIndicatorBrowserTest, NumOfWidgets) { | 196 IN_PROC_BROWSER_TEST_F(ModeIndicatorBrowserTest, NumOfWidgets) { |
197 InitializeIMF(); | 197 InitializeIMF(); |
198 | 198 |
199 InputMethodManager* imm = InputMethodManager::Get(); | 199 InputMethodManager* imm = InputMethodManager::Get(); |
200 ASSERT_TRUE(imm); | 200 ASSERT_TRUE(imm); |
201 | 201 |
202 std::vector<std::string> keyboard_layouts; | 202 std::vector<std::string> keyboard_layouts; |
203 keyboard_layouts.push_back( | 203 keyboard_layouts.push_back( |
204 extension_ime_util::GetInputMethodIDByKeyboardLayout("xkb:fr::fra")); | 204 extension_ime_util::GetInputMethodIDByEngineID("xkb:fr::fra")); |
205 | 205 |
206 // Add keyboard layouts to enable the mode indicator. | 206 // Add keyboard layouts to enable the mode indicator. |
207 imm->EnableLoginLayouts("fr", keyboard_layouts); | 207 imm->EnableLoginLayouts("fr", keyboard_layouts); |
208 ASSERT_LT(1UL, imm->GetNumActiveInputMethods()); | 208 ASSERT_LT(1UL, imm->GetNumActiveInputMethods()); |
209 | 209 |
210 chromeos::IMECandidateWindowHandlerInterface* candidate_window = | 210 chromeos::IMECandidateWindowHandlerInterface* candidate_window = |
211 chromeos::IMEBridge::Get()->GetCandidateWindowHandler(); | 211 chromeos::IMEBridge::Get()->GetCandidateWindowHandler(); |
212 candidate_window->FocusStateChanged(true); | 212 candidate_window->FocusStateChanged(true); |
213 | 213 |
214 { | 214 { |
215 ScopedModeIndicatorObserverForTesting observer; | 215 ScopedModeIndicatorObserverForTesting observer; |
216 | 216 |
217 EXPECT_TRUE(imm->SwitchToNextInputMethod()); | 217 EXPECT_TRUE(imm->SwitchToNextInputMethod()); |
218 EXPECT_EQ(1UL, observer.max_widget_list_size()); | 218 EXPECT_EQ(1UL, observer.max_widget_list_size()); |
219 const views::Widget* widget1 = observer.widget_list()[0]; | 219 const views::Widget* widget1 = observer.widget_list()[0]; |
220 | 220 |
221 EXPECT_TRUE(imm->SwitchToNextInputMethod()); | 221 EXPECT_TRUE(imm->SwitchToNextInputMethod()); |
222 EXPECT_EQ(2UL, observer.max_widget_list_size()); | 222 EXPECT_EQ(2UL, observer.max_widget_list_size()); |
223 | 223 |
224 // When a new mode indicator is displayed, the previous one should be | 224 // When a new mode indicator is displayed, the previous one should be |
225 // closed. | 225 // closed. |
226 content::RunAllPendingInMessageLoop(); | 226 content::RunAllPendingInMessageLoop(); |
227 EXPECT_EQ(1UL, observer.widget_list_size()); | 227 EXPECT_EQ(1UL, observer.widget_list_size()); |
228 const views::Widget* widget2 = observer.widget_list()[0]; | 228 const views::Widget* widget2 = observer.widget_list()[0]; |
229 EXPECT_NE(widget1, widget2); | 229 EXPECT_NE(widget1, widget2); |
230 } | 230 } |
231 } | 231 } |
232 } // namespace input_method | 232 } // namespace input_method |
233 } // namespace chromeos | 233 } // namespace chromeos |
OLD | NEW |