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 <cstring> | 5 #include <cstring> |
6 | 6 |
7 #include "base/i18n/char_iterator.h" | 7 #include "base/i18n/char_iterator.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chromeos/dbus/dbus_thread_manager.h" | 10 #include "chromeos/dbus/dbus_thread_manager.h" |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
417 // it fails (unless ibus sends the "connected" signal to Chrome again). It might | 417 // it fails (unless ibus sends the "connected" signal to Chrome again). It might |
418 // be better to add some retry logic. Will revisit later. | 418 // be better to add some retry logic. Will revisit later. |
419 TEST_F(InputMethodIBusTest, CreateContextFail) { | 419 TEST_F(InputMethodIBusTest, CreateContextFail) { |
420 CreateInputContextFailHandler create_input_context_handler; | 420 CreateInputContextFailHandler create_input_context_handler; |
421 mock_ibus_client_->set_create_input_context_handler(base::Bind( | 421 mock_ibus_client_->set_create_input_context_handler(base::Bind( |
422 &CreateInputContextFailHandler::Run, | 422 &CreateInputContextFailHandler::Run, |
423 base::Unretained(&create_input_context_handler))); | 423 base::Unretained(&create_input_context_handler))); |
424 | 424 |
425 chromeos::DBusThreadManager::Get()->InitIBusBus("dummy address"); | 425 chromeos::DBusThreadManager::Get()->InitIBusBus("dummy address"); |
426 ime_->Init(true); | 426 ime_->Init(true); |
427 EXPECT_EQ(1, mock_ibus_client_->create_input_context_call_count()); | 427 // InputMethodIBus tries 10 times if the CreateInputContext method call is |
428 // failed. | |
429 EXPECT_EQ(11, mock_ibus_client_->create_input_context_call_count()); | |
Yusuke Sato
2012/08/06 17:48:35
kXXX + 1
Seigo Nonaka
2012/08/07 04:28:29
Done.
| |
428 // |set_capabilities_call_count()| should be zero since a context is not | 430 // |set_capabilities_call_count()| should be zero since a context is not |
429 // created yet. | 431 // created yet. |
430 EXPECT_EQ(0, mock_ibus_input_context_client_->set_capabilities_call_count()); | 432 EXPECT_EQ(0, mock_ibus_input_context_client_->set_capabilities_call_count()); |
431 } | 433 } |
432 | 434 |
433 // Confirm that ui::InputMethodIBus does not crash even if ibus-daemon does not | 435 // Confirm that ui::InputMethodIBus does not crash even if ibus-daemon does not |
434 // respond. | 436 // respond. |
435 TEST_F(InputMethodIBusTest, CreateContextNoResp) { | 437 TEST_F(InputMethodIBusTest, CreateContextNoResp) { |
436 CreateInputContextNoResponseHandler create_input_context_handler; | 438 CreateInputContextNoResponseHandler create_input_context_handler; |
437 mock_ibus_client_->set_create_input_context_handler(base::Bind( | 439 mock_ibus_client_->set_create_input_context_handler(base::Bind( |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
771 composition_text.underlines[0].start_offset); | 773 composition_text.underlines[0].start_offset); |
772 EXPECT_EQ(GetOffsetInUTF16(kSampleText, selection.end_index), | 774 EXPECT_EQ(GetOffsetInUTF16(kSampleText, selection.end_index), |
773 composition_text.underlines[0].end_offset); | 775 composition_text.underlines[0].end_offset); |
774 EXPECT_EQ(SK_ColorBLACK, composition_text.underlines[0].color); | 776 EXPECT_EQ(SK_ColorBLACK, composition_text.underlines[0].color); |
775 EXPECT_TRUE(composition_text.underlines[0].thick); | 777 EXPECT_TRUE(composition_text.underlines[0].thick); |
776 } | 778 } |
777 | 779 |
778 // TODO(nona): Write more tests, especially for key event functions. | 780 // TODO(nona): Write more tests, especially for key event functions. |
779 | 781 |
780 } // namespace ui | 782 } // namespace ui |
OLD | NEW |