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 "ash/ime/input_method_menu_item.h" | 5 #include "ash/ime/input_method_menu_item.h" |
6 #include "ash/ime/input_method_menu_manager.h" | 6 #include "ash/ime/input_method_menu_manager.h" |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/extensions/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
11 #include "chromeos/ime/component_extension_ime_manager.h" | 11 #include "chromeos/ime/component_extension_ime_manager.h" |
12 #include "chromeos/ime/composition_text.h" | 12 #include "chromeos/ime/composition_text.h" |
13 #include "chromeos/ime/input_method_descriptor.h" | 13 #include "chromeos/ime/input_method_descriptor.h" |
14 #include "chromeos/ime/input_method_manager.h" | 14 #include "chromeos/ime/input_method_manager.h" |
15 #include "content/public/test/browser_test_utils.h" | 15 #include "content/public/test/browser_test_utils.h" |
16 #include "content/public/test/test_utils.h" | 16 #include "content/public/test/test_utils.h" |
| 17 #include "extensions/browser/process_manager.h" |
17 #include "extensions/common/manifest_handlers/background_info.h" | 18 #include "extensions/common/manifest_handlers/background_info.h" |
18 #include "ui/base/ime/chromeos/ime_bridge.h" | 19 #include "ui/base/ime/chromeos/ime_bridge.h" |
19 #include "ui/base/ime/chromeos/mock_ime_candidate_window_handler.h" | 20 #include "ui/base/ime/chromeos/mock_ime_candidate_window_handler.h" |
20 #include "ui/base/ime/chromeos/mock_ime_input_context_handler.h" | 21 #include "ui/base/ime/chromeos/mock_ime_input_context_handler.h" |
21 #include "ui/events/event.h" | 22 #include "ui/events/event.h" |
22 | 23 |
23 namespace chromeos { | 24 namespace chromeos { |
24 namespace input_method { | 25 namespace input_method { |
25 namespace { | 26 namespace { |
26 | 27 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 154 |
154 IMEBridge::Get()->SetInputContextHandler(mock_input_context.get()); | 155 IMEBridge::Get()->SetInputContextHandler(mock_input_context.get()); |
155 IMEBridge::Get()->SetCandidateWindowHandler(mock_candidate_window.get()); | 156 IMEBridge::Get()->SetCandidateWindowHandler(mock_candidate_window.get()); |
156 | 157 |
157 IMEEngineHandlerInterface* engine_handler = | 158 IMEEngineHandlerInterface* engine_handler = |
158 IMEBridge::Get()->GetCurrentEngineHandler(); | 159 IMEBridge::Get()->GetCurrentEngineHandler(); |
159 ASSERT_TRUE(engine_handler); | 160 ASSERT_TRUE(engine_handler); |
160 | 161 |
161 // onActivate event should be fired if Enable function is called. | 162 // onActivate event should be fired if Enable function is called. |
162 ExtensionTestMessageListener activated_listener("onActivate", false); | 163 ExtensionTestMessageListener activated_listener("onActivate", false); |
163 engine_handler->Enable(); | 164 engine_handler->Enable("IdentityIME"); |
164 ASSERT_TRUE(activated_listener.WaitUntilSatisfied()); | 165 ASSERT_TRUE(activated_listener.WaitUntilSatisfied()); |
165 ASSERT_TRUE(activated_listener.was_satisfied()); | 166 ASSERT_TRUE(activated_listener.was_satisfied()); |
166 | 167 |
167 // onFocus event should be fired if FocusIn function is called. | 168 // onFocus event should be fired if FocusIn function is called. |
168 ExtensionTestMessageListener focus_listener("onFocus:text", false); | 169 ExtensionTestMessageListener focus_listener("onFocus:text", false); |
169 IMEEngineHandlerInterface::InputContext context(ui::TEXT_INPUT_TYPE_TEXT, | 170 IMEEngineHandlerInterface::InputContext context(ui::TEXT_INPUT_TYPE_TEXT, |
170 ui::TEXT_INPUT_MODE_DEFAULT); | 171 ui::TEXT_INPUT_MODE_DEFAULT); |
171 engine_handler->FocusIn(context); | 172 engine_handler->FocusIn(context); |
172 ASSERT_TRUE(focus_listener.WaitUntilSatisfied()); | 173 ASSERT_TRUE(focus_listener.WaitUntilSatisfied()); |
173 ASSERT_TRUE(focus_listener.was_satisfied()); | 174 ASSERT_TRUE(focus_listener.was_satisfied()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 scoped_ptr<MockIMECandidateWindowHandler> mock_candidate_window( | 232 scoped_ptr<MockIMECandidateWindowHandler> mock_candidate_window( |
232 new MockIMECandidateWindowHandler()); | 233 new MockIMECandidateWindowHandler()); |
233 | 234 |
234 IMEBridge::Get()->SetInputContextHandler(mock_input_context.get()); | 235 IMEBridge::Get()->SetInputContextHandler(mock_input_context.get()); |
235 IMEBridge::Get()->SetCandidateWindowHandler(mock_candidate_window.get()); | 236 IMEBridge::Get()->SetCandidateWindowHandler(mock_candidate_window.get()); |
236 | 237 |
237 IMEEngineHandlerInterface* engine_handler = | 238 IMEEngineHandlerInterface* engine_handler = |
238 IMEBridge::Get()->GetCurrentEngineHandler(); | 239 IMEBridge::Get()->GetCurrentEngineHandler(); |
239 ASSERT_TRUE(engine_handler); | 240 ASSERT_TRUE(engine_handler); |
240 | 241 |
241 extensions::ExtensionHost* host = FindHostWithPath( | 242 extensions::ExtensionHost* host = |
242 extensions::ExtensionSystem::Get(profile())->process_manager(), | 243 extensions::ExtensionSystem::Get(profile()) |
243 extensions::BackgroundInfo::GetBackgroundURL(extension_).path(), | 244 ->process_manager() |
244 1); | 245 ->GetBackgroundHostForExtension(extension_->id()); |
| 246 ASSERT_TRUE(host); |
245 | 247 |
246 engine_handler->Enable(); | 248 engine_handler->Enable("APIArgumentIME"); |
247 IMEEngineHandlerInterface::InputContext context(ui::TEXT_INPUT_TYPE_TEXT, | 249 IMEEngineHandlerInterface::InputContext context(ui::TEXT_INPUT_TYPE_TEXT, |
248 ui::TEXT_INPUT_MODE_DEFAULT); | 250 ui::TEXT_INPUT_MODE_DEFAULT); |
249 engine_handler->FocusIn(context); | 251 engine_handler->FocusIn(context); |
250 | 252 |
251 { | 253 { |
252 SCOPED_TRACE("KeyDown, Ctrl:No, alt:No, Shift:No, Caps:No"); | 254 SCOPED_TRACE("KeyDown, Ctrl:No, alt:No, Shift:No, Caps:No"); |
253 KeyEventDoneCallback callback(false); | 255 KeyEventDoneCallback callback(false); |
254 const std::string expected_value = | 256 const std::string expected_value = |
255 "onKeyEvent::keydown:a:KeyA:false:false:false:false"; | 257 "onKeyEvent::keydown:a:KeyA:false:false:false:false"; |
256 ExtensionTestMessageListener keyevent_listener(expected_value, false); | 258 ExtensionTestMessageListener keyevent_listener(expected_value, false); |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 } | 924 } |
923 } | 925 } |
924 | 926 |
925 IMEBridge::Get()->SetInputContextHandler(NULL); | 927 IMEBridge::Get()->SetInputContextHandler(NULL); |
926 IMEBridge::Get()->SetCandidateWindowHandler(NULL); | 928 IMEBridge::Get()->SetCandidateWindowHandler(NULL); |
927 } | 929 } |
928 | 930 |
929 } // namespace | 931 } // namespace |
930 } // namespace input_method | 932 } // namespace input_method |
931 } // namespace chromeos | 933 } // namespace chromeos |
OLD | NEW |