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 "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 "chrome/common/extensions/background_info.h" | 8 #include "chrome/common/extensions/background_info.h" |
9 #include "chromeos/dbus/ibus/ibus_text.h" | 9 #include "chromeos/dbus/ibus/ibus_text.h" |
10 #include "chromeos/ime/component_extension_ime_manager.h" | 10 #include "chromeos/ime/component_extension_ime_manager.h" |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 "});"; | 494 "});"; |
495 ASSERT_TRUE(content::ExecuteScript( | 495 ASSERT_TRUE(content::ExecuteScript( |
496 host->host_contents(), | 496 host->host_contents(), |
497 set_candidate_window_properties_test_script)); | 497 set_candidate_window_properties_test_script)); |
498 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); | 498 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); |
499 | 499 |
500 // window visibility is kept as before. | 500 // window visibility is kept as before. |
501 EXPECT_TRUE( | 501 EXPECT_TRUE( |
502 mock_candidate_window->last_update_lookup_table_arg().is_visible); | 502 mock_candidate_window->last_update_lookup_table_arg().is_visible); |
503 | 503 |
504 const IBusLookupTable& table = | 504 const CandidateWindow& table = |
505 mock_candidate_window->last_update_lookup_table_arg().lookup_table; | 505 mock_candidate_window->last_update_lookup_table_arg().lookup_table; |
506 EXPECT_TRUE(table.is_cursor_visible()); | 506 EXPECT_TRUE(table.is_cursor_visible()); |
507 } | 507 } |
508 { | 508 { |
509 SCOPED_TRACE("setCandidateWindowProperties:vertical test"); | 509 SCOPED_TRACE("setCandidateWindowProperties:vertical test"); |
510 mock_input_context->Reset(); | 510 mock_input_context->Reset(); |
511 mock_candidate_window->Reset(); | 511 mock_candidate_window->Reset(); |
512 mock_property->Reset(); | 512 mock_property->Reset(); |
513 | 513 |
514 const char set_candidate_window_properties_test_script[] = | 514 const char set_candidate_window_properties_test_script[] = |
515 "chrome.input.ime.setCandidateWindowProperties({" | 515 "chrome.input.ime.setCandidateWindowProperties({" |
516 " engineID: engineBridge.getActiveEngineID()," | 516 " engineID: engineBridge.getActiveEngineID()," |
517 " properties: {" | 517 " properties: {" |
518 " vertical: true," | 518 " vertical: true," |
519 " }" | 519 " }" |
520 "});"; | 520 "});"; |
521 ASSERT_TRUE(content::ExecuteScript( | 521 ASSERT_TRUE(content::ExecuteScript( |
522 host->host_contents(), | 522 host->host_contents(), |
523 set_candidate_window_properties_test_script)); | 523 set_candidate_window_properties_test_script)); |
524 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); | 524 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); |
525 | 525 |
526 // window visibility is kept as before. | 526 // window visibility is kept as before. |
527 EXPECT_TRUE( | 527 EXPECT_TRUE( |
528 mock_candidate_window->last_update_lookup_table_arg().is_visible); | 528 mock_candidate_window->last_update_lookup_table_arg().is_visible); |
529 | 529 |
530 const IBusLookupTable& table = | 530 const CandidateWindow& table = |
531 mock_candidate_window->last_update_lookup_table_arg().lookup_table; | 531 mock_candidate_window->last_update_lookup_table_arg().lookup_table; |
532 | 532 |
533 // cursor visibility is kept as before. | 533 // cursor visibility is kept as before. |
534 EXPECT_TRUE(table.is_cursor_visible()); | 534 EXPECT_TRUE(table.is_cursor_visible()); |
535 | 535 |
536 EXPECT_EQ(IBusLookupTable::VERTICAL, table.orientation()); | 536 EXPECT_EQ(CandidateWindow::VERTICAL, table.orientation()); |
537 } | 537 } |
538 { | 538 { |
539 SCOPED_TRACE("setCandidateWindowProperties:pageSize test"); | 539 SCOPED_TRACE("setCandidateWindowProperties:pageSize test"); |
540 mock_input_context->Reset(); | 540 mock_input_context->Reset(); |
541 mock_candidate_window->Reset(); | 541 mock_candidate_window->Reset(); |
542 mock_property->Reset(); | 542 mock_property->Reset(); |
543 | 543 |
544 const char set_candidate_window_properties_test_script[] = | 544 const char set_candidate_window_properties_test_script[] = |
545 "chrome.input.ime.setCandidateWindowProperties({" | 545 "chrome.input.ime.setCandidateWindowProperties({" |
546 " engineID: engineBridge.getActiveEngineID()," | 546 " engineID: engineBridge.getActiveEngineID()," |
547 " properties: {" | 547 " properties: {" |
548 " pageSize: 7," | 548 " pageSize: 7," |
549 " }" | 549 " }" |
550 "});"; | 550 "});"; |
551 ASSERT_TRUE(content::ExecuteScript( | 551 ASSERT_TRUE(content::ExecuteScript( |
552 host->host_contents(), | 552 host->host_contents(), |
553 set_candidate_window_properties_test_script)); | 553 set_candidate_window_properties_test_script)); |
554 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); | 554 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); |
555 | 555 |
556 // window visibility is kept as before. | 556 // window visibility is kept as before. |
557 EXPECT_TRUE( | 557 EXPECT_TRUE( |
558 mock_candidate_window->last_update_lookup_table_arg().is_visible); | 558 mock_candidate_window->last_update_lookup_table_arg().is_visible); |
559 | 559 |
560 const IBusLookupTable& table = | 560 const CandidateWindow& table = |
561 mock_candidate_window->last_update_lookup_table_arg().lookup_table; | 561 mock_candidate_window->last_update_lookup_table_arg().lookup_table; |
562 | 562 |
563 // cursor visibility is kept as before. | 563 // cursor visibility is kept as before. |
564 EXPECT_TRUE(table.is_cursor_visible()); | 564 EXPECT_TRUE(table.is_cursor_visible()); |
565 | 565 |
566 // oritantation is kept as before. | 566 // oritantation is kept as before. |
567 EXPECT_EQ(IBusLookupTable::VERTICAL, table.orientation()); | 567 EXPECT_EQ(CandidateWindow::VERTICAL, table.orientation()); |
568 | 568 |
569 EXPECT_EQ(7U, table.page_size()); | 569 EXPECT_EQ(7U, table.page_size()); |
570 } | 570 } |
571 { | 571 { |
572 SCOPED_TRACE("setCandidateWindowProperties:auxTextVisibility test"); | 572 SCOPED_TRACE("setCandidateWindowProperties:auxTextVisibility test"); |
573 mock_input_context->Reset(); | 573 mock_input_context->Reset(); |
574 mock_candidate_window->Reset(); | 574 mock_candidate_window->Reset(); |
575 mock_property->Reset(); | 575 mock_property->Reset(); |
576 | 576 |
577 const char set_candidate_window_properties_test_script[] = | 577 const char set_candidate_window_properties_test_script[] = |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 " }" | 645 " }" |
646 " }]" | 646 " }]" |
647 "});"; | 647 "});"; |
648 ASSERT_TRUE(content::ExecuteScript(host->host_contents(), | 648 ASSERT_TRUE(content::ExecuteScript(host->host_contents(), |
649 set_candidates_test_script)); | 649 set_candidates_test_script)); |
650 | 650 |
651 // window visibility is kept as before. | 651 // window visibility is kept as before. |
652 EXPECT_TRUE( | 652 EXPECT_TRUE( |
653 mock_candidate_window->last_update_lookup_table_arg().is_visible); | 653 mock_candidate_window->last_update_lookup_table_arg().is_visible); |
654 | 654 |
655 const IBusLookupTable& table = | 655 const CandidateWindow& table = |
656 mock_candidate_window->last_update_lookup_table_arg().lookup_table; | 656 mock_candidate_window->last_update_lookup_table_arg().lookup_table; |
657 | 657 |
658 // cursor visibility is kept as before. | 658 // cursor visibility is kept as before. |
659 EXPECT_TRUE(table.is_cursor_visible()); | 659 EXPECT_TRUE(table.is_cursor_visible()); |
660 | 660 |
661 // oritantation is kept as before. | 661 // oritantation is kept as before. |
662 EXPECT_EQ(IBusLookupTable::VERTICAL, table.orientation()); | 662 EXPECT_EQ(CandidateWindow::VERTICAL, table.orientation()); |
663 | 663 |
664 // page size is kept as before. | 664 // page size is kept as before. |
665 EXPECT_EQ(7U, table.page_size()); | 665 EXPECT_EQ(7U, table.page_size()); |
666 | 666 |
667 ASSERT_EQ(4U, table.candidates().size()); | 667 ASSERT_EQ(4U, table.candidates().size()); |
668 | 668 |
669 EXPECT_EQ("CANDIDATE_1", table.candidates().at(0).value); | 669 EXPECT_EQ("CANDIDATE_1", table.candidates().at(0).value); |
670 | 670 |
671 EXPECT_EQ("CANDIDATE_2", table.candidates().at(1).value); | 671 EXPECT_EQ("CANDIDATE_2", table.candidates().at(1).value); |
672 EXPECT_EQ("LABEL_2", table.candidates().at(1).label); | 672 EXPECT_EQ("LABEL_2", table.candidates().at(1).label); |
(...skipping 20 matching lines...) Expand all Loading... |
693 " candidateID: 2" | 693 " candidateID: 2" |
694 "});"; | 694 "});"; |
695 ASSERT_TRUE(content::ExecuteScript( | 695 ASSERT_TRUE(content::ExecuteScript( |
696 host->host_contents(), set_cursor_position_test_script)); | 696 host->host_contents(), set_cursor_position_test_script)); |
697 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); | 697 EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); |
698 | 698 |
699 // window visibility is kept as before. | 699 // window visibility is kept as before. |
700 EXPECT_TRUE( | 700 EXPECT_TRUE( |
701 mock_candidate_window->last_update_lookup_table_arg().is_visible); | 701 mock_candidate_window->last_update_lookup_table_arg().is_visible); |
702 | 702 |
703 const IBusLookupTable& table = | 703 const CandidateWindow& table = |
704 mock_candidate_window->last_update_lookup_table_arg().lookup_table; | 704 mock_candidate_window->last_update_lookup_table_arg().lookup_table; |
705 | 705 |
706 // cursor visibility is kept as before. | 706 // cursor visibility is kept as before. |
707 EXPECT_TRUE(table.is_cursor_visible()); | 707 EXPECT_TRUE(table.is_cursor_visible()); |
708 | 708 |
709 // oritantation is kept as before. | 709 // oritantation is kept as before. |
710 EXPECT_EQ(IBusLookupTable::VERTICAL, table.orientation()); | 710 EXPECT_EQ(CandidateWindow::VERTICAL, table.orientation()); |
711 | 711 |
712 // page size is kept as before. | 712 // page size is kept as before. |
713 EXPECT_EQ(7U, table.page_size()); | 713 EXPECT_EQ(7U, table.page_size()); |
714 | 714 |
715 // candidates are same as before. | 715 // candidates are same as before. |
716 ASSERT_EQ(4U, table.candidates().size()); | 716 ASSERT_EQ(4U, table.candidates().size()); |
717 | 717 |
718 // Candidate ID == 2 is 1 in index. | 718 // Candidate ID == 2 is 1 in index. |
719 EXPECT_EQ(1U, table.cursor_position()); | 719 EXPECT_EQ(1U, table.cursor_position()); |
720 } | 720 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 mock_input_context->last_delete_surrounding_text_arg().length); | 796 mock_input_context->last_delete_surrounding_text_arg().length); |
797 } | 797 } |
798 IBusBridge::Get()->SetInputContextHandler(NULL); | 798 IBusBridge::Get()->SetInputContextHandler(NULL); |
799 IBusBridge::Get()->SetCandidateWindowHandler(NULL); | 799 IBusBridge::Get()->SetCandidateWindowHandler(NULL); |
800 IBusBridge::Get()->SetPropertyHandler(NULL); | 800 IBusBridge::Get()->SetPropertyHandler(NULL); |
801 } | 801 } |
802 | 802 |
803 } // namespace | 803 } // namespace |
804 } // namespace input_method | 804 } // namespace input_method |
805 } // namespace chromeos | 805 } // namespace chromeos |
OLD | NEW |