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 "chrome/browser/chromeos/input_method/input_method_manager_impl.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_manager_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 ids.push_back("mozc"); | 552 ids.push_back("mozc"); |
553 EXPECT_TRUE(manager_->EnableInputMethods(ids)); | 553 EXPECT_TRUE(manager_->EnableInputMethods(ids)); |
554 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 554 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
555 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); | 555 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); |
556 manager_->ChangeInputMethod("mozc"); | 556 manager_->ChangeInputMethod("mozc"); |
557 | 557 |
558 InputMethodPropertyList current_property_list; | 558 InputMethodPropertyList current_property_list; |
559 current_property_list.push_back(InputMethodProperty("key", | 559 current_property_list.push_back(InputMethodProperty("key", |
560 "label", | 560 "label", |
561 false, | 561 false, |
562 false, | 562 false)); |
563 -1)); | |
564 controller_->SetCurrentPropertiesForTesting(current_property_list); | 563 controller_->SetCurrentPropertiesForTesting(current_property_list); |
565 controller_->NotifyPropertyChangedForTesting(); | 564 controller_->NotifyPropertyChangedForTesting(); |
566 | 565 |
567 ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size()); | 566 ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size()); |
568 EXPECT_EQ("key", manager_->GetCurrentInputMethodProperties().at(0).key); | 567 EXPECT_EQ("key", manager_->GetCurrentInputMethodProperties().at(0).key); |
569 | 568 |
570 manager_->ChangeInputMethod("xkb:us::eng"); | 569 manager_->ChangeInputMethod("xkb:us::eng"); |
571 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); | 570 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); |
572 | 571 |
573 // Delayed asynchronous property update signal from the Mozc IME. | 572 // Delayed asynchronous property update signal from the Mozc IME. |
(...skipping 11 matching lines...) Expand all Loading... |
585 ids.push_back("mozc"); // Japanese | 584 ids.push_back("mozc"); // Japanese |
586 ids.push_back("mozc-chewing"); // T-Chinese | 585 ids.push_back("mozc-chewing"); // T-Chinese |
587 EXPECT_TRUE(manager_->EnableInputMethods(ids)); | 586 EXPECT_TRUE(manager_->EnableInputMethods(ids)); |
588 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 587 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
589 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); | 588 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); |
590 | 589 |
591 InputMethodPropertyList current_property_list; | 590 InputMethodPropertyList current_property_list; |
592 current_property_list.push_back(InputMethodProperty("key-mozc", | 591 current_property_list.push_back(InputMethodProperty("key-mozc", |
593 "label", | 592 "label", |
594 false, | 593 false, |
595 false, | 594 false)); |
596 -1)); | |
597 controller_->SetCurrentPropertiesForTesting(current_property_list); | 595 controller_->SetCurrentPropertiesForTesting(current_property_list); |
598 controller_->NotifyPropertyChangedForTesting(); | 596 controller_->NotifyPropertyChangedForTesting(); |
599 | 597 |
600 ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size()); | 598 ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size()); |
601 EXPECT_EQ("key-mozc", manager_->GetCurrentInputMethodProperties().at(0).key); | 599 EXPECT_EQ("key-mozc", manager_->GetCurrentInputMethodProperties().at(0).key); |
602 | 600 |
603 manager_->ChangeInputMethod("mozc-chewing"); | 601 manager_->ChangeInputMethod("mozc-chewing"); |
604 // Since the IME is changed, the property for mozc Japanese should be hidden. | 602 // Since the IME is changed, the property for mozc Japanese should be hidden. |
605 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); | 603 EXPECT_TRUE(manager_->GetCurrentInputMethodProperties().empty()); |
606 | 604 |
607 // Asynchronous property update signal from mozc-chewing. | 605 // Asynchronous property update signal from mozc-chewing. |
608 current_property_list.clear(); | 606 current_property_list.clear(); |
609 current_property_list.push_back(InputMethodProperty("key-chewing", | 607 current_property_list.push_back(InputMethodProperty("key-chewing", |
610 "label", | 608 "label", |
611 false, | 609 false, |
612 false, | 610 false)); |
613 -1)); | |
614 controller_->SetCurrentPropertiesForTesting(current_property_list); | 611 controller_->SetCurrentPropertiesForTesting(current_property_list); |
615 controller_->NotifyPropertyChangedForTesting(); | 612 controller_->NotifyPropertyChangedForTesting(); |
616 ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size()); | 613 ASSERT_EQ(1U, manager_->GetCurrentInputMethodProperties().size()); |
617 EXPECT_EQ("key-chewing", | 614 EXPECT_EQ("key-chewing", |
618 manager_->GetCurrentInputMethodProperties().at(0).key); | 615 manager_->GetCurrentInputMethodProperties().at(0).key); |
619 } | 616 } |
620 | 617 |
621 TEST_F(InputMethodManagerImplTest, TestNextInputMethod) { | 618 TEST_F(InputMethodManagerImplTest, TestNextInputMethod) { |
622 TestObserver observer; | 619 TestObserver observer; |
623 manager_->AddObserver(&observer); | 620 manager_->AddObserver(&observer); |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 EXPECT_EQ("mozc", controller_->change_input_method_id_); | 985 EXPECT_EQ("mozc", controller_->change_input_method_id_); |
989 EXPECT_EQ(1, controller_->reset_count_); | 986 EXPECT_EQ(1, controller_->reset_count_); |
990 manager_->ChangeInputMethod("xkb:us::eng"); | 987 manager_->ChangeInputMethod("xkb:us::eng"); |
991 EXPECT_EQ(2, controller_->change_input_method_count_); | 988 EXPECT_EQ(2, controller_->change_input_method_count_); |
992 EXPECT_EQ("mozc", controller_->change_input_method_id_); | 989 EXPECT_EQ("mozc", controller_->change_input_method_id_); |
993 EXPECT_EQ(1, controller_->reset_count_); | 990 EXPECT_EQ(1, controller_->reset_count_); |
994 } | 991 } |
995 | 992 |
996 } // namespace input_method | 993 } // namespace input_method |
997 } // namespace chromeos | 994 } // namespace chromeos |
OLD | NEW |