OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 #include "content/public/test/test_utils.h" | 51 #include "content/public/test/test_utils.h" |
52 #include "net/url_request/test_url_fetcher_factory.h" | 52 #include "net/url_request/test_url_fetcher_factory.h" |
53 #include "testing/gmock/include/gmock/gmock.h" | 53 #include "testing/gmock/include/gmock/gmock.h" |
54 #include "testing/gtest/include/gtest/gtest.h" | 54 #include "testing/gtest/include/gtest/gtest.h" |
55 #include "ui/events/keycodes/keyboard_codes.h" | 55 #include "ui/events/keycodes/keyboard_codes.h" |
56 | 56 |
57 using base::ASCIIToUTF16; | 57 using base::ASCIIToUTF16; |
58 | 58 |
59 namespace autofill { | 59 namespace autofill { |
60 | 60 |
61 static const char* kDataURIPrefix = "data:text/html;charset=utf-8,"; | 61 static const char kDataURIPrefix[] = "data:text/html;charset=utf-8,"; |
62 static const char* kTestFormString = | 62 static const char kTestFormString[] = |
63 "<form action=\"http://www.example.com/\" method=\"POST\">" | 63 "<form action=\"http://www.example.com/\" method=\"POST\">" |
64 "<label for=\"firstname\">First name:</label>" | 64 "<label for=\"firstname\">First name:</label>" |
65 " <input type=\"text\" id=\"firstname\"" | 65 " <input type=\"text\" id=\"firstname\"" |
66 " onFocus=\"domAutomationController.send(true)\"><br>" | 66 " onfocus=\"domAutomationController.send(true)\"><br>" |
67 "<label for=\"lastname\">Last name:</label>" | 67 "<label for=\"lastname\">Last name:</label>" |
68 " <input type=\"text\" id=\"lastname\"><br>" | 68 " <input type=\"text\" id=\"lastname\"><br>" |
69 "<label for=\"address1\">Address line 1:</label>" | 69 "<label for=\"address1\">Address line 1:</label>" |
70 " <input type=\"text\" id=\"address1\"><br>" | 70 " <input type=\"text\" id=\"address1\"><br>" |
71 "<label for=\"address2\">Address line 2:</label>" | 71 "<label for=\"address2\">Address line 2:</label>" |
72 " <input type=\"text\" id=\"address2\"><br>" | 72 " <input type=\"text\" id=\"address2\"><br>" |
73 "<label for=\"city\">City:</label>" | 73 "<label for=\"city\">City:</label>" |
74 " <input type=\"text\" id=\"city\"><br>" | 74 " <input type=\"text\" id=\"city\"><br>" |
75 "<label for=\"state\">State:</label>" | 75 "<label for=\"state\">State:</label>" |
76 " <select id=\"state\">" | 76 " <select id=\"state\">" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 // form. | 482 // form. |
483 SendKeyToPopupAndWait(ui::VKEY_DOWN); | 483 SendKeyToPopupAndWait(ui::VKEY_DOWN); |
484 | 484 |
485 // Press tab to accept the autofill suggestions. | 485 // Press tab to accept the autofill suggestions. |
486 SendKeyToPopupAndWait(ui::VKEY_TAB); | 486 SendKeyToPopupAndWait(ui::VKEY_TAB); |
487 | 487 |
488 // The form should be filled. | 488 // The form should be filled. |
489 ExpectFilledTestForm(); | 489 ExpectFilledTestForm(); |
490 } | 490 } |
491 | 491 |
492 // Test that a JavaScript onchange event is fired after auto-filling a form. | 492 // Test that a JavaScript oninput event is fired after auto-filling a form. |
493 // Temporarily disabled for crbug.com/353691. | 493 IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, OnInputAfterAutofill) { |
494 IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, | |
495 DISABLED_OnChangeAfterAutofill) { | |
496 CreateTestProfile(); | 494 CreateTestProfile(); |
497 | 495 |
498 const char* kOnChangeScript = | 496 const char kOnInputScript[] = |
499 "<script>" | 497 "<script>" |
500 "focused_fired = false;" | 498 "focused_fired = false;" |
501 "unfocused_fired = false;" | 499 "unfocused_fired = false;" |
| 500 "changed_select_fired = false;" |
| 501 "unchanged_select_fired = false;" |
| 502 "document.getElementById('firstname').oninput = function() {" |
| 503 " focused_fired = true;" |
| 504 "};" |
| 505 "document.getElementById('lastname').oninput = function() {" |
| 506 " unfocused_fired = true;" |
| 507 "};" |
| 508 "document.getElementById('state').oninput = function() {" |
| 509 " changed_select_fired = true;" |
| 510 "};" |
| 511 "document.getElementById('country').oninput = function() {" |
| 512 " unchanged_select_fired = true;" |
| 513 "};" |
| 514 "document.getElementById('country').value = 'US';" |
| 515 "</script>"; |
| 516 |
| 517 // Load the test page. |
| 518 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), |
| 519 GURL(std::string(kDataURIPrefix) + kTestFormString + kOnInputScript))); |
| 520 |
| 521 // Invoke Autofill. |
| 522 FocusFirstNameField(); |
| 523 |
| 524 // Start filling the first name field with "M" and wait for the popup to be |
| 525 // shown. |
| 526 SendKeyToPageAndWait(ui::VKEY_M); |
| 527 |
| 528 // Press the down arrow to select the suggestion and preview the autofilled |
| 529 // form. |
| 530 SendKeyToPopupAndWait(ui::VKEY_DOWN); |
| 531 |
| 532 // Press Enter to accept the autofill suggestions. |
| 533 SendKeyToPopupAndWait(ui::VKEY_RETURN); |
| 534 |
| 535 // The form should be filled. |
| 536 ExpectFilledTestForm(); |
| 537 |
| 538 bool focused_fired = false; |
| 539 bool unfocused_fired = false; |
| 540 bool changed_select_fired = false; |
| 541 bool unchanged_select_fired = false; |
| 542 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| 543 GetRenderViewHost(), |
| 544 "domAutomationController.send(focused_fired);", |
| 545 &focused_fired)); |
| 546 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| 547 GetRenderViewHost(), |
| 548 "domAutomationController.send(unfocused_fired);", |
| 549 &unfocused_fired)); |
| 550 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| 551 GetRenderViewHost(), |
| 552 "domAutomationController.send(changed_select_fired);", |
| 553 &changed_select_fired)); |
| 554 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
| 555 GetRenderViewHost(), |
| 556 "domAutomationController.send(unchanged_select_fired);", |
| 557 &unchanged_select_fired)); |
| 558 EXPECT_TRUE(focused_fired); |
| 559 EXPECT_TRUE(unfocused_fired); |
| 560 EXPECT_TRUE(changed_select_fired); |
| 561 EXPECT_FALSE(unchanged_select_fired); |
| 562 } |
| 563 |
| 564 // Test that a JavaScript onchange event is fired after auto-filling a form. |
| 565 IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, OnChangeAfterAutofill) { |
| 566 CreateTestProfile(); |
| 567 |
| 568 const char kOnChangeScript[] = |
| 569 "<script>" |
| 570 "focused_fired = false;" |
| 571 "unfocused_fired = false;" |
502 "changed_select_fired = false;" | 572 "changed_select_fired = false;" |
503 "unchanged_select_fired = false;" | 573 "unchanged_select_fired = false;" |
504 "document.getElementById('firstname').onchange = function() {" | 574 "document.getElementById('firstname').onchange = function() {" |
505 " focused_fired = true;" | 575 " focused_fired = true;" |
506 "};" | 576 "};" |
507 "document.getElementById('lastname').onchange = function() {" | 577 "document.getElementById('lastname').onchange = function() {" |
508 " unfocused_fired = true;" | 578 " unfocused_fired = true;" |
509 "};" | 579 "};" |
510 "document.getElementById('state').onchange = function() {" | 580 "document.getElementById('state').onchange = function() {" |
511 " changed_select_fired = true;" | 581 " changed_select_fired = true;" |
(...skipping 18 matching lines...) Expand all Loading... |
530 // Press the down arrow to select the suggestion and preview the autofilled | 600 // Press the down arrow to select the suggestion and preview the autofilled |
531 // form. | 601 // form. |
532 SendKeyToPopupAndWait(ui::VKEY_DOWN); | 602 SendKeyToPopupAndWait(ui::VKEY_DOWN); |
533 | 603 |
534 // Press Enter to accept the autofill suggestions. | 604 // Press Enter to accept the autofill suggestions. |
535 SendKeyToPopupAndWait(ui::VKEY_RETURN); | 605 SendKeyToPopupAndWait(ui::VKEY_RETURN); |
536 | 606 |
537 // The form should be filled. | 607 // The form should be filled. |
538 ExpectFilledTestForm(); | 608 ExpectFilledTestForm(); |
539 | 609 |
540 // The change event should have already fired for unfocused fields, both of | |
541 // <input> and of <select> type. However, it should not yet have fired for the | |
542 // focused field. | |
543 bool focused_fired = false; | 610 bool focused_fired = false; |
544 bool unfocused_fired = false; | 611 bool unfocused_fired = false; |
545 bool changed_select_fired = false; | 612 bool changed_select_fired = false; |
546 bool unchanged_select_fired = false; | 613 bool unchanged_select_fired = false; |
547 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 614 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
548 GetRenderViewHost(), | 615 GetRenderViewHost(), |
549 "domAutomationController.send(focused_fired);", | 616 "domAutomationController.send(focused_fired);", |
550 &focused_fired)); | 617 &focused_fired)); |
551 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 618 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
552 GetRenderViewHost(), | 619 GetRenderViewHost(), |
553 "domAutomationController.send(unfocused_fired);", | 620 "domAutomationController.send(unfocused_fired);", |
554 &unfocused_fired)); | 621 &unfocused_fired)); |
555 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 622 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
556 GetRenderViewHost(), | 623 GetRenderViewHost(), |
557 "domAutomationController.send(changed_select_fired);", | 624 "domAutomationController.send(changed_select_fired);", |
558 &changed_select_fired)); | 625 &changed_select_fired)); |
559 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 626 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( |
560 GetRenderViewHost(), | 627 GetRenderViewHost(), |
561 "domAutomationController.send(unchanged_select_fired);", | 628 "domAutomationController.send(unchanged_select_fired);", |
562 &unchanged_select_fired)); | 629 &unchanged_select_fired)); |
563 EXPECT_FALSE(focused_fired); | 630 EXPECT_TRUE(focused_fired); |
564 EXPECT_TRUE(unfocused_fired); | 631 EXPECT_TRUE(unfocused_fired); |
565 EXPECT_TRUE(changed_select_fired); | 632 EXPECT_TRUE(changed_select_fired); |
566 EXPECT_FALSE(unchanged_select_fired); | 633 EXPECT_FALSE(unchanged_select_fired); |
| 634 } |
567 | 635 |
568 // Unfocus the first name field. Its change event should fire. | 636 IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, InputFiresBeforeChange) { |
569 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( | 637 CreateTestProfile(); |
| 638 |
| 639 const char kInputFiresBeforeChangeScript[] = |
| 640 "<script>" |
| 641 "inputElementEvents = [];" |
| 642 "function recordInputElementEvent(e) {" |
| 643 " if (e.target.tagName != 'INPUT') throw 'only <input> tags allowed';" |
| 644 " inputElementEvents.push(e.type);" |
| 645 "}" |
| 646 "selectElementEvents = [];" |
| 647 "function recordSelectElementEvent(e) {" |
| 648 " if (e.target.tagName != 'SELECT') throw 'only <select> tags allowed';" |
| 649 " selectElementEvents.push(e.type);" |
| 650 "}" |
| 651 "document.getElementById('lastname').oninput = recordInputElementEvent;" |
| 652 "document.getElementById('lastname').onchange = recordInputElementEvent;" |
| 653 "document.getElementById('country').oninput = recordSelectElementEvent;" |
| 654 "document.getElementById('country').onchange = recordSelectElementEvent;" |
| 655 "</script>"; |
| 656 |
| 657 // Load the test page. |
| 658 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), |
| 659 GURL(std::string(kDataURIPrefix) + kTestFormString + |
| 660 kInputFiresBeforeChangeScript))); |
| 661 |
| 662 // Invoke and accept the Autofill popup and verify the form was filled. |
| 663 FocusFirstNameField(); |
| 664 SendKeyToPageAndWait(ui::VKEY_M); |
| 665 SendKeyToPopupAndWait(ui::VKEY_DOWN); |
| 666 SendKeyToPopupAndWait(ui::VKEY_RETURN); |
| 667 ExpectFilledTestForm(); |
| 668 |
| 669 int num_input_element_events = -1; |
| 670 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( |
570 GetRenderViewHost(), | 671 GetRenderViewHost(), |
571 "document.getElementById('firstname').blur();" | 672 "domAutomationController.send(inputElementEvents.length);", |
572 "domAutomationController.send(focused_fired);", &focused_fired)); | 673 &num_input_element_events)); |
573 EXPECT_TRUE(focused_fired); | 674 EXPECT_EQ(2, num_input_element_events); |
| 675 |
| 676 std::vector<std::string> input_element_events; |
| 677 input_element_events.resize(2); |
| 678 |
| 679 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
| 680 GetRenderViewHost(), |
| 681 "domAutomationController.send(inputElementEvents[0]);", |
| 682 &input_element_events[0])); |
| 683 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
| 684 GetRenderViewHost(), |
| 685 "domAutomationController.send(inputElementEvents[1]);", |
| 686 &input_element_events[1])); |
| 687 |
| 688 EXPECT_EQ("input", input_element_events[0]); |
| 689 EXPECT_EQ("change", input_element_events[1]); |
| 690 |
| 691 int num_select_element_events = -1; |
| 692 ASSERT_TRUE(content::ExecuteScriptAndExtractInt( |
| 693 GetRenderViewHost(), |
| 694 "domAutomationController.send(selectElementEvents.length);", |
| 695 &num_select_element_events)); |
| 696 EXPECT_EQ(2, num_select_element_events); |
| 697 |
| 698 std::vector<std::string> select_element_events; |
| 699 select_element_events.resize(2); |
| 700 |
| 701 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
| 702 GetRenderViewHost(), |
| 703 "domAutomationController.send(selectElementEvents[0]);", |
| 704 &select_element_events[0])); |
| 705 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
| 706 GetRenderViewHost(), |
| 707 "domAutomationController.send(selectElementEvents[1]);", |
| 708 &select_element_events[1])); |
| 709 |
| 710 EXPECT_EQ("input", select_element_events[0]); |
| 711 EXPECT_EQ("change", select_element_events[1]); |
574 } | 712 } |
575 | 713 |
576 // Test that we can autofill forms distinguished only by their |id| attribute. | 714 // Test that we can autofill forms distinguished only by their |id| attribute. |
577 IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, | 715 IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, |
578 AutofillFormsDistinguishedById) { | 716 AutofillFormsDistinguishedById) { |
579 CreateTestProfile(); | 717 CreateTestProfile(); |
580 | 718 |
581 // Load the test page. | 719 // Load the test page. |
582 const std::string kURL = | 720 const std::string kURL = |
583 std::string(kDataURIPrefix) + kTestFormString + | 721 std::string(kDataURIPrefix) + kTestFormString + |
(...skipping 18 matching lines...) Expand all Loading... |
602 // JavaScript, with only one actually visible at any given time. | 740 // JavaScript, with only one actually visible at any given time. |
603 IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, AutofillFormWithRepeatedField) { | 741 IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, AutofillFormWithRepeatedField) { |
604 CreateTestProfile(); | 742 CreateTestProfile(); |
605 | 743 |
606 // Load the test page. | 744 // Load the test page. |
607 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), | 745 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), |
608 GURL(std::string(kDataURIPrefix) + | 746 GURL(std::string(kDataURIPrefix) + |
609 "<form action=\"http://www.example.com/\" method=\"POST\">" | 747 "<form action=\"http://www.example.com/\" method=\"POST\">" |
610 "<label for=\"firstname\">First name:</label>" | 748 "<label for=\"firstname\">First name:</label>" |
611 " <input type=\"text\" id=\"firstname\"" | 749 " <input type=\"text\" id=\"firstname\"" |
612 " onFocus=\"domAutomationController.send(true)\"><br>" | 750 " onfocus=\"domAutomationController.send(true)\"><br>" |
613 "<label for=\"lastname\">Last name:</label>" | 751 "<label for=\"lastname\">Last name:</label>" |
614 " <input type=\"text\" id=\"lastname\"><br>" | 752 " <input type=\"text\" id=\"lastname\"><br>" |
615 "<label for=\"address1\">Address line 1:</label>" | 753 "<label for=\"address1\">Address line 1:</label>" |
616 " <input type=\"text\" id=\"address1\"><br>" | 754 " <input type=\"text\" id=\"address1\"><br>" |
617 "<label for=\"address2\">Address line 2:</label>" | 755 "<label for=\"address2\">Address line 2:</label>" |
618 " <input type=\"text\" id=\"address2\"><br>" | 756 " <input type=\"text\" id=\"address2\"><br>" |
619 "<label for=\"city\">City:</label>" | 757 "<label for=\"city\">City:</label>" |
620 " <input type=\"text\" id=\"city\"><br>" | 758 " <input type=\"text\" id=\"city\"><br>" |
621 "<label for=\"state\">State:</label>" | 759 "<label for=\"state\">State:</label>" |
622 " <select id=\"state\">" | 760 " <select id=\"state\">" |
(...skipping 25 matching lines...) Expand all Loading... |
648 IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, | 786 IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, |
649 AutofillFormWithNonAutofillableField) { | 787 AutofillFormWithNonAutofillableField) { |
650 CreateTestProfile(); | 788 CreateTestProfile(); |
651 | 789 |
652 // Load the test page. | 790 // Load the test page. |
653 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), | 791 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), |
654 GURL(std::string(kDataURIPrefix) + | 792 GURL(std::string(kDataURIPrefix) + |
655 "<form action=\"http://www.example.com/\" method=\"POST\">" | 793 "<form action=\"http://www.example.com/\" method=\"POST\">" |
656 "<label for=\"firstname\">First name:</label>" | 794 "<label for=\"firstname\">First name:</label>" |
657 " <input type=\"text\" id=\"firstname\"" | 795 " <input type=\"text\" id=\"firstname\"" |
658 " onFocus=\"domAutomationController.send(true)\"><br>" | 796 " onfocus=\"domAutomationController.send(true)\"><br>" |
659 "<label for=\"middlename\">Middle name:</label>" | 797 "<label for=\"middlename\">Middle name:</label>" |
660 " <input type=\"text\" id=\"middlename\" autocomplete=\"off\" /><br>" | 798 " <input type=\"text\" id=\"middlename\" autocomplete=\"off\" /><br>" |
661 "<label for=\"lastname\">Last name:</label>" | 799 "<label for=\"lastname\">Last name:</label>" |
662 " <input type=\"text\" id=\"lastname\"><br>" | 800 " <input type=\"text\" id=\"lastname\"><br>" |
663 "<label for=\"address1\">Address line 1:</label>" | 801 "<label for=\"address1\">Address line 1:</label>" |
664 " <input type=\"text\" id=\"address1\"><br>" | 802 " <input type=\"text\" id=\"address1\"><br>" |
665 "<label for=\"address2\">Address line 2:</label>" | 803 "<label for=\"address2\">Address line 2:</label>" |
666 " <input type=\"text\" id=\"address2\"><br>" | 804 " <input type=\"text\" id=\"address2\"><br>" |
667 "<label for=\"city\">City:</label>" | 805 "<label for=\"city\">City:</label>" |
668 " <input type=\"text\" id=\"city\"><br>" | 806 " <input type=\"text\" id=\"city\"><br>" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 " var option2 = new Option('United States', 'US');" | 866 " var option2 = new Option('United States', 'US');" |
729 " select_element.appendChild(option2);" | 867 " select_element.appendChild(option2);" |
730 " }" | 868 " }" |
731 "" | 869 "" |
732 " form.appendChild(select_element);" | 870 " form.appendChild(select_element);" |
733 " } else {" | 871 " } else {" |
734 " var input_element = document.createElement('input');" | 872 " var input_element = document.createElement('input');" |
735 " input_element.setAttribute('id', name);" | 873 " input_element.setAttribute('id', name);" |
736 " input_element.setAttribute('name', name);" | 874 " input_element.setAttribute('name', name);" |
737 "" | 875 "" |
738 " /* Add the onFocus listener to the 'firstname' field. */" | 876 " /* Add the onfocus listener to the 'firstname' field. */" |
739 " if (name === 'firstname') {" | 877 " if (name === 'firstname') {" |
740 " input_element.setAttribute(" | 878 " input_element.onfocus = function() {" |
741 " 'onFocus', 'domAutomationController.send(true)');" | 879 " domAutomationController.send(true);" |
| 880 " };" |
742 " }" | 881 " }" |
743 "" | 882 "" |
744 " form.appendChild(input_element);" | 883 " form.appendChild(input_element);" |
745 " }" | 884 " }" |
746 "" | 885 "" |
747 " form.appendChild(document.createElement('br'));" | 886 " form.appendChild(document.createElement('br'));" |
748 "};" | 887 "};" |
749 "" | 888 "" |
750 "function BuildForm() {" | 889 "function BuildForm() {" |
751 " var elements = [" | 890 " var elements = [" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 TryBasicFormFill(); | 931 TryBasicFormFill(); |
793 } | 932 } |
794 | 933 |
795 IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, AutofillAfterTranslate) { | 934 IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, AutofillAfterTranslate) { |
796 CreateTestProfile(); | 935 CreateTestProfile(); |
797 | 936 |
798 GURL url(std::string(kDataURIPrefix) + | 937 GURL url(std::string(kDataURIPrefix) + |
799 "<form action=\"http://www.example.com/\" method=\"POST\">" | 938 "<form action=\"http://www.example.com/\" method=\"POST\">" |
800 "<label for=\"fn\">なまえ</label>" | 939 "<label for=\"fn\">なまえ</label>" |
801 " <input type=\"text\" id=\"fn\"" | 940 " <input type=\"text\" id=\"fn\"" |
802 " onFocus=\"domAutomationController.send(true)\"" | 941 " onfocus=\"domAutomationController.send(true)\"" |
803 "><br>" | 942 "><br>" |
804 "<label for=\"ln\">みょうじ</label>" | 943 "<label for=\"ln\">みょうじ</label>" |
805 " <input type=\"text\" id=\"ln\"><br>" | 944 " <input type=\"text\" id=\"ln\"><br>" |
806 "<label for=\"a1\">Address line 1:</label>" | 945 "<label for=\"a1\">Address line 1:</label>" |
807 " <input type=\"text\" id=\"a1\"><br>" | 946 " <input type=\"text\" id=\"a1\"><br>" |
808 "<label for=\"a2\">Address line 2:</label>" | 947 "<label for=\"a2\">Address line 2:</label>" |
809 " <input type=\"text\" id=\"a2\"><br>" | 948 " <input type=\"text\" id=\"a2\"><br>" |
810 "<label for=\"ci\">City:</label>" | 949 "<label for=\"ci\">City:</label>" |
811 " <input type=\"text\" id=\"ci\"><br>" | 950 " <input type=\"text\" id=\"ci\"><br>" |
812 "<label for=\"st\">State:</label>" | 951 "<label for=\"st\">State:</label>" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 ASSERT_TRUE(content::ExecuteScript( | 1231 ASSERT_TRUE(content::ExecuteScript( |
1093 GetRenderViewHost(), | 1232 GetRenderViewHost(), |
1094 "document.querySelector('input').autocomplete = 'off';")); | 1233 "document.querySelector('input').autocomplete = 'off';")); |
1095 | 1234 |
1096 // Press the down arrow to select the suggestion and attempt to preview the | 1235 // Press the down arrow to select the suggestion and attempt to preview the |
1097 // autofilled form. | 1236 // autofilled form. |
1098 SendKeyToPopupAndWait(ui::VKEY_DOWN); | 1237 SendKeyToPopupAndWait(ui::VKEY_DOWN); |
1099 } | 1238 } |
1100 | 1239 |
1101 } // namespace autofill | 1240 } // namespace autofill |
OLD | NEW |