| 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 EXPECT_EQ(1, | 813 // TODO(nona): Change following expectation to 1 once new bypass |
| 814 // implementation is landed. |
| 815 EXPECT_EQ(0, |
| 814 mock_ibus_input_context_client_->set_cursor_location_call_count()); | 816 mock_ibus_input_context_client_->set_cursor_location_call_count()); |
| 815 // ui::TextInputClient::OnInputMethodChanged() should be called when | 817 // ui::TextInputClient::OnInputMethodChanged() should be called when |
| 816 // ui::InputMethodIBus connects/disconnects to/from ibus-daemon and the | 818 // ui::InputMethodIBus connects/disconnects to/from ibus-daemon and the |
| 817 // current text input type is not NONE. | 819 // current text input type is not NONE. |
| 818 EXPECT_EQ(1U, on_input_method_changed_call_count_); | 820 EXPECT_EQ(1U, on_input_method_changed_call_count_); |
| 819 } | 821 } |
| 820 | 822 |
| 821 // Confirm that IBusClient::FocusIn is NOT called on "connected" if input_type_ | 823 // Confirm that IBusClient::FocusIn is NOT called on "connected" if input_type_ |
| 822 // is PASSWORD. | 824 // is PASSWORD. |
| 823 TEST_F(InputMethodIBusTest, FocusIn_Password) { | 825 TEST_F(InputMethodIBusTest, FocusIn_Password) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 EXPECT_EQ(1, mock_ibus_client_->create_input_context_call_count()); | 876 EXPECT_EQ(1, mock_ibus_client_->create_input_context_call_count()); |
| 875 EXPECT_EQ(1, mock_ibus_input_context_client_->focus_in_call_count()); | 877 EXPECT_EQ(1, mock_ibus_input_context_client_->focus_in_call_count()); |
| 876 EXPECT_EQ(0, mock_ibus_input_context_client_->focus_out_call_count()); | 878 EXPECT_EQ(0, mock_ibus_input_context_client_->focus_out_call_count()); |
| 877 input_type_ = TEXT_INPUT_TYPE_URL; | 879 input_type_ = TEXT_INPUT_TYPE_URL; |
| 878 ime_->OnTextInputTypeChanged(this); | 880 ime_->OnTextInputTypeChanged(this); |
| 879 EXPECT_EQ(1, mock_ibus_input_context_client_->focus_in_call_count()); | 881 EXPECT_EQ(1, mock_ibus_input_context_client_->focus_in_call_count()); |
| 880 EXPECT_EQ(0, mock_ibus_input_context_client_->focus_out_call_count()); | 882 EXPECT_EQ(0, mock_ibus_input_context_client_->focus_out_call_count()); |
| 881 } | 883 } |
| 882 | 884 |
| 883 // Test if the new |caret_bounds_| is correctly sent to ibus-daemon. | 885 // Test if the new |caret_bounds_| is correctly sent to ibus-daemon. |
| 884 TEST_F(InputMethodIBusTest, OnCaretBoundsChanged) { | 886 // TODO(nona): Re-enable following tests once new bypas implementation is |
| 887 // land. |
| 888 TEST_F(InputMethodIBusTest, DISABLED_OnCaretBoundsChanged) { |
| 885 SetCreateContextSuccessHandler(); | 889 SetCreateContextSuccessHandler(); |
| 886 chromeos::DBusThreadManager::Get()->InitIBusBus("dummy address"); | 890 chromeos::DBusThreadManager::Get()->InitIBusBus("dummy address"); |
| 887 input_type_ = TEXT_INPUT_TYPE_TEXT; | 891 input_type_ = TEXT_INPUT_TYPE_TEXT; |
| 888 ime_->Init(true); | 892 ime_->Init(true); |
| 889 EXPECT_EQ(0, | 893 EXPECT_EQ(0, |
| 890 mock_ibus_input_context_client_->set_cursor_location_call_count()); | 894 mock_ibus_input_context_client_->set_cursor_location_call_count()); |
| 891 caret_bounds_ = gfx::Rect(1, 2, 3, 4); | 895 caret_bounds_ = gfx::Rect(1, 2, 3, 4); |
| 892 ime_->OnCaretBoundsChanged(this); | 896 ime_->OnCaretBoundsChanged(this); |
| 893 EXPECT_EQ(1, | 897 EXPECT_EQ(1, |
| 894 mock_ibus_input_context_client_->set_cursor_location_call_count()); | 898 mock_ibus_input_context_client_->set_cursor_location_call_count()); |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1653 | 1657 |
| 1654 // Do callback. | 1658 // Do callback. |
| 1655 success_consume_handler.RunCallback(KEYEVENT_CONSUME); | 1659 success_consume_handler.RunCallback(KEYEVENT_CONSUME); |
| 1656 | 1660 |
| 1657 EXPECT_EQ(0, ime_->process_key_event_post_ime_call_count()); | 1661 EXPECT_EQ(0, ime_->process_key_event_post_ime_call_count()); |
| 1658 } | 1662 } |
| 1659 | 1663 |
| 1660 // TODO(nona): Introduce ProcessKeyEventPostIME tests(crbug.com/156593). | 1664 // TODO(nona): Introduce ProcessKeyEventPostIME tests(crbug.com/156593). |
| 1661 | 1665 |
| 1662 } // namespace ui | 1666 } // namespace ui |
| OLD | NEW |