OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind_helpers.h" | 5 #include "base/bind_helpers.h" |
6 #include "chrome/browser/extensions/extension_browsertest.h" | 6 #include "chrome/browser/extensions/extension_browsertest.h" |
7 #include "chrome/browser/extensions/extension_test_message_listener.h" | 7 #include "chrome/browser/extensions/extension_test_message_listener.h" |
8 #include "chrome/common/extensions/background_info.h" | 8 #include "chrome/common/extensions/background_info.h" |
9 #include "chromeos/dbus/ibus/ibus_text.h" | 9 #include "chromeos/dbus/ibus/ibus_text.h" |
10 #include "chromeos/ime/component_extension_ime_manager.h" | 10 #include "chromeos/ime/component_extension_ime_manager.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 IBusBridge::Get()->GetEngineHandler(); | 174 IBusBridge::Get()->GetEngineHandler(); |
175 ASSERT_TRUE(engine_handler); | 175 ASSERT_TRUE(engine_handler); |
176 | 176 |
177 // onActivate event should be fired if Enable function is called. | 177 // onActivate event should be fired if Enable function is called. |
178 ExtensionTestMessageListener activated_listener("onActivate", false); | 178 ExtensionTestMessageListener activated_listener("onActivate", false); |
179 engine_handler->Enable(); | 179 engine_handler->Enable(); |
180 ASSERT_TRUE(activated_listener.WaitUntilSatisfied()); | 180 ASSERT_TRUE(activated_listener.WaitUntilSatisfied()); |
181 ASSERT_TRUE(activated_listener.was_satisfied()); | 181 ASSERT_TRUE(activated_listener.was_satisfied()); |
182 | 182 |
183 // onFocus event should be fired if FocusIn function is called. | 183 // onFocus event should be fired if FocusIn function is called. |
184 ExtensionTestMessageListener focus_listener("onFocus", false);; | 184 ExtensionTestMessageListener focus_listener("onFocus:text", false);; |
185 engine_handler->FocusIn(ibus::TEXT_INPUT_TYPE_TEXT); | 185 engine_handler->FocusIn(ibus::TEXT_INPUT_TYPE_TEXT); |
186 ASSERT_TRUE(focus_listener.WaitUntilSatisfied()); | 186 ASSERT_TRUE(focus_listener.WaitUntilSatisfied()); |
187 ASSERT_TRUE(focus_listener.was_satisfied()); | 187 ASSERT_TRUE(focus_listener.was_satisfied()); |
188 | 188 |
189 // onKeyEvent should be fired if ProcessKeyEvent is called. | 189 // onKeyEvent should be fired if ProcessKeyEvent is called. |
190 KeyEventDoneCallback callback(false); // EchoBackIME doesn't consume keys. | 190 KeyEventDoneCallback callback(false); // EchoBackIME doesn't consume keys. |
191 ExtensionTestMessageListener keyevent_listener("onKeyEvent", false); | 191 ExtensionTestMessageListener keyevent_listener("onKeyEvent", false); |
192 engine_handler->ProcessKeyEvent(0x61, // KeySym for 'a'. | 192 engine_handler->ProcessKeyEvent(0x61, // KeySym for 'a'. |
193 0x26, // KeyCode for 'a'. | 193 0x26, // KeyCode for 'a'. |
194 0, // No modifiers. | 194 0, // No modifiers. |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 " length: 3" | 787 " length: 3" |
788 "});"; | 788 "});"; |
789 ASSERT_TRUE(content::ExecuteScript( | 789 ASSERT_TRUE(content::ExecuteScript( |
790 host->host_contents(), delete_surrounding_text_test_script)); | 790 host->host_contents(), delete_surrounding_text_test_script)); |
791 | 791 |
792 EXPECT_EQ(1, mock_input_context->delete_surrounding_text_call_count()); | 792 EXPECT_EQ(1, mock_input_context->delete_surrounding_text_call_count()); |
793 EXPECT_EQ(5, mock_input_context->last_delete_surrounding_text_arg().offset); | 793 EXPECT_EQ(5, mock_input_context->last_delete_surrounding_text_arg().offset); |
794 EXPECT_EQ(3U, | 794 EXPECT_EQ(3U, |
795 mock_input_context->last_delete_surrounding_text_arg().length); | 795 mock_input_context->last_delete_surrounding_text_arg().length); |
796 } | 796 } |
| 797 { |
| 798 SCOPED_TRACE("onFocus test"); |
| 799 mock_input_context->Reset(); |
| 800 mock_candidate_window->Reset(); |
| 801 mock_property->Reset(); |
| 802 |
| 803 { |
| 804 ExtensionTestMessageListener focus_listener("onFocus:text", false); |
| 805 engine_handler->FocusIn(ibus::TEXT_INPUT_TYPE_TEXT); |
| 806 ASSERT_TRUE(focus_listener.WaitUntilSatisfied()); |
| 807 ASSERT_TRUE(focus_listener.was_satisfied()); |
| 808 } |
| 809 { |
| 810 ExtensionTestMessageListener focus_listener("onFocus:search", false); |
| 811 engine_handler->FocusIn(ibus::TEXT_INPUT_TYPE_SEARCH); |
| 812 ASSERT_TRUE(focus_listener.WaitUntilSatisfied()); |
| 813 ASSERT_TRUE(focus_listener.was_satisfied()); |
| 814 } |
| 815 { |
| 816 ExtensionTestMessageListener focus_listener("onFocus:tel", false); |
| 817 engine_handler->FocusIn(ibus::TEXT_INPUT_TYPE_TELEPHONE); |
| 818 ASSERT_TRUE(focus_listener.WaitUntilSatisfied()); |
| 819 ASSERT_TRUE(focus_listener.was_satisfied()); |
| 820 } |
| 821 { |
| 822 ExtensionTestMessageListener focus_listener("onFocus:url", false); |
| 823 engine_handler->FocusIn(ibus::TEXT_INPUT_TYPE_URL); |
| 824 ASSERT_TRUE(focus_listener.WaitUntilSatisfied()); |
| 825 ASSERT_TRUE(focus_listener.was_satisfied()); |
| 826 } |
| 827 { |
| 828 ExtensionTestMessageListener focus_listener("onFocus:email", false); |
| 829 engine_handler->FocusIn(ibus::TEXT_INPUT_TYPE_EMAIL); |
| 830 ASSERT_TRUE(focus_listener.WaitUntilSatisfied()); |
| 831 ASSERT_TRUE(focus_listener.was_satisfied()); |
| 832 } |
| 833 { |
| 834 ExtensionTestMessageListener focus_listener("onFocus:number", false); |
| 835 engine_handler->FocusIn(ibus::TEXT_INPUT_TYPE_NUMBER); |
| 836 ASSERT_TRUE(focus_listener.WaitUntilSatisfied()); |
| 837 ASSERT_TRUE(focus_listener.was_satisfied()); |
| 838 } |
| 839 } |
| 840 |
797 IBusBridge::Get()->SetInputContextHandler(NULL); | 841 IBusBridge::Get()->SetInputContextHandler(NULL); |
798 IBusBridge::Get()->SetCandidateWindowHandler(NULL); | 842 IBusBridge::Get()->SetCandidateWindowHandler(NULL); |
799 IBusBridge::Get()->SetPropertyHandler(NULL); | 843 IBusBridge::Get()->SetPropertyHandler(NULL); |
800 } | 844 } |
801 | 845 |
802 } // namespace | 846 } // namespace |
803 } // namespace input_method | 847 } // namespace input_method |
804 } // namespace chromeos | 848 } // namespace chromeos |
OLD | NEW |