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 "ash/ime/input_method_menu_item.h" | 9 #include "ash/ime/input_method_menu_item.h" |
10 #include "ash/ime/input_method_menu_manager.h" | 10 #include "ash/ime/input_method_menu_manager.h" |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 id_to_find = manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( | 501 id_to_find = manager_->GetInputMethodUtil()->GetInputMethodDescriptorFromId( |
502 ImeIdFromEngineId("xkb:jp::jpn")); | 502 ImeIdFromEngineId("xkb:jp::jpn")); |
503 EXPECT_TRUE(id_to_find && Contain(*methods.get(), *id_to_find)); | 503 EXPECT_TRUE(id_to_find && Contain(*methods.get(), *id_to_find)); |
504 } | 504 } |
505 | 505 |
506 TEST_F(InputMethodManagerImplTest, TestEnableTwoLayouts) { | 506 TEST_F(InputMethodManagerImplTest, TestEnableTwoLayouts) { |
507 // For http://crbug.com/19655#c11 - (8), step 6. | 507 // For http://crbug.com/19655#c11 - (8), step 6. |
508 TestObserver observer; | 508 TestObserver observer; |
509 manager_->AddObserver(&observer); | 509 manager_->AddObserver(&observer); |
510 InitComponentExtension(); | 510 InitComponentExtension(); |
511 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 511 manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); |
512 std::vector<std::string> ids; | 512 std::vector<std::string> ids; |
513 ids.push_back(ImeIdFromEngineId("xkb:us:dvorak:eng")); | 513 ids.push_back(ImeIdFromEngineId("xkb:us:dvorak:eng")); |
514 ids.push_back(ImeIdFromEngineId("xkb:us:colemak:eng")); | 514 ids.push_back(ImeIdFromEngineId("xkb:us:colemak:eng")); |
515 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 515 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
516 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 516 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
517 // Since all the IDs added avobe are keyboard layouts, Start() should not be | 517 // Since all the IDs added avobe are keyboard layouts, Start() should not be |
518 // called. | 518 // called. |
519 EXPECT_EQ(1, observer.input_method_changed_count_); | 519 EXPECT_EQ(1, observer.input_method_changed_count_); |
520 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); | 520 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); |
521 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); | 521 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); |
522 // Disable Dvorak. | 522 // Disable Dvorak. |
523 ids.erase(ids.begin()); | 523 ids.erase(ids.begin()); |
524 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 524 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
525 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); | 525 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); |
526 EXPECT_EQ(2, observer.input_method_changed_count_); | 526 EXPECT_EQ(2, observer.input_method_changed_count_); |
527 EXPECT_EQ(ImeIdFromEngineId(ids[0]), // colemak | 527 EXPECT_EQ(ImeIdFromEngineId(ids[0]), // colemak |
528 manager_->GetCurrentInputMethod().id()); | 528 manager_->GetCurrentInputMethod().id()); |
529 EXPECT_EQ("us(colemak)", keyboard_->last_layout_); | 529 EXPECT_EQ("us(colemak)", keyboard_->last_layout_); |
530 manager_->RemoveObserver(&observer); | 530 manager_->RemoveObserver(&observer); |
531 } | 531 } |
532 | 532 |
533 TEST_F(InputMethodManagerImplTest, TestEnableThreeLayouts) { | 533 TEST_F(InputMethodManagerImplTest, TestEnableThreeLayouts) { |
534 // For http://crbug.com/19655#c11 - (9). | 534 // For http://crbug.com/19655#c11 - (9). |
535 TestObserver observer; | 535 TestObserver observer; |
536 manager_->AddObserver(&observer); | 536 manager_->AddObserver(&observer); |
537 InitComponentExtension(); | 537 InitComponentExtension(); |
538 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 538 manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); |
539 std::vector<std::string> ids; | 539 std::vector<std::string> ids; |
540 ids.push_back(ImeIdFromEngineId("xkb:us::eng")); | 540 ids.push_back(ImeIdFromEngineId("xkb:us::eng")); |
541 ids.push_back(ImeIdFromEngineId("xkb:us:dvorak:eng")); | 541 ids.push_back(ImeIdFromEngineId("xkb:us:dvorak:eng")); |
542 ids.push_back(ImeIdFromEngineId("xkb:us:colemak:eng")); | 542 ids.push_back(ImeIdFromEngineId("xkb:us:colemak:eng")); |
543 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 543 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
544 EXPECT_EQ(3U, manager_->GetNumActiveInputMethods()); | 544 EXPECT_EQ(3U, manager_->GetNumActiveInputMethods()); |
545 EXPECT_EQ(1, observer.input_method_changed_count_); | 545 EXPECT_EQ(1, observer.input_method_changed_count_); |
546 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); | 546 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); |
547 EXPECT_EQ("us", keyboard_->last_layout_); | 547 EXPECT_EQ("us", keyboard_->last_layout_); |
548 // Switch to Dvorak. | 548 // Switch to Dvorak. |
(...skipping 10 matching lines...) Expand all Loading... |
559 manager_->GetCurrentInputMethod().id()); | 559 manager_->GetCurrentInputMethod().id()); |
560 EXPECT_EQ("us", keyboard_->last_layout_); | 560 EXPECT_EQ("us", keyboard_->last_layout_); |
561 manager_->RemoveObserver(&observer); | 561 manager_->RemoveObserver(&observer); |
562 } | 562 } |
563 | 563 |
564 TEST_F(InputMethodManagerImplTest, TestEnableLayoutAndIme) { | 564 TEST_F(InputMethodManagerImplTest, TestEnableLayoutAndIme) { |
565 // For http://crbug.com/19655#c11 - (10). | 565 // For http://crbug.com/19655#c11 - (10). |
566 TestObserver observer; | 566 TestObserver observer; |
567 manager_->AddObserver(&observer); | 567 manager_->AddObserver(&observer); |
568 InitComponentExtension(); | 568 InitComponentExtension(); |
569 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 569 manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); |
570 std::vector<std::string> ids; | 570 std::vector<std::string> ids; |
571 ids.push_back(ImeIdFromEngineId("xkb:us:dvorak:eng")); | 571 ids.push_back(ImeIdFromEngineId("xkb:us:dvorak:eng")); |
572 ids.push_back(ImeIdFromEngineId(kNaclMozcUsId)); | 572 ids.push_back(ImeIdFromEngineId(kNaclMozcUsId)); |
573 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 573 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
574 EXPECT_EQ(1, observer.input_method_changed_count_); | 574 EXPECT_EQ(1, observer.input_method_changed_count_); |
575 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); | 575 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); |
576 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); | 576 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); |
577 // Switch to Mozc | 577 // Switch to Mozc |
578 manager_->SwitchToNextInputMethod(); | 578 manager_->SwitchToNextInputMethod(); |
579 EXPECT_EQ(2, observer.input_method_changed_count_); | 579 EXPECT_EQ(2, observer.input_method_changed_count_); |
580 EXPECT_EQ(ImeIdFromEngineId(ids[1]), manager_->GetCurrentInputMethod().id()); | 580 EXPECT_EQ(ImeIdFromEngineId(ids[1]), manager_->GetCurrentInputMethod().id()); |
581 EXPECT_EQ("us", keyboard_->last_layout_); | 581 EXPECT_EQ("us", keyboard_->last_layout_); |
582 // Disable Mozc. | 582 // Disable Mozc. |
583 ids.erase(ids.begin() + 1); | 583 ids.erase(ids.begin() + 1); |
584 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 584 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
585 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); | 585 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); |
586 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); | 586 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); |
587 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); | 587 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); |
588 } | 588 } |
589 | 589 |
590 TEST_F(InputMethodManagerImplTest, TestEnableLayoutAndIme2) { | 590 TEST_F(InputMethodManagerImplTest, TestEnableLayoutAndIme2) { |
591 // For http://crbug.com/19655#c11 - (11). | 591 // For http://crbug.com/19655#c11 - (11). |
592 TestObserver observer; | 592 TestObserver observer; |
593 manager_->AddObserver(&observer); | 593 manager_->AddObserver(&observer); |
594 InitComponentExtension(); | 594 InitComponentExtension(); |
595 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 595 manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); |
596 std::vector<std::string> ids; | 596 std::vector<std::string> ids; |
597 ids.push_back(ImeIdFromEngineId("xkb:us:dvorak:eng")); | 597 ids.push_back(ImeIdFromEngineId("xkb:us:dvorak:eng")); |
598 ids.push_back(ImeIdFromEngineId(kNaclMozcUsId)); | 598 ids.push_back(ImeIdFromEngineId(kNaclMozcUsId)); |
599 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 599 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
600 EXPECT_EQ(1, observer.input_method_changed_count_); | 600 EXPECT_EQ(1, observer.input_method_changed_count_); |
601 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); | 601 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); |
602 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); | 602 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); |
603 | 603 |
604 // Disable Dvorak. | 604 // Disable Dvorak. |
605 ids.erase(ids.begin()); | 605 ids.erase(ids.begin()); |
606 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 606 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
607 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); | 607 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); |
608 EXPECT_EQ(ImeIdFromEngineId(ids[0]), // Mozc | 608 EXPECT_EQ(ImeIdFromEngineId(ids[0]), // Mozc |
609 manager_->GetCurrentInputMethod().id()); | 609 manager_->GetCurrentInputMethod().id()); |
610 EXPECT_EQ("us", keyboard_->last_layout_); | 610 EXPECT_EQ("us", keyboard_->last_layout_); |
611 manager_->RemoveObserver(&observer); | 611 manager_->RemoveObserver(&observer); |
612 } | 612 } |
613 | 613 |
614 TEST_F(InputMethodManagerImplTest, TestEnableImes) { | 614 TEST_F(InputMethodManagerImplTest, TestEnableImes) { |
615 TestObserver observer; | 615 TestObserver observer; |
616 manager_->AddObserver(&observer); | 616 manager_->AddObserver(&observer); |
617 InitComponentExtension(); | 617 InitComponentExtension(); |
618 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 618 manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); |
619 std::vector<std::string> ids; | 619 std::vector<std::string> ids; |
620 ids.push_back(ImeIdFromEngineId(kExt2Engine1Id)); | 620 ids.push_back(ImeIdFromEngineId(kExt2Engine1Id)); |
621 ids.push_back("mozc-dv"); | 621 ids.push_back("mozc-dv"); |
622 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 622 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
623 EXPECT_EQ(1, observer.input_method_changed_count_); | 623 EXPECT_EQ(1, observer.input_method_changed_count_); |
624 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); | 624 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); |
625 EXPECT_EQ("us", keyboard_->last_layout_); | 625 EXPECT_EQ("us", keyboard_->last_layout_); |
626 manager_->RemoveObserver(&observer); | 626 manager_->RemoveObserver(&observer); |
627 } | 627 } |
628 | 628 |
629 TEST_F(InputMethodManagerImplTest, TestEnableUnknownIds) { | 629 TEST_F(InputMethodManagerImplTest, TestEnableUnknownIds) { |
630 TestObserver observer; | 630 TestObserver observer; |
631 manager_->AddObserver(&observer); | 631 manager_->AddObserver(&observer); |
632 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 632 manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); |
633 std::vector<std::string> ids; | 633 std::vector<std::string> ids; |
634 ids.push_back("xkb:tl::tlh"); // Klingon, which is not supported. | 634 ids.push_back("xkb:tl::tlh"); // Klingon, which is not supported. |
635 ids.push_back("unknown-super-cool-ime"); | 635 ids.push_back("unknown-super-cool-ime"); |
636 EXPECT_FALSE(manager_->ReplaceEnabledInputMethods(ids)); | 636 EXPECT_FALSE(manager_->ReplaceEnabledInputMethods(ids)); |
637 | 637 |
638 // TODO(yusukes): Should we fall back to the hardware keyboard layout in this | 638 // TODO(yusukes): Should we fall back to the hardware keyboard layout in this |
639 // case? | 639 // case? |
640 EXPECT_EQ(0, observer.input_method_changed_count_); | 640 EXPECT_EQ(0, observer.input_method_changed_count_); |
641 | 641 |
642 manager_->RemoveObserver(&observer); | 642 manager_->RemoveObserver(&observer); |
643 } | 643 } |
644 | 644 |
645 TEST_F(InputMethodManagerImplTest, TestEnableLayoutsThenLock) { | 645 TEST_F(InputMethodManagerImplTest, TestEnableLayoutsThenLock) { |
646 // For http://crbug.com/19655#c11 - (14). | 646 // For http://crbug.com/19655#c11 - (14). |
647 TestObserver observer; | 647 TestObserver observer; |
648 manager_->AddObserver(&observer); | 648 manager_->AddObserver(&observer); |
649 InitComponentExtension(); | 649 InitComponentExtension(); |
650 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 650 manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); |
651 std::vector<std::string> ids; | 651 std::vector<std::string> ids; |
652 ids.push_back(ImeIdFromEngineId("xkb:us::eng")); | 652 ids.push_back(ImeIdFromEngineId("xkb:us::eng")); |
653 ids.push_back(ImeIdFromEngineId("xkb:us:dvorak:eng")); | 653 ids.push_back(ImeIdFromEngineId("xkb:us:dvorak:eng")); |
654 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 654 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
655 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 655 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
656 EXPECT_EQ(1, observer.input_method_changed_count_); | 656 EXPECT_EQ(1, observer.input_method_changed_count_); |
657 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); | 657 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); |
658 EXPECT_EQ("us", keyboard_->last_layout_); | 658 EXPECT_EQ("us", keyboard_->last_layout_); |
659 | 659 |
660 // Switch to Dvorak. | 660 // Switch to Dvorak. |
661 manager_->SwitchToNextInputMethod(); | 661 manager_->SwitchToNextInputMethod(); |
662 EXPECT_EQ(2, observer.input_method_changed_count_); | 662 EXPECT_EQ(2, observer.input_method_changed_count_); |
663 EXPECT_EQ(ImeIdFromEngineId(ids[1]), manager_->GetCurrentInputMethod().id()); | 663 EXPECT_EQ(ImeIdFromEngineId(ids[1]), manager_->GetCurrentInputMethod().id()); |
664 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); | 664 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); |
665 | 665 |
666 // Lock screen | 666 // Lock screen |
667 manager_->SetState(InputMethodManager::STATE_LOCK_SCREEN); | 667 manager_->SetUISessionState(InputMethodManager::STATE_LOCK_SCREEN); |
668 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 668 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
669 EXPECT_EQ(ImeIdFromEngineId(ids[1]), // still Dvorak | 669 EXPECT_EQ(ImeIdFromEngineId(ids[1]), // still Dvorak |
670 manager_->GetCurrentInputMethod().id()); | 670 manager_->GetCurrentInputMethod().id()); |
671 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); | 671 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); |
672 // Switch back to Qwerty. | 672 // Switch back to Qwerty. |
673 manager_->SwitchToNextInputMethod(); | 673 manager_->SwitchToNextInputMethod(); |
674 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); | 674 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); |
675 EXPECT_EQ("us", keyboard_->last_layout_); | 675 EXPECT_EQ("us", keyboard_->last_layout_); |
676 | 676 |
677 // Unlock screen. The original state, Dvorak, is restored. | 677 // Unlock screen. The original state, Dvorak, is restored. |
678 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 678 manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); |
679 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 679 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
680 EXPECT_EQ(ImeIdFromEngineId(ids[1]), manager_->GetCurrentInputMethod().id()); | 680 EXPECT_EQ(ImeIdFromEngineId(ids[1]), manager_->GetCurrentInputMethod().id()); |
681 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); | 681 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); |
682 | 682 |
683 manager_->RemoveObserver(&observer); | 683 manager_->RemoveObserver(&observer); |
684 } | 684 } |
685 | 685 |
686 TEST_F(InputMethodManagerImplTest, SwitchInputMethodTest) { | 686 TEST_F(InputMethodManagerImplTest, SwitchInputMethodTest) { |
687 // For http://crbug.com/19655#c11 - (15). | 687 // For http://crbug.com/19655#c11 - (15). |
688 TestObserver observer; | 688 TestObserver observer; |
689 manager_->AddObserver(&observer); | 689 manager_->AddObserver(&observer); |
690 InitComponentExtension(); | 690 InitComponentExtension(); |
691 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 691 manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); |
692 std::vector<std::string> ids; | 692 std::vector<std::string> ids; |
693 ids.push_back(ImeIdFromEngineId("xkb:us:dvorak:eng")); | 693 ids.push_back(ImeIdFromEngineId("xkb:us:dvorak:eng")); |
694 ids.push_back(ImeIdFromEngineId(kExt2Engine2Id)); | 694 ids.push_back(ImeIdFromEngineId(kExt2Engine2Id)); |
695 ids.push_back(ImeIdFromEngineId(kExt2Engine1Id)); | 695 ids.push_back(ImeIdFromEngineId(kExt2Engine1Id)); |
696 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 696 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
697 EXPECT_EQ(3U, manager_->GetNumActiveInputMethods()); | 697 EXPECT_EQ(3U, manager_->GetNumActiveInputMethods()); |
698 EXPECT_EQ(1, observer.input_method_changed_count_); | 698 EXPECT_EQ(1, observer.input_method_changed_count_); |
699 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); | 699 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); |
700 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); | 700 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); |
701 | 701 |
702 // Switch to Mozc. | 702 // Switch to Mozc. |
703 manager_->SwitchToNextInputMethod(); | 703 manager_->SwitchToNextInputMethod(); |
704 EXPECT_EQ(2, observer.input_method_changed_count_); | 704 EXPECT_EQ(2, observer.input_method_changed_count_); |
705 EXPECT_EQ(ImeIdFromEngineId(ids[1]), manager_->GetCurrentInputMethod().id()); | 705 EXPECT_EQ(ImeIdFromEngineId(ids[1]), manager_->GetCurrentInputMethod().id()); |
706 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); | 706 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); |
707 | 707 |
708 // Lock screen | 708 // Lock screen |
709 manager_->SetState(InputMethodManager::STATE_LOCK_SCREEN); | 709 manager_->SetUISessionState(InputMethodManager::STATE_LOCK_SCREEN); |
710 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); // Qwerty+Dvorak. | 710 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); // Qwerty+Dvorak. |
711 EXPECT_EQ(ImeIdFromEngineId("xkb:us:dvorak:eng"), | 711 EXPECT_EQ(ImeIdFromEngineId("xkb:us:dvorak:eng"), |
712 manager_->GetCurrentInputMethod().id()); | 712 manager_->GetCurrentInputMethod().id()); |
713 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); | 713 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); |
714 manager_->SwitchToNextInputMethod(); | 714 manager_->SwitchToNextInputMethod(); |
715 EXPECT_EQ(ImeIdFromEngineId("xkb:us::eng"), // The hardware keyboard layout. | 715 EXPECT_EQ(ImeIdFromEngineId("xkb:us::eng"), // The hardware keyboard layout. |
716 manager_->GetCurrentInputMethod().id()); | 716 manager_->GetCurrentInputMethod().id()); |
717 EXPECT_EQ("us", keyboard_->last_layout_); | 717 EXPECT_EQ("us", keyboard_->last_layout_); |
718 | 718 |
719 // Unlock screen. The original state, pinyin-dv, is restored. | 719 // Unlock screen. The original state, pinyin-dv, is restored. |
720 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 720 manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); |
721 EXPECT_EQ(3U, manager_->GetNumActiveInputMethods()); // Dvorak and 2 IMEs. | 721 EXPECT_EQ(3U, manager_->GetNumActiveInputMethods()); // Dvorak and 2 IMEs. |
722 EXPECT_EQ(ImeIdFromEngineId(ids[1]), manager_->GetCurrentInputMethod().id()); | 722 EXPECT_EQ(ImeIdFromEngineId(ids[1]), manager_->GetCurrentInputMethod().id()); |
723 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); | 723 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); |
724 | 724 |
725 manager_->RemoveObserver(&observer); | 725 manager_->RemoveObserver(&observer); |
726 } | 726 } |
727 | 727 |
728 TEST_F(InputMethodManagerImplTest, TestXkbSetting) { | 728 TEST_F(InputMethodManagerImplTest, TestXkbSetting) { |
729 // For http://crbug.com/19655#c11 - (8), step 7-11. | 729 // For http://crbug.com/19655#c11 - (8), step 7-11. |
730 InitComponentExtension(); | 730 InitComponentExtension(); |
731 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 731 manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); |
732 std::vector<std::string> ids; | 732 std::vector<std::string> ids; |
733 ids.push_back(ImeIdFromEngineId("xkb:us:dvorak:eng")); | 733 ids.push_back(ImeIdFromEngineId("xkb:us:dvorak:eng")); |
734 ids.push_back(ImeIdFromEngineId("xkb:us:colemak:eng")); | 734 ids.push_back(ImeIdFromEngineId("xkb:us:colemak:eng")); |
735 ids.push_back(ImeIdFromEngineId(kNaclMozcJpId)); | 735 ids.push_back(ImeIdFromEngineId(kNaclMozcJpId)); |
736 ids.push_back(ImeIdFromEngineId(kNaclMozcUsId)); | 736 ids.push_back(ImeIdFromEngineId(kNaclMozcUsId)); |
737 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 737 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
738 EXPECT_EQ(4U, manager_->GetNumActiveInputMethods()); | 738 EXPECT_EQ(4U, manager_->GetNumActiveInputMethods()); |
739 EXPECT_EQ(1, keyboard_->set_current_keyboard_layout_by_name_count_); | 739 EXPECT_EQ(1, keyboard_->set_current_keyboard_layout_by_name_count_); |
740 // See input_methods.txt for an expected XKB layout name. | 740 // See input_methods.txt for an expected XKB layout name. |
741 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); | 741 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); |
(...skipping 29 matching lines...) Expand all Loading... |
771 | 771 |
772 // Key2 is not registered, so activated property should not be changed. | 772 // Key2 is not registered, so activated property should not be changed. |
773 manager_->ActivateInputMethodMenuItem("key2"); | 773 manager_->ActivateInputMethodMenuItem("key2"); |
774 EXPECT_EQ(kKey, mock_engine_handler_->last_activated_property()); | 774 EXPECT_EQ(kKey, mock_engine_handler_->last_activated_property()); |
775 } | 775 } |
776 | 776 |
777 TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodProperties) { | 777 TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodProperties) { |
778 InitComponentExtension(); | 778 InitComponentExtension(); |
779 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); | 779 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); |
780 | 780 |
781 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 781 manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); |
782 std::vector<std::string> ids; | 782 std::vector<std::string> ids; |
783 ids.push_back(ImeIdFromEngineId("xkb:us::eng")); | 783 ids.push_back(ImeIdFromEngineId("xkb:us::eng")); |
784 ids.push_back(ImeIdFromEngineId(kNaclMozcUsId)); | 784 ids.push_back(ImeIdFromEngineId(kNaclMozcUsId)); |
785 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 785 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
786 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 786 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
787 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); | 787 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); |
788 manager_->ChangeInputMethod(ImeIdFromEngineId(kNaclMozcUsId)); | 788 manager_->ChangeInputMethod(ImeIdFromEngineId(kNaclMozcUsId)); |
789 | 789 |
790 ash::ime::InputMethodMenuItemList current_property_list; | 790 ash::ime::InputMethodMenuItemList current_property_list; |
791 current_property_list.push_back(ash::ime::InputMethodMenuItem( | 791 current_property_list.push_back(ash::ime::InputMethodMenuItem( |
792 "key", "label", false, false)); | 792 "key", "label", false, false)); |
793 menu_manager_->SetCurrentInputMethodMenuItemList(current_property_list); | 793 menu_manager_->SetCurrentInputMethodMenuItemList(current_property_list); |
794 | 794 |
795 ASSERT_EQ(1U, menu_manager_->GetCurrentInputMethodMenuItemList().size()); | 795 ASSERT_EQ(1U, menu_manager_->GetCurrentInputMethodMenuItemList().size()); |
796 EXPECT_EQ("key", | 796 EXPECT_EQ("key", |
797 menu_manager_->GetCurrentInputMethodMenuItemList().at(0).key); | 797 menu_manager_->GetCurrentInputMethodMenuItemList().at(0).key); |
798 | 798 |
799 manager_->ChangeInputMethod("xkb:us::eng"); | 799 manager_->ChangeInputMethod("xkb:us::eng"); |
800 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); | 800 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); |
801 } | 801 } |
802 | 802 |
803 TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodPropertiesTwoImes) { | 803 TEST_F(InputMethodManagerImplTest, TestGetCurrentInputMethodPropertiesTwoImes) { |
804 InitComponentExtension(); | 804 InitComponentExtension(); |
805 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); | 805 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); |
806 | 806 |
807 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 807 manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); |
808 std::vector<std::string> ids; | 808 std::vector<std::string> ids; |
809 ids.push_back(ImeIdFromEngineId(kNaclMozcUsId)); // Japanese | 809 ids.push_back(ImeIdFromEngineId(kNaclMozcUsId)); // Japanese |
810 ids.push_back(ImeIdFromEngineId(kExt2Engine1Id)); // T-Chinese | 810 ids.push_back(ImeIdFromEngineId(kExt2Engine1Id)); // T-Chinese |
811 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 811 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
812 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 812 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
813 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); | 813 EXPECT_TRUE(menu_manager_->GetCurrentInputMethodMenuItemList().empty()); |
814 | 814 |
815 ash::ime::InputMethodMenuItemList current_property_list; | 815 ash::ime::InputMethodMenuItemList current_property_list; |
816 current_property_list.push_back(ash::ime::InputMethodMenuItem("key-mozc", | 816 current_property_list.push_back(ash::ime::InputMethodMenuItem("key-mozc", |
817 "label", | 817 "label", |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 EXPECT_EQ("us", keyboard_->last_layout_); | 1041 EXPECT_EQ("us", keyboard_->last_layout_); |
1042 EXPECT_TRUE(manager_->SwitchInputMethod( | 1042 EXPECT_TRUE(manager_->SwitchInputMethod( |
1043 ui::Accelerator(ui::VKEY_DBE_DBCSCHAR, ui::EF_NONE))); | 1043 ui::Accelerator(ui::VKEY_DBE_DBCSCHAR, ui::EF_NONE))); |
1044 EXPECT_EQ(ImeIdFromEngineId("xkb:jp::jpn"), | 1044 EXPECT_EQ(ImeIdFromEngineId("xkb:jp::jpn"), |
1045 manager_->GetCurrentInputMethod().id()); | 1045 manager_->GetCurrentInputMethod().id()); |
1046 EXPECT_EQ("jp", keyboard_->last_layout_); | 1046 EXPECT_EQ("jp", keyboard_->last_layout_); |
1047 } | 1047 } |
1048 | 1048 |
1049 TEST_F(InputMethodManagerImplTest, TestSwitchInputMethodWithJpIme) { | 1049 TEST_F(InputMethodManagerImplTest, TestSwitchInputMethodWithJpIme) { |
1050 InitComponentExtension(); | 1050 InitComponentExtension(); |
1051 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 1051 manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); |
1052 std::vector<std::string> ids; | 1052 std::vector<std::string> ids; |
1053 ids.push_back(ImeIdFromEngineId("xkb:jp::jpn")); | 1053 ids.push_back(ImeIdFromEngineId("xkb:jp::jpn")); |
1054 ids.push_back(ImeIdFromEngineId(kNaclMozcJpId)); | 1054 ids.push_back(ImeIdFromEngineId(kNaclMozcJpId)); |
1055 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 1055 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
1056 EXPECT_EQ(ImeIdFromEngineId("xkb:jp::jpn"), | 1056 EXPECT_EQ(ImeIdFromEngineId("xkb:jp::jpn"), |
1057 manager_->GetCurrentInputMethod().id()); | 1057 manager_->GetCurrentInputMethod().id()); |
1058 EXPECT_EQ("jp", keyboard_->last_layout_); | 1058 EXPECT_EQ("jp", keyboard_->last_layout_); |
1059 EXPECT_TRUE(manager_->SwitchInputMethod( | 1059 EXPECT_TRUE(manager_->SwitchInputMethod( |
1060 ui::Accelerator(ui::VKEY_DBE_DBCSCHAR, ui::EF_NONE))); | 1060 ui::Accelerator(ui::VKEY_DBE_DBCSCHAR, ui::EF_NONE))); |
1061 EXPECT_EQ(ImeIdFromEngineId(kNaclMozcJpId), | 1061 EXPECT_EQ(ImeIdFromEngineId(kNaclMozcJpId), |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 ui::Accelerator(ui::VKEY_DBE_SBCSCHAR, ui::EF_NONE))); | 1102 ui::Accelerator(ui::VKEY_DBE_SBCSCHAR, ui::EF_NONE))); |
1103 EXPECT_EQ(ImeIdFromEngineId("xkb:jp::jpn"), | 1103 EXPECT_EQ(ImeIdFromEngineId("xkb:jp::jpn"), |
1104 manager_->GetCurrentInputMethod().id()); | 1104 manager_->GetCurrentInputMethod().id()); |
1105 EXPECT_EQ("jp", keyboard_->last_layout_); | 1105 EXPECT_EQ("jp", keyboard_->last_layout_); |
1106 } | 1106 } |
1107 | 1107 |
1108 TEST_F(InputMethodManagerImplTest, TestAddRemoveExtensionInputMethods) { | 1108 TEST_F(InputMethodManagerImplTest, TestAddRemoveExtensionInputMethods) { |
1109 TestObserver observer; | 1109 TestObserver observer; |
1110 manager_->AddObserver(&observer); | 1110 manager_->AddObserver(&observer); |
1111 InitComponentExtension(); | 1111 InitComponentExtension(); |
1112 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 1112 manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); |
1113 std::vector<std::string> ids; | 1113 std::vector<std::string> ids; |
1114 ids.push_back(ImeIdFromEngineId("xkb:us:dvorak:eng")); | 1114 ids.push_back(ImeIdFromEngineId("xkb:us:dvorak:eng")); |
1115 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 1115 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
1116 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); | 1116 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); |
1117 EXPECT_EQ(1, observer.input_method_changed_count_); | 1117 EXPECT_EQ(1, observer.input_method_changed_count_); |
1118 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); | 1118 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); |
1119 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); | 1119 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); |
1120 | 1120 |
1121 // Add two Extension IMEs. | 1121 // Add two Extension IMEs. |
1122 std::vector<std::string> layouts; | 1122 std::vector<std::string> layouts; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 manager_->RemoveInputMethodExtension(kExtensionId1); | 1187 manager_->RemoveInputMethodExtension(kExtensionId1); |
1188 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 1188 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
1189 manager_->RemoveInputMethodExtension(kExtensionId2); | 1189 manager_->RemoveInputMethodExtension(kExtensionId2); |
1190 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); | 1190 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); |
1191 } | 1191 } |
1192 | 1192 |
1193 TEST_F(InputMethodManagerImplTest, TestAddExtensionInputThenLockScreen) { | 1193 TEST_F(InputMethodManagerImplTest, TestAddExtensionInputThenLockScreen) { |
1194 TestObserver observer; | 1194 TestObserver observer; |
1195 InitComponentExtension(); | 1195 InitComponentExtension(); |
1196 manager_->AddObserver(&observer); | 1196 manager_->AddObserver(&observer); |
1197 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 1197 manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); |
1198 std::vector<std::string> ids; | 1198 std::vector<std::string> ids; |
1199 ids.push_back(ImeIdFromEngineId("xkb:us::eng")); | 1199 ids.push_back(ImeIdFromEngineId("xkb:us::eng")); |
1200 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 1200 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
1201 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); | 1201 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); |
1202 EXPECT_EQ(1, observer.input_method_changed_count_); | 1202 EXPECT_EQ(1, observer.input_method_changed_count_); |
1203 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); | 1203 EXPECT_EQ(ImeIdFromEngineId(ids[0]), manager_->GetCurrentInputMethod().id()); |
1204 EXPECT_EQ("us", keyboard_->last_layout_); | 1204 EXPECT_EQ("us", keyboard_->last_layout_); |
1205 | 1205 |
1206 // Add an Extension IME. | 1206 // Add an Extension IME. |
1207 std::vector<std::string> layouts; | 1207 std::vector<std::string> layouts; |
(...skipping 25 matching lines...) Expand all Loading... |
1233 manager_->SetEnabledExtensionImes(&extension_ime_ids); | 1233 manager_->SetEnabledExtensionImes(&extension_ime_ids); |
1234 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 1234 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
1235 | 1235 |
1236 // Switch to the IME. | 1236 // Switch to the IME. |
1237 manager_->SwitchToNextInputMethod(); | 1237 manager_->SwitchToNextInputMethod(); |
1238 EXPECT_EQ(3, observer.input_method_changed_count_); | 1238 EXPECT_EQ(3, observer.input_method_changed_count_); |
1239 EXPECT_EQ(ext_id, manager_->GetCurrentInputMethod().id()); | 1239 EXPECT_EQ(ext_id, manager_->GetCurrentInputMethod().id()); |
1240 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); | 1240 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); |
1241 | 1241 |
1242 // Lock the screen. This is for crosbug.com/27049. | 1242 // Lock the screen. This is for crosbug.com/27049. |
1243 manager_->SetState(InputMethodManager::STATE_LOCK_SCREEN); | 1243 manager_->SetUISessionState(InputMethodManager::STATE_LOCK_SCREEN); |
1244 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); // Qwerty. No Ext. IME | 1244 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); // Qwerty. No Ext. IME |
1245 EXPECT_EQ(ImeIdFromEngineId("xkb:us::eng"), | 1245 EXPECT_EQ(ImeIdFromEngineId("xkb:us::eng"), |
1246 manager_->GetCurrentInputMethod().id()); | 1246 manager_->GetCurrentInputMethod().id()); |
1247 EXPECT_EQ("us", keyboard_->last_layout_); | 1247 EXPECT_EQ("us", keyboard_->last_layout_); |
1248 | 1248 |
1249 // Unlock the screen. | 1249 // Unlock the screen. |
1250 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 1250 manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); |
1251 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); | 1251 EXPECT_EQ(2U, manager_->GetNumActiveInputMethods()); |
1252 EXPECT_EQ(ext_id, manager_->GetCurrentInputMethod().id()); | 1252 EXPECT_EQ(ext_id, manager_->GetCurrentInputMethod().id()); |
1253 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); | 1253 EXPECT_EQ("us(dvorak)", keyboard_->last_layout_); |
1254 { | 1254 { |
1255 // This is for crosbug.com/27052. | 1255 // This is for crosbug.com/27052. |
1256 scoped_ptr<InputMethodDescriptors> methods( | 1256 scoped_ptr<InputMethodDescriptors> methods( |
1257 manager_->GetActiveInputMethods()); | 1257 manager_->GetActiveInputMethods()); |
1258 ASSERT_EQ(2U, methods->size()); | 1258 ASSERT_EQ(2U, methods->size()); |
1259 // Ext. IMEs should be at the end of the list. | 1259 // Ext. IMEs should be at the end of the list. |
1260 EXPECT_EQ(ext_id, methods->at(1).id()); | 1260 EXPECT_EQ(ext_id, methods->at(1).id()); |
1261 } | 1261 } |
1262 manager_->RemoveObserver(&observer); | 1262 manager_->RemoveObserver(&observer); |
1263 } | 1263 } |
1264 | 1264 |
1265 TEST_F(InputMethodManagerImplTest, | 1265 TEST_F(InputMethodManagerImplTest, |
1266 ChangeInputMethod_ComponenteExtensionOneIME) { | 1266 ChangeInputMethod_ComponenteExtensionOneIME) { |
1267 InitComponentExtension(); | 1267 InitComponentExtension(); |
1268 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 1268 manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); |
1269 const std::string ext_id = extension_ime_util::GetComponentInputMethodID( | 1269 const std::string ext_id = extension_ime_util::GetComponentInputMethodID( |
1270 ime_list_[1].id, | 1270 ime_list_[1].id, |
1271 ime_list_[1].engines[0].engine_id); | 1271 ime_list_[1].engines[0].engine_id); |
1272 std::vector<std::string> ids; | 1272 std::vector<std::string> ids; |
1273 ids.push_back(ext_id); | 1273 ids.push_back(ext_id); |
1274 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 1274 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
1275 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); | 1275 EXPECT_EQ(1U, manager_->GetNumActiveInputMethods()); |
1276 EXPECT_EQ(ext_id, manager_->GetCurrentInputMethod().id()); | 1276 EXPECT_EQ(ext_id, manager_->GetCurrentInputMethod().id()); |
1277 } | 1277 } |
1278 | 1278 |
1279 TEST_F(InputMethodManagerImplTest, | 1279 TEST_F(InputMethodManagerImplTest, |
1280 ChangeInputMethod_ComponenteExtensionTwoIME) { | 1280 ChangeInputMethod_ComponenteExtensionTwoIME) { |
1281 InitComponentExtension(); | 1281 InitComponentExtension(); |
1282 manager_->SetState(InputMethodManager::STATE_BROWSER_SCREEN); | 1282 manager_->SetUISessionState(InputMethodManager::STATE_BROWSER_SCREEN); |
1283 const std::string ext_id1 = extension_ime_util::GetComponentInputMethodID( | 1283 const std::string ext_id1 = extension_ime_util::GetComponentInputMethodID( |
1284 ime_list_[1].id, | 1284 ime_list_[1].id, |
1285 ime_list_[1].engines[0].engine_id); | 1285 ime_list_[1].engines[0].engine_id); |
1286 const std::string ext_id2 = extension_ime_util::GetComponentInputMethodID( | 1286 const std::string ext_id2 = extension_ime_util::GetComponentInputMethodID( |
1287 ime_list_[2].id, | 1287 ime_list_[2].id, |
1288 ime_list_[2].engines[0].engine_id); | 1288 ime_list_[2].engines[0].engine_id); |
1289 std::vector<std::string> ids; | 1289 std::vector<std::string> ids; |
1290 ids.push_back(ext_id1); | 1290 ids.push_back(ext_id1); |
1291 ids.push_back(ext_id2); | 1291 ids.push_back(ext_id2); |
1292 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); | 1292 EXPECT_TRUE(manager_->ReplaceEnabledInputMethods(ids)); |
(...skipping 18 matching lines...) Expand all Loading... |
1311 ASSERT_EQ(4U, input_method_ids.size()); | 1311 ASSERT_EQ(4U, input_method_ids.size()); |
1312 | 1312 |
1313 EXPECT_EQ(ImeIdFromEngineId("xkb:us::eng"), input_method_ids[0]); | 1313 EXPECT_EQ(ImeIdFromEngineId("xkb:us::eng"), input_method_ids[0]); |
1314 EXPECT_EQ(ImeIdFromEngineId("xkb:fr::fra"), input_method_ids[1]); | 1314 EXPECT_EQ(ImeIdFromEngineId("xkb:fr::fra"), input_method_ids[1]); |
1315 EXPECT_EQ("_comp_ime_asdf_pinyin", input_method_ids[2]); | 1315 EXPECT_EQ("_comp_ime_asdf_pinyin", input_method_ids[2]); |
1316 EXPECT_EQ(ImeIdFromEngineId("zh-t-i0-pinyin"), input_method_ids[3]); | 1316 EXPECT_EQ(ImeIdFromEngineId("zh-t-i0-pinyin"), input_method_ids[3]); |
1317 } | 1317 } |
1318 | 1318 |
1319 } // namespace input_method | 1319 } // namespace input_method |
1320 } // namespace chromeos | 1320 } // namespace chromeos |
OLD | NEW |