| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/bind_helpers.h" | 5 #include "base/bind_helpers.h" |
| 6 #include "chrome/browser/extensions/extension_browsertest.h" | 6 #include "chrome/browser/extensions/extension_browsertest.h" |
| 7 #include "chrome/browser/extensions/extension_test_message_listener.h" | 7 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 8 #include "chromeos/ime/component_extension_ime_manager.h" | 8 #include "chromeos/ime/component_extension_ime_manager.h" |
| 9 #include "chromeos/ime/ibus_text.h" | 9 #include "chromeos/ime/ibus_text.h" |
| 10 #include "chromeos/ime/input_method_descriptor.h" | 10 #include "chromeos/ime/input_method_descriptor.h" |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 "});"; | 530 "});"; |
| 531 ASSERT_TRUE(content::ExecuteScript( | 531 ASSERT_TRUE(content::ExecuteScript( |
| 532 host->host_contents(), | 532 host->host_contents(), |
| 533 set_candidate_window_properties_test_script)); | 533 set_candidate_window_properties_test_script)); |
| 534 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); | 534 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); |
| 535 | 535 |
| 536 // window visibility is kept as before. | 536 // window visibility is kept as before. |
| 537 EXPECT_TRUE( | 537 EXPECT_TRUE( |
| 538 mock_candidate_window->last_update_lookup_table_arg().is_visible); | 538 mock_candidate_window->last_update_lookup_table_arg().is_visible); |
| 539 | 539 |
| 540 const CandidateWindow& table = | 540 const ui::CandidateWindow& table = |
| 541 mock_candidate_window->last_update_lookup_table_arg().lookup_table; | 541 mock_candidate_window->last_update_lookup_table_arg().lookup_table; |
| 542 EXPECT_TRUE(table.is_cursor_visible()); | 542 EXPECT_TRUE(table.is_cursor_visible()); |
| 543 } | 543 } |
| 544 { | 544 { |
| 545 SCOPED_TRACE("setCandidateWindowProperties:vertical test"); | 545 SCOPED_TRACE("setCandidateWindowProperties:vertical test"); |
| 546 mock_input_context->Reset(); | 546 mock_input_context->Reset(); |
| 547 mock_candidate_window->Reset(); | 547 mock_candidate_window->Reset(); |
| 548 | 548 |
| 549 const char set_candidate_window_properties_test_script[] = | 549 const char set_candidate_window_properties_test_script[] = |
| 550 "chrome.input.ime.setCandidateWindowProperties({" | 550 "chrome.input.ime.setCandidateWindowProperties({" |
| 551 " engineID: engineBridge.getActiveEngineID()," | 551 " engineID: engineBridge.getActiveEngineID()," |
| 552 " properties: {" | 552 " properties: {" |
| 553 " vertical: true," | 553 " vertical: true," |
| 554 " }" | 554 " }" |
| 555 "});"; | 555 "});"; |
| 556 ASSERT_TRUE(content::ExecuteScript( | 556 ASSERT_TRUE(content::ExecuteScript( |
| 557 host->host_contents(), | 557 host->host_contents(), |
| 558 set_candidate_window_properties_test_script)); | 558 set_candidate_window_properties_test_script)); |
| 559 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); | 559 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); |
| 560 | 560 |
| 561 // window visibility is kept as before. | 561 // window visibility is kept as before. |
| 562 EXPECT_TRUE( | 562 EXPECT_TRUE( |
| 563 mock_candidate_window->last_update_lookup_table_arg().is_visible); | 563 mock_candidate_window->last_update_lookup_table_arg().is_visible); |
| 564 | 564 |
| 565 const CandidateWindow& table = | 565 const ui::CandidateWindow& table = |
| 566 mock_candidate_window->last_update_lookup_table_arg().lookup_table; | 566 mock_candidate_window->last_update_lookup_table_arg().lookup_table; |
| 567 | 567 |
| 568 // cursor visibility is kept as before. | 568 // cursor visibility is kept as before. |
| 569 EXPECT_TRUE(table.is_cursor_visible()); | 569 EXPECT_TRUE(table.is_cursor_visible()); |
| 570 | 570 |
| 571 EXPECT_EQ(CandidateWindow::VERTICAL, table.orientation()); | 571 EXPECT_EQ(ui::CandidateWindow::VERTICAL, table.orientation()); |
| 572 } | 572 } |
| 573 { | 573 { |
| 574 SCOPED_TRACE("setCandidateWindowProperties:pageSize test"); | 574 SCOPED_TRACE("setCandidateWindowProperties:pageSize test"); |
| 575 mock_input_context->Reset(); | 575 mock_input_context->Reset(); |
| 576 mock_candidate_window->Reset(); | 576 mock_candidate_window->Reset(); |
| 577 | 577 |
| 578 const char set_candidate_window_properties_test_script[] = | 578 const char set_candidate_window_properties_test_script[] = |
| 579 "chrome.input.ime.setCandidateWindowProperties({" | 579 "chrome.input.ime.setCandidateWindowProperties({" |
| 580 " engineID: engineBridge.getActiveEngineID()," | 580 " engineID: engineBridge.getActiveEngineID()," |
| 581 " properties: {" | 581 " properties: {" |
| 582 " pageSize: 7," | 582 " pageSize: 7," |
| 583 " }" | 583 " }" |
| 584 "});"; | 584 "});"; |
| 585 ASSERT_TRUE(content::ExecuteScript( | 585 ASSERT_TRUE(content::ExecuteScript( |
| 586 host->host_contents(), | 586 host->host_contents(), |
| 587 set_candidate_window_properties_test_script)); | 587 set_candidate_window_properties_test_script)); |
| 588 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); | 588 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); |
| 589 | 589 |
| 590 // window visibility is kept as before. | 590 // window visibility is kept as before. |
| 591 EXPECT_TRUE( | 591 EXPECT_TRUE( |
| 592 mock_candidate_window->last_update_lookup_table_arg().is_visible); | 592 mock_candidate_window->last_update_lookup_table_arg().is_visible); |
| 593 | 593 |
| 594 const CandidateWindow& table = | 594 const ui::CandidateWindow& table = |
| 595 mock_candidate_window->last_update_lookup_table_arg().lookup_table; | 595 mock_candidate_window->last_update_lookup_table_arg().lookup_table; |
| 596 | 596 |
| 597 // cursor visibility is kept as before. | 597 // cursor visibility is kept as before. |
| 598 EXPECT_TRUE(table.is_cursor_visible()); | 598 EXPECT_TRUE(table.is_cursor_visible()); |
| 599 | 599 |
| 600 // oritantation is kept as before. | 600 // oritantation is kept as before. |
| 601 EXPECT_EQ(CandidateWindow::VERTICAL, table.orientation()); | 601 EXPECT_EQ(ui::CandidateWindow::VERTICAL, table.orientation()); |
| 602 | 602 |
| 603 EXPECT_EQ(7U, table.page_size()); | 603 EXPECT_EQ(7U, table.page_size()); |
| 604 } | 604 } |
| 605 { | 605 { |
| 606 SCOPED_TRACE("setCandidateWindowProperties:auxTextVisibility test"); | 606 SCOPED_TRACE("setCandidateWindowProperties:auxTextVisibility test"); |
| 607 mock_input_context->Reset(); | 607 mock_input_context->Reset(); |
| 608 mock_candidate_window->Reset(); | 608 mock_candidate_window->Reset(); |
| 609 | 609 |
| 610 const char set_candidate_window_properties_test_script[] = | 610 const char set_candidate_window_properties_test_script[] = |
| 611 "chrome.input.ime.setCandidateWindowProperties({" | 611 "chrome.input.ime.setCandidateWindowProperties({" |
| 612 " engineID: engineBridge.getActiveEngineID()," | 612 " engineID: engineBridge.getActiveEngineID()," |
| 613 " properties: {" | 613 " properties: {" |
| 614 " auxiliaryTextVisible: true" | 614 " auxiliaryTextVisible: true" |
| 615 " }" | 615 " }" |
| 616 "});"; | 616 "});"; |
| 617 ASSERT_TRUE(content::ExecuteScript( | 617 ASSERT_TRUE(content::ExecuteScript( |
| 618 host->host_contents(), | 618 host->host_contents(), |
| 619 set_candidate_window_properties_test_script)); | 619 set_candidate_window_properties_test_script)); |
| 620 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); | 620 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); |
| 621 | 621 |
| 622 const input_method::CandidateWindow& table = | 622 const ui::CandidateWindow& table = |
| 623 mock_candidate_window->last_update_lookup_table_arg().lookup_table; | 623 mock_candidate_window->last_update_lookup_table_arg().lookup_table; |
| 624 EXPECT_TRUE(table.is_auxiliary_text_visible()); | 624 EXPECT_TRUE(table.is_auxiliary_text_visible()); |
| 625 } | 625 } |
| 626 { | 626 { |
| 627 SCOPED_TRACE("setCandidateWindowProperties:auxText test"); | 627 SCOPED_TRACE("setCandidateWindowProperties:auxText test"); |
| 628 mock_input_context->Reset(); | 628 mock_input_context->Reset(); |
| 629 mock_candidate_window->Reset(); | 629 mock_candidate_window->Reset(); |
| 630 | 630 |
| 631 const char set_candidate_window_properties_test_script[] = | 631 const char set_candidate_window_properties_test_script[] = |
| 632 "chrome.input.ime.setCandidateWindowProperties({" | 632 "chrome.input.ime.setCandidateWindowProperties({" |
| 633 " engineID: engineBridge.getActiveEngineID()," | 633 " engineID: engineBridge.getActiveEngineID()," |
| 634 " properties: {" | 634 " properties: {" |
| 635 " auxiliaryText: 'AUXILIARY_TEXT'" | 635 " auxiliaryText: 'AUXILIARY_TEXT'" |
| 636 " }" | 636 " }" |
| 637 "});"; | 637 "});"; |
| 638 ASSERT_TRUE(content::ExecuteScript( | 638 ASSERT_TRUE(content::ExecuteScript( |
| 639 host->host_contents(), | 639 host->host_contents(), |
| 640 set_candidate_window_properties_test_script)); | 640 set_candidate_window_properties_test_script)); |
| 641 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); | 641 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); |
| 642 | 642 |
| 643 // aux text visibility is kept as before. | 643 // aux text visibility is kept as before. |
| 644 const input_method::CandidateWindow& table = | 644 const ui::CandidateWindow& table = |
| 645 mock_candidate_window->last_update_lookup_table_arg().lookup_table; | 645 mock_candidate_window->last_update_lookup_table_arg().lookup_table; |
| 646 EXPECT_TRUE(table.is_auxiliary_text_visible()); | 646 EXPECT_TRUE(table.is_auxiliary_text_visible()); |
| 647 EXPECT_EQ("AUXILIARY_TEXT", table.auxiliary_text()); | 647 EXPECT_EQ("AUXILIARY_TEXT", table.auxiliary_text()); |
| 648 } | 648 } |
| 649 { | 649 { |
| 650 SCOPED_TRACE("setCandidates test"); | 650 SCOPED_TRACE("setCandidates test"); |
| 651 mock_input_context->Reset(); | 651 mock_input_context->Reset(); |
| 652 mock_candidate_window->Reset(); | 652 mock_candidate_window->Reset(); |
| 653 | 653 |
| 654 const char set_candidates_test_script[] = | 654 const char set_candidates_test_script[] = |
| (...skipping 22 matching lines...) Expand all Loading... |
| 677 " }" | 677 " }" |
| 678 " }]" | 678 " }]" |
| 679 "});"; | 679 "});"; |
| 680 ASSERT_TRUE(content::ExecuteScript(host->host_contents(), | 680 ASSERT_TRUE(content::ExecuteScript(host->host_contents(), |
| 681 set_candidates_test_script)); | 681 set_candidates_test_script)); |
| 682 | 682 |
| 683 // window visibility is kept as before. | 683 // window visibility is kept as before. |
| 684 EXPECT_TRUE( | 684 EXPECT_TRUE( |
| 685 mock_candidate_window->last_update_lookup_table_arg().is_visible); | 685 mock_candidate_window->last_update_lookup_table_arg().is_visible); |
| 686 | 686 |
| 687 const CandidateWindow& table = | 687 const ui::CandidateWindow& table = |
| 688 mock_candidate_window->last_update_lookup_table_arg().lookup_table; | 688 mock_candidate_window->last_update_lookup_table_arg().lookup_table; |
| 689 | 689 |
| 690 // cursor visibility is kept as before. | 690 // cursor visibility is kept as before. |
| 691 EXPECT_TRUE(table.is_cursor_visible()); | 691 EXPECT_TRUE(table.is_cursor_visible()); |
| 692 | 692 |
| 693 // oritantation is kept as before. | 693 // oritantation is kept as before. |
| 694 EXPECT_EQ(CandidateWindow::VERTICAL, table.orientation()); | 694 EXPECT_EQ(ui::CandidateWindow::VERTICAL, table.orientation()); |
| 695 | 695 |
| 696 // page size is kept as before. | 696 // page size is kept as before. |
| 697 EXPECT_EQ(7U, table.page_size()); | 697 EXPECT_EQ(7U, table.page_size()); |
| 698 | 698 |
| 699 ASSERT_EQ(4U, table.candidates().size()); | 699 ASSERT_EQ(4U, table.candidates().size()); |
| 700 | 700 |
| 701 EXPECT_EQ("CANDIDATE_1", table.candidates().at(0).value); | 701 EXPECT_EQ("CANDIDATE_1", table.candidates().at(0).value); |
| 702 | 702 |
| 703 EXPECT_EQ("CANDIDATE_2", table.candidates().at(1).value); | 703 EXPECT_EQ("CANDIDATE_2", table.candidates().at(1).value); |
| 704 EXPECT_EQ("LABEL_2", table.candidates().at(1).label); | 704 EXPECT_EQ("LABEL_2", table.candidates().at(1).label); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 724 " candidateID: 2" | 724 " candidateID: 2" |
| 725 "});"; | 725 "});"; |
| 726 ASSERT_TRUE(content::ExecuteScript( | 726 ASSERT_TRUE(content::ExecuteScript( |
| 727 host->host_contents(), set_cursor_position_test_script)); | 727 host->host_contents(), set_cursor_position_test_script)); |
| 728 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); | 728 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); |
| 729 | 729 |
| 730 // window visibility is kept as before. | 730 // window visibility is kept as before. |
| 731 EXPECT_TRUE( | 731 EXPECT_TRUE( |
| 732 mock_candidate_window->last_update_lookup_table_arg().is_visible); | 732 mock_candidate_window->last_update_lookup_table_arg().is_visible); |
| 733 | 733 |
| 734 const CandidateWindow& table = | 734 const ui::CandidateWindow& table = |
| 735 mock_candidate_window->last_update_lookup_table_arg().lookup_table; | 735 mock_candidate_window->last_update_lookup_table_arg().lookup_table; |
| 736 | 736 |
| 737 // cursor visibility is kept as before. | 737 // cursor visibility is kept as before. |
| 738 EXPECT_TRUE(table.is_cursor_visible()); | 738 EXPECT_TRUE(table.is_cursor_visible()); |
| 739 | 739 |
| 740 // oritantation is kept as before. | 740 // oritantation is kept as before. |
| 741 EXPECT_EQ(CandidateWindow::VERTICAL, table.orientation()); | 741 EXPECT_EQ(ui::CandidateWindow::VERTICAL, table.orientation()); |
| 742 | 742 |
| 743 // page size is kept as before. | 743 // page size is kept as before. |
| 744 EXPECT_EQ(7U, table.page_size()); | 744 EXPECT_EQ(7U, table.page_size()); |
| 745 | 745 |
| 746 // candidates are same as before. | 746 // candidates are same as before. |
| 747 ASSERT_EQ(4U, table.candidates().size()); | 747 ASSERT_EQ(4U, table.candidates().size()); |
| 748 | 748 |
| 749 // Candidate ID == 2 is 1 in index. | 749 // Candidate ID == 2 is 1 in index. |
| 750 EXPECT_EQ(1U, table.cursor_position()); | 750 EXPECT_EQ(1U, table.cursor_position()); |
| 751 } | 751 } |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 } | 878 } |
| 879 } | 879 } |
| 880 | 880 |
| 881 IBusBridge::Get()->SetInputContextHandler(NULL); | 881 IBusBridge::Get()->SetInputContextHandler(NULL); |
| 882 IBusBridge::Get()->SetCandidateWindowHandler(NULL); | 882 IBusBridge::Get()->SetCandidateWindowHandler(NULL); |
| 883 } | 883 } |
| 884 | 884 |
| 885 } // namespace | 885 } // namespace |
| 886 } // namespace input_method | 886 } // namespace input_method |
| 887 } // namespace chromeos | 887 } // namespace chromeos |
| OLD | NEW |