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 <X11/Xlib.h> | 5 #include <X11/Xlib.h> |
6 #undef Bool | 6 #undef Bool |
7 #undef FocusIn | 7 #undef FocusIn |
8 #undef FocusOut | 8 #undef FocusOut |
9 #undef None | 9 #undef None |
10 | 10 |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 // Click a text input form. | 803 // Click a text input form. |
804 input_type_ = TEXT_INPUT_TYPE_TEXT; | 804 input_type_ = TEXT_INPUT_TYPE_TEXT; |
805 ime_->OnTextInputTypeChanged(this); | 805 ime_->OnTextInputTypeChanged(this); |
806 // Start the daemon. | 806 // Start the daemon. |
807 chromeos::DBusThreadManager::Get()->InitIBusBus("dummy address"); | 807 chromeos::DBusThreadManager::Get()->InitIBusBus("dummy address"); |
808 ime_->OnConnected(); | 808 ime_->OnConnected(); |
809 // A context should be created upon the signal delivery. | 809 // A context should be created upon the signal delivery. |
810 EXPECT_EQ(1, mock_ibus_client_->create_input_context_call_count()); | 810 EXPECT_EQ(1, mock_ibus_client_->create_input_context_call_count()); |
811 // Since a form has focus, IBusClient::FocusIn() should be called. | 811 // Since a form has focus, IBusClient::FocusIn() should be called. |
812 EXPECT_EQ(1, mock_ibus_input_context_client_->focus_in_call_count()); | 812 EXPECT_EQ(1, mock_ibus_input_context_client_->focus_in_call_count()); |
813 // TODO(nona): Change following expectation to 1 once new bypass | 813 EXPECT_EQ(1, |
814 // implementation is landed. | |
815 EXPECT_EQ(0, | |
816 mock_ibus_input_context_client_->set_cursor_location_call_count()); | 814 mock_ibus_input_context_client_->set_cursor_location_call_count()); |
817 // ui::TextInputClient::OnInputMethodChanged() should be called when | 815 // ui::TextInputClient::OnInputMethodChanged() should be called when |
818 // ui::InputMethodIBus connects/disconnects to/from ibus-daemon and the | 816 // ui::InputMethodIBus connects/disconnects to/from ibus-daemon and the |
819 // current text input type is not NONE. | 817 // current text input type is not NONE. |
820 EXPECT_EQ(1U, on_input_method_changed_call_count_); | 818 EXPECT_EQ(1U, on_input_method_changed_call_count_); |
821 } | 819 } |
822 | 820 |
823 // Confirm that IBusClient::FocusIn is NOT called on "connected" if input_type_ | 821 // Confirm that IBusClient::FocusIn is NOT called on "connected" if input_type_ |
824 // is PASSWORD. | 822 // is PASSWORD. |
825 TEST_F(InputMethodIBusTest, FocusIn_Password) { | 823 TEST_F(InputMethodIBusTest, FocusIn_Password) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 EXPECT_EQ(1, mock_ibus_client_->create_input_context_call_count()); | 874 EXPECT_EQ(1, mock_ibus_client_->create_input_context_call_count()); |
877 EXPECT_EQ(1, mock_ibus_input_context_client_->focus_in_call_count()); | 875 EXPECT_EQ(1, mock_ibus_input_context_client_->focus_in_call_count()); |
878 EXPECT_EQ(0, mock_ibus_input_context_client_->focus_out_call_count()); | 876 EXPECT_EQ(0, mock_ibus_input_context_client_->focus_out_call_count()); |
879 input_type_ = TEXT_INPUT_TYPE_URL; | 877 input_type_ = TEXT_INPUT_TYPE_URL; |
880 ime_->OnTextInputTypeChanged(this); | 878 ime_->OnTextInputTypeChanged(this); |
881 EXPECT_EQ(1, mock_ibus_input_context_client_->focus_in_call_count()); | 879 EXPECT_EQ(1, mock_ibus_input_context_client_->focus_in_call_count()); |
882 EXPECT_EQ(0, mock_ibus_input_context_client_->focus_out_call_count()); | 880 EXPECT_EQ(0, mock_ibus_input_context_client_->focus_out_call_count()); |
883 } | 881 } |
884 | 882 |
885 // Test if the new |caret_bounds_| is correctly sent to ibus-daemon. | 883 // Test if the new |caret_bounds_| is correctly sent to ibus-daemon. |
886 // TODO(nona): Re-enable following tests once new bypas implementation is | 884 TEST_F(InputMethodIBusTest, OnCaretBoundsChanged) { |
887 // land. | |
888 TEST_F(InputMethodIBusTest, DISABLED_OnCaretBoundsChanged) { | |
889 SetCreateContextSuccessHandler(); | 885 SetCreateContextSuccessHandler(); |
890 chromeos::DBusThreadManager::Get()->InitIBusBus("dummy address"); | 886 chromeos::DBusThreadManager::Get()->InitIBusBus("dummy address"); |
891 input_type_ = TEXT_INPUT_TYPE_TEXT; | 887 input_type_ = TEXT_INPUT_TYPE_TEXT; |
892 ime_->Init(true); | 888 ime_->Init(true); |
893 EXPECT_EQ(0, | 889 EXPECT_EQ(0, |
894 mock_ibus_input_context_client_->set_cursor_location_call_count()); | 890 mock_ibus_input_context_client_->set_cursor_location_call_count()); |
895 caret_bounds_ = gfx::Rect(1, 2, 3, 4); | 891 caret_bounds_ = gfx::Rect(1, 2, 3, 4); |
896 ime_->OnCaretBoundsChanged(this); | 892 ime_->OnCaretBoundsChanged(this); |
897 EXPECT_EQ(1, | 893 EXPECT_EQ(1, |
898 mock_ibus_input_context_client_->set_cursor_location_call_count()); | 894 mock_ibus_input_context_client_->set_cursor_location_call_count()); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 public: | 1169 public: |
1174 InputMethodIBusKeyEventTest() {} | 1170 InputMethodIBusKeyEventTest() {} |
1175 virtual ~InputMethodIBusKeyEventTest() {} | 1171 virtual ~InputMethodIBusKeyEventTest() {} |
1176 | 1172 |
1177 virtual void SetUp() OVERRIDE { | 1173 virtual void SetUp() OVERRIDE { |
1178 InputMethodIBusTest::SetUp(); | 1174 InputMethodIBusTest::SetUp(); |
1179 SetCreateContextSuccessHandler(); | 1175 SetCreateContextSuccessHandler(); |
1180 chromeos::DBusThreadManager::Get()->InitIBusBus("dummy address"); | 1176 chromeos::DBusThreadManager::Get()->InitIBusBus("dummy address"); |
1181 ime_->Init(true); | 1177 ime_->Init(true); |
1182 ime_->OnConnected(); | 1178 ime_->OnConnected(); |
| 1179 mock_ibus_input_context_client_->SetIsXKBLayout(false); |
1183 } | 1180 } |
1184 | 1181 |
1185 DISALLOW_COPY_AND_ASSIGN(InputMethodIBusKeyEventTest); | 1182 DISALLOW_COPY_AND_ASSIGN(InputMethodIBusKeyEventTest); |
1186 }; | 1183 }; |
1187 | 1184 |
1188 TEST_F(InputMethodIBusKeyEventTest, KeyEventConsumeTest) { | 1185 TEST_F(InputMethodIBusKeyEventTest, KeyEventConsumeTest) { |
1189 XEvent event = {}; | 1186 XEvent event = {}; |
1190 event.xkey.type = KeyPress; | 1187 event.xkey.type = KeyPress; |
1191 | 1188 |
1192 // Set up IBusKeyEventFromNativeKeyEvent result. | 1189 // Set up IBusKeyEventFromNativeKeyEvent result. |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1657 | 1654 |
1658 // Do callback. | 1655 // Do callback. |
1659 success_consume_handler.RunCallback(KEYEVENT_CONSUME); | 1656 success_consume_handler.RunCallback(KEYEVENT_CONSUME); |
1660 | 1657 |
1661 EXPECT_EQ(0, ime_->process_key_event_post_ime_call_count()); | 1658 EXPECT_EQ(0, ime_->process_key_event_post_ime_call_count()); |
1662 } | 1659 } |
1663 | 1660 |
1664 // TODO(nona): Introduce ProcessKeyEventPostIME tests(crbug.com/156593). | 1661 // TODO(nona): Introduce ProcessKeyEventPostIME tests(crbug.com/156593). |
1665 | 1662 |
1666 } // namespace ui | 1663 } // namespace ui |
OLD | NEW |