Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: third_party/WebKit/Source/web/tests/WebViewTest.cpp

Issue 1995333002: Handle newCursorPosition correctly for Android's commitText() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adjust selection in confirmCompositionOrInsertText() Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 WebVector<WebCompositionUnderline> emptyUnderlines; 804 WebVector<WebCompositionUnderline> emptyUnderlines;
805 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU nderlines, 3, 3); 805 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU nderlines, 3, 3);
806 806
807 WebTextInputInfo info = webView->textInputInfo(); 807 WebTextInputInfo info = webView->textInputInfo();
808 EXPECT_EQ("hello", std::string(info.value.utf8().data())); 808 EXPECT_EQ("hello", std::string(info.value.utf8().data()));
809 EXPECT_EQ(3, info.selectionStart); 809 EXPECT_EQ(3, info.selectionStart);
810 EXPECT_EQ(3, info.selectionEnd); 810 EXPECT_EQ(3, info.selectionEnd);
811 EXPECT_EQ(0, info.compositionStart); 811 EXPECT_EQ(0, info.compositionStart);
812 EXPECT_EQ(5, info.compositionEnd); 812 EXPECT_EQ(5, info.compositionEnd);
813 813
814 webView->confirmComposition(WebWidget::KeepSelection); 814 webView->confirmComposition(WebWidget::KeepSelection, 1);
815 info = webView->textInputInfo(); 815 info = webView->textInputInfo();
816 EXPECT_EQ(3, info.selectionStart); 816 EXPECT_EQ(3, info.selectionStart);
817 EXPECT_EQ(3, info.selectionEnd); 817 EXPECT_EQ(3, info.selectionEnd);
818 EXPECT_EQ(-1, info.compositionStart); 818 EXPECT_EQ(-1, info.compositionStart);
819 EXPECT_EQ(-1, info.compositionEnd); 819 EXPECT_EQ(-1, info.compositionEnd);
820 820
821 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU nderlines, 3, 3); 821 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU nderlines, 3, 3);
822 info = webView->textInputInfo(); 822 info = webView->textInputInfo();
823 EXPECT_EQ("helhellolo", std::string(info.value.utf8().data())); 823 EXPECT_EQ("helhellolo", std::string(info.value.utf8().data()));
824 EXPECT_EQ(6, info.selectionStart); 824 EXPECT_EQ(6, info.selectionStart);
825 EXPECT_EQ(6, info.selectionEnd); 825 EXPECT_EQ(6, info.selectionEnd);
826 EXPECT_EQ(3, info.compositionStart); 826 EXPECT_EQ(3, info.compositionStart);
827 EXPECT_EQ(8, info.compositionEnd); 827 EXPECT_EQ(8, info.compositionEnd);
828 828
829 webView->confirmComposition(WebWidget::DoNotKeepSelection); 829 webView->confirmComposition(WebWidget::DoNotKeepSelection, 1);
830 info = webView->textInputInfo(); 830 info = webView->textInputInfo();
831 EXPECT_EQ(8, info.selectionStart); 831 EXPECT_EQ(8, info.selectionStart);
832 EXPECT_EQ(8, info.selectionEnd); 832 EXPECT_EQ(8, info.selectionEnd);
833 EXPECT_EQ(-1, info.compositionStart); 833 EXPECT_EQ(-1, info.compositionStart);
834 EXPECT_EQ(-1, info.compositionEnd); 834 EXPECT_EQ(-1, info.compositionEnd);
835 } 835 }
836 836
837 TEST_F(WebViewTest, FinishCompositionDoesNotRevealSelection) 837 TEST_F(WebViewTest, FinishCompositionDoesNotRevealSelection)
838 { 838 {
839 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("form_with_input.html")); 839 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("form_with_input.html"));
(...skipping 12 matching lines...) Expand all
852 Element* element = static_cast<Element*>(webView->mainFrame()->document().ge tElementById("btn")); 852 Element* element = static_cast<Element*>(webView->mainFrame()->document().ge tElementById("btn"));
853 element->scrollIntoView(); 853 element->scrollIntoView();
854 float offsetHeight = webView->mainFrame()->scrollOffset().height; 854 float offsetHeight = webView->mainFrame()->scrollOffset().height;
855 EXPECT_EQ(0, webView->mainFrame()->scrollOffset().width); 855 EXPECT_EQ(0, webView->mainFrame()->scrollOffset().width);
856 EXPECT_LT(0, offsetHeight); 856 EXPECT_LT(0, offsetHeight);
857 857
858 WebTextInputInfo info = webView->textInputInfo(); 858 WebTextInputInfo info = webView->textInputInfo();
859 EXPECT_EQ("hello", std::string(info.value.utf8().data())); 859 EXPECT_EQ("hello", std::string(info.value.utf8().data()));
860 860
861 // Verify that the input field is not scrolled back into the viewport. 861 // Verify that the input field is not scrolled back into the viewport.
862 webView->confirmComposition(WebWidget::DoNotKeepSelection); 862 webView->confirmComposition(WebWidget::DoNotKeepSelection, 1);
863 EXPECT_EQ(0, webView->mainFrame()->scrollOffset().width); 863 EXPECT_EQ(0, webView->mainFrame()->scrollOffset().width);
864 EXPECT_EQ(offsetHeight, webView->mainFrame()->scrollOffset().height); 864 EXPECT_EQ(offsetHeight, webView->mainFrame()->scrollOffset().height);
865 } 865 }
866 866
867 TEST_F(WebViewTest, InsertNewLinePlacementAfterConfirmComposition) 867 TEST_F(WebViewTest, InsertNewLinePlacementAfterConfirmComposition)
868 { 868 {
869 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("text_area_populated.html")); 869 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("text_area_populated.html"));
870 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "text_a rea_populated.html"); 870 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "text_a rea_populated.html");
871 webView->setInitialFocus(false); 871 webView->setInitialFocus(false);
872 872
873 WebVector<WebCompositionUnderline> emptyUnderlines; 873 WebVector<WebCompositionUnderline> emptyUnderlines;
874 874
875 WebLocalFrameImpl* frame = webView->mainFrameImpl(); 875 WebLocalFrameImpl* frame = webView->mainFrameImpl();
876 frame->setEditableSelectionOffsets(4, 4); 876 frame->setEditableSelectionOffsets(4, 4);
877 frame->setCompositionFromExistingText(8, 12, emptyUnderlines); 877 frame->setCompositionFromExistingText(8, 12, emptyUnderlines);
878 878
879 WebTextInputInfo info = webView->textInputInfo(); 879 WebTextInputInfo info = webView->textInputInfo();
880 EXPECT_EQ("0123456789abcdefghijklmnopqrstuvwxyz", std::string(info.value.utf 8().data())); 880 EXPECT_EQ("0123456789abcdefghijklmnopqrstuvwxyz", std::string(info.value.utf 8().data()));
881 EXPECT_EQ(4, info.selectionStart); 881 EXPECT_EQ(4, info.selectionStart);
882 EXPECT_EQ(4, info.selectionEnd); 882 EXPECT_EQ(4, info.selectionEnd);
883 EXPECT_EQ(8, info.compositionStart); 883 EXPECT_EQ(8, info.compositionStart);
884 EXPECT_EQ(12, info.compositionEnd); 884 EXPECT_EQ(12, info.compositionEnd);
885 885
886 webView->confirmComposition(WebWidget::KeepSelection); 886 webView->confirmComposition(WebWidget::KeepSelection, 1);
887 info = webView->textInputInfo(); 887 info = webView->textInputInfo();
888 EXPECT_EQ(4, info.selectionStart); 888 EXPECT_EQ(4, info.selectionStart);
889 EXPECT_EQ(4, info.selectionEnd); 889 EXPECT_EQ(4, info.selectionEnd);
890 EXPECT_EQ(-1, info.compositionStart); 890 EXPECT_EQ(-1, info.compositionStart);
891 EXPECT_EQ(-1, info.compositionEnd); 891 EXPECT_EQ(-1, info.compositionEnd);
892 892
893 std::string compositionText("\n"); 893 std::string compositionText("\n");
894 webView->confirmComposition(WebString::fromUTF8(compositionText.c_str())); 894 webView->confirmComposition(WebString::fromUTF8(compositionText.c_str()), 1) ;
895 info = webView->textInputInfo(); 895 info = webView->textInputInfo();
896 EXPECT_EQ(5, info.selectionStart); 896 EXPECT_EQ(5, info.selectionStart);
897 EXPECT_EQ(5, info.selectionEnd); 897 EXPECT_EQ(5, info.selectionEnd);
898 EXPECT_EQ(-1, info.compositionStart); 898 EXPECT_EQ(-1, info.compositionStart);
899 EXPECT_EQ(-1, info.compositionEnd); 899 EXPECT_EQ(-1, info.compositionEnd);
900 EXPECT_EQ("0123\n456789abcdefghijklmnopqrstuvwxyz", std::string(info.value.u tf8().data())); 900 EXPECT_EQ("0123\n456789abcdefghijklmnopqrstuvwxyz", std::string(info.value.u tf8().data()));
901 } 901 }
902 902
903 TEST_F(WebViewTest, ExtendSelectionAndDelete) 903 TEST_F(WebViewTest, ExtendSelectionAndDelete)
904 { 904 {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 TEST_F(WebViewTest, SetCompositionFromExistingTextInTextArea) 944 TEST_F(WebViewTest, SetCompositionFromExistingTextInTextArea)
945 { 945 {
946 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("text_area_populated.html")); 946 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("text_area_populated.html"));
947 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "text_a rea_populated.html"); 947 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "text_a rea_populated.html");
948 webView->setInitialFocus(false); 948 webView->setInitialFocus(false);
949 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); 949 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1));
950 underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0); 950 underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0);
951 WebLocalFrameImpl* frame = webView->mainFrameImpl(); 951 WebLocalFrameImpl* frame = webView->mainFrameImpl();
952 frame->setEditableSelectionOffsets(27, 27); 952 frame->setEditableSelectionOffsets(27, 27);
953 std::string newLineText("\n"); 953 std::string newLineText("\n");
954 webView->confirmComposition(WebString::fromUTF8(newLineText.c_str())); 954 webView->confirmComposition(WebString::fromUTF8(newLineText.c_str()), 1);
955 WebTextInputInfo info = webView->textInputInfo(); 955 WebTextInputInfo info = webView->textInputInfo();
956 EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz", std::string(info.value.u tf8().data())); 956 EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz", std::string(info.value.u tf8().data()));
957 957
958 frame->setEditableSelectionOffsets(31, 31); 958 frame->setEditableSelectionOffsets(31, 31);
959 frame->setCompositionFromExistingText(30, 34, underlines); 959 frame->setCompositionFromExistingText(30, 34, underlines);
960 info = webView->textInputInfo(); 960 info = webView->textInputInfo();
961 EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz", std::string(info.value.u tf8().data())); 961 EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz", std::string(info.value.u tf8().data()));
962 EXPECT_EQ(31, info.selectionStart); 962 EXPECT_EQ(31, info.selectionStart);
963 EXPECT_EQ(31, info.selectionEnd); 963 EXPECT_EQ(31, info.selectionEnd);
964 EXPECT_EQ(30, info.compositionStart); 964 EXPECT_EQ(30, info.compositionStart);
965 EXPECT_EQ(34, info.compositionEnd); 965 EXPECT_EQ(34, info.compositionEnd);
966 966
967 std::string compositionText("yolo"); 967 std::string compositionText("yolo");
968 webView->confirmComposition(WebString::fromUTF8(compositionText.c_str())); 968 webView->confirmComposition(WebString::fromUTF8(compositionText.c_str()), 1) ;
969 info = webView->textInputInfo(); 969 info = webView->textInputInfo();
970 EXPECT_EQ("0123456789abcdefghijklmnopq\nrsyoloxyz", std::string(info.value.u tf8().data())); 970 EXPECT_EQ("0123456789abcdefghijklmnopq\nrsyoloxyz", std::string(info.value.u tf8().data()));
971 EXPECT_EQ(34, info.selectionStart); 971 EXPECT_EQ(34, info.selectionStart);
972 EXPECT_EQ(34, info.selectionEnd); 972 EXPECT_EQ(34, info.selectionEnd);
973 EXPECT_EQ(-1, info.compositionStart); 973 EXPECT_EQ(-1, info.compositionStart);
974 EXPECT_EQ(-1, info.compositionEnd); 974 EXPECT_EQ(-1, info.compositionEnd);
975 } 975 }
976 976
977 TEST_F(WebViewTest, SetCompositionFromExistingTextInRichText) 977 TEST_F(WebViewTest, SetCompositionFromExistingTextInRichText)
978 { 978 {
(...skipping 13 matching lines...) Expand all
992 TEST_F(WebViewTest, SetEditableSelectionOffsetsKeepsComposition) 992 TEST_F(WebViewTest, SetEditableSelectionOffsetsKeepsComposition)
993 { 993 {
994 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("input_field_populated.html")); 994 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("input_field_populated.html"));
995 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_ field_populated.html"); 995 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_ field_populated.html");
996 webView->setInitialFocus(false); 996 webView->setInitialFocus(false);
997 997
998 std::string compositionTextFirst("hello "); 998 std::string compositionTextFirst("hello ");
999 std::string compositionTextSecond("world"); 999 std::string compositionTextSecond("world");
1000 WebVector<WebCompositionUnderline> emptyUnderlines; 1000 WebVector<WebCompositionUnderline> emptyUnderlines;
1001 1001
1002 webView->confirmComposition(WebString::fromUTF8(compositionTextFirst.c_str() )); 1002 webView->confirmComposition(WebString::fromUTF8(compositionTextFirst.c_str() ), 1);
1003 webView->setComposition(WebString::fromUTF8(compositionTextSecond.c_str()), emptyUnderlines, 5, 5); 1003 webView->setComposition(WebString::fromUTF8(compositionTextSecond.c_str()), emptyUnderlines, 5, 5);
1004 1004
1005 WebTextInputInfo info = webView->textInputInfo(); 1005 WebTextInputInfo info = webView->textInputInfo();
1006 EXPECT_EQ("hello world", std::string(info.value.utf8().data())); 1006 EXPECT_EQ("hello world", std::string(info.value.utf8().data()));
1007 EXPECT_EQ(11, info.selectionStart); 1007 EXPECT_EQ(11, info.selectionStart);
1008 EXPECT_EQ(11, info.selectionEnd); 1008 EXPECT_EQ(11, info.selectionEnd);
1009 EXPECT_EQ(6, info.compositionStart); 1009 EXPECT_EQ(6, info.compositionStart);
1010 EXPECT_EQ(11, info.compositionEnd); 1010 EXPECT_EQ(11, info.compositionEnd);
1011 1011
1012 WebLocalFrameImpl* frame = webView->mainFrameImpl(); 1012 WebLocalFrameImpl* frame = webView->mainFrameImpl();
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 WebVector<WebCompositionUnderline> emptyUnderlines; 2060 WebVector<WebCompositionUnderline> emptyUnderlines;
2061 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU nderlines, 0, compositionText.length()); 2061 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU nderlines, 0, compositionText.length());
2062 2062
2063 WebTextInputInfo info = webView->textInputInfo(); 2063 WebTextInputInfo info = webView->textInputInfo();
2064 EXPECT_EQ(0, info.selectionStart); 2064 EXPECT_EQ(0, info.selectionStart);
2065 EXPECT_EQ((int) compositionText.length(), info.selectionEnd); 2065 EXPECT_EQ((int) compositionText.length(), info.selectionEnd);
2066 EXPECT_EQ(0, info.compositionStart); 2066 EXPECT_EQ(0, info.compositionStart);
2067 EXPECT_EQ((int) compositionText.length(), info.compositionEnd); 2067 EXPECT_EQ((int) compositionText.length(), info.compositionEnd);
2068 2068
2069 client.clearChangeCounts(); 2069 client.clearChangeCounts();
2070 webView->confirmComposition(); 2070 webView->confirmComposition(1);
2071 EXPECT_EQ(0, client.textChangesWhileIgnored()); 2071 EXPECT_EQ(0, client.textChangesWhileIgnored());
2072 EXPECT_EQ(1, client.textChangesWhileNotIgnored()); 2072 EXPECT_EQ(1, client.textChangesWhileNotIgnored());
2073 2073
2074 frame->setAutofillClient(0); 2074 frame->setAutofillClient(0);
2075 } 2075 }
2076 2076
2077 TEST_F(WebViewTest, SetCompositionFromExistingTextTriggersAutofillTextChange) 2077 TEST_F(WebViewTest, SetCompositionFromExistingTextTriggersAutofillTextChange)
2078 { 2078 {
2079 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("input_field_populated.html")); 2079 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("input_field_populated.html"));
2080 MockAutofillClient client; 2080 MockAutofillClient client;
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
2764 EXPECT_TRUE(client.textIsUpdated()); 2764 EXPECT_TRUE(client.textIsUpdated());
2765 WebTextInputInfo info = webViewImpl->textInputInfo(); 2765 WebTextInputInfo info = webViewImpl->textInputInfo();
2766 EXPECT_EQ("testA", std::string(info.value.utf8().data())); 2766 EXPECT_EQ("testA", std::string(info.value.utf8().data()));
2767 2767
2768 // (A.2) Focused and user input modifies value. 2768 // (A.2) Focused and user input modifies value.
2769 client.reset(); 2769 client.reset();
2770 EXPECT_FALSE(client.textIsUpdated()); 2770 EXPECT_FALSE(client.textIsUpdated());
2771 2771
2772 WebVector<WebCompositionUnderline> emptyUnderlines; 2772 WebVector<WebCompositionUnderline> emptyUnderlines;
2773 webViewImpl->setComposition(WebString::fromUTF8("2"), emptyUnderlines, 1, 1) ; 2773 webViewImpl->setComposition(WebString::fromUTF8("2"), emptyUnderlines, 1, 1) ;
2774 webViewImpl->confirmComposition(WebWidget::KeepSelection); 2774 webViewImpl->confirmComposition(WebWidget::KeepSelection, 1);
2775 EXPECT_FALSE(client.textIsUpdated()); 2775 EXPECT_FALSE(client.textIsUpdated());
2776 info = webViewImpl->textInputInfo(); 2776 info = webViewImpl->textInputInfo();
2777 EXPECT_EQ("testA2", std::string(info.value.utf8().data())); 2777 EXPECT_EQ("testA2", std::string(info.value.utf8().data()));
2778 2778
2779 // (A.3) Unfocused and value is changed by script. 2779 // (A.3) Unfocused and value is changed by script.
2780 client.reset(); 2780 client.reset();
2781 EXPECT_FALSE(client.textIsUpdated()); 2781 EXPECT_FALSE(client.textIsUpdated());
2782 document->clearFocusedElement(); 2782 document->clearFocusedElement();
2783 webViewImpl->setFocus(false); 2783 webViewImpl->setFocus(false);
2784 EXPECT_NE(document->focusedElement(), static_cast<Element*>(inputElement)); 2784 EXPECT_NE(document->focusedElement(), static_cast<Element*>(inputElement));
(...skipping 10 matching lines...) Expand all
2795 EXPECT_EQ(document->focusedElement(), static_cast<Element*>(textAreaElement) ); 2795 EXPECT_EQ(document->focusedElement(), static_cast<Element*>(textAreaElement) );
2796 textAreaElement->setValue("testB"); 2796 textAreaElement->setValue("testB");
2797 EXPECT_TRUE(client.textIsUpdated()); 2797 EXPECT_TRUE(client.textIsUpdated());
2798 info = webViewImpl->textInputInfo(); 2798 info = webViewImpl->textInputInfo();
2799 EXPECT_EQ("testB", std::string(info.value.utf8().data())); 2799 EXPECT_EQ("testB", std::string(info.value.utf8().data()));
2800 2800
2801 // (B.2) Focused and user input modifies value. 2801 // (B.2) Focused and user input modifies value.
2802 client.reset(); 2802 client.reset();
2803 EXPECT_FALSE(client.textIsUpdated()); 2803 EXPECT_FALSE(client.textIsUpdated());
2804 webViewImpl->setComposition(WebString::fromUTF8("2"), emptyUnderlines, 1, 1) ; 2804 webViewImpl->setComposition(WebString::fromUTF8("2"), emptyUnderlines, 1, 1) ;
2805 webViewImpl->confirmComposition(WebWidget::KeepSelection); 2805 webViewImpl->confirmComposition(WebWidget::KeepSelection, 1);
2806 info = webViewImpl->textInputInfo(); 2806 info = webViewImpl->textInputInfo();
2807 EXPECT_EQ("testB2", std::string(info.value.utf8().data())); 2807 EXPECT_EQ("testB2", std::string(info.value.utf8().data()));
2808 2808
2809 // (B.3) Unfocused and value is changed by script. 2809 // (B.3) Unfocused and value is changed by script.
2810 client.reset(); 2810 client.reset();
2811 EXPECT_FALSE(client.textIsUpdated()); 2811 EXPECT_FALSE(client.textIsUpdated());
2812 document->clearFocusedElement(); 2812 document->clearFocusedElement();
2813 webViewImpl->setFocus(false); 2813 webViewImpl->setFocus(false);
2814 EXPECT_NE(document->focusedElement(), static_cast<Element*>(textAreaElement) ); 2814 EXPECT_NE(document->focusedElement(), static_cast<Element*>(textAreaElement) );
2815 inputElement->setValue("testB3"); 2815 inputElement->setValue("testB3");
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
3203 3203
3204 TEST_F(WebViewTest, PasswordFieldEditingIsUserGesture) 3204 TEST_F(WebViewTest, PasswordFieldEditingIsUserGesture)
3205 { 3205 {
3206 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("input_field_password.html")); 3206 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("input_field_password.html"));
3207 MockAutofillClient client; 3207 MockAutofillClient client;
3208 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_ field_password.html", true); 3208 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_ field_password.html", true);
3209 WebLocalFrameImpl* frame = webView->mainFrameImpl(); 3209 WebLocalFrameImpl* frame = webView->mainFrameImpl();
3210 frame->setAutofillClient(&client); 3210 frame->setAutofillClient(&client);
3211 webView->setInitialFocus(false); 3211 webView->setInitialFocus(false);
3212 3212
3213 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel lo").c_str()))); 3213 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel lo").c_str()), 1));
3214 EXPECT_EQ(1, client.textChangesFromUserGesture()); 3214 EXPECT_EQ(1, client.textChangesFromUserGesture());
3215 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); 3215 EXPECT_FALSE(UserGestureIndicator::processingUserGesture());
3216 frame->setAutofillClient(0); 3216 frame->setAutofillClient(0);
3217 } 3217 }
3218 3218
3219 // Verify that a WebView created with a ScopedPageLoadDeferrer already on the 3219 // Verify that a WebView created with a ScopedPageLoadDeferrer already on the
3220 // stack defers its loads. 3220 // stack defers its loads.
3221 TEST_F(WebViewTest, CreatedDuringLoadDeferral) 3221 TEST_F(WebViewTest, CreatedDuringLoadDeferral)
3222 { 3222 {
3223 { 3223 {
(...skipping 24 matching lines...) Expand all
3248 EXPECT_TRUE(webView->page()->defersLoading()); 3248 EXPECT_TRUE(webView->page()->defersLoading());
3249 } 3249 }
3250 3250
3251 EXPECT_TRUE(webView->page()->defersLoading()); 3251 EXPECT_TRUE(webView->page()->defersLoading());
3252 } 3252 }
3253 3253
3254 EXPECT_FALSE(webView->page()->defersLoading()); 3254 EXPECT_FALSE(webView->page()->defersLoading());
3255 } 3255 }
3256 3256
3257 } // namespace blink 3257 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698