| OLD | NEW |
| 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 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 EXPECT_EQ(8, info.compositionEnd); | 826 EXPECT_EQ(8, info.compositionEnd); |
| 827 | 827 |
| 828 webView->confirmComposition(WebWidget::DoNotKeepSelection); | 828 webView->confirmComposition(WebWidget::DoNotKeepSelection); |
| 829 info = webView->textInputInfo(); | 829 info = webView->textInputInfo(); |
| 830 EXPECT_EQ(8, info.selectionStart); | 830 EXPECT_EQ(8, info.selectionStart); |
| 831 EXPECT_EQ(8, info.selectionEnd); | 831 EXPECT_EQ(8, info.selectionEnd); |
| 832 EXPECT_EQ(-1, info.compositionStart); | 832 EXPECT_EQ(-1, info.compositionStart); |
| 833 EXPECT_EQ(-1, info.compositionEnd); | 833 EXPECT_EQ(-1, info.compositionEnd); |
| 834 } | 834 } |
| 835 | 835 |
| 836 TEST_F(WebViewTest, SetCompositionForDifferentnewCursorPositions) |
| 837 { |
| 838 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); |
| 839 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html"); |
| 840 webView->setInitialFocus(false); |
| 841 |
| 842 webView->confirmComposition("hello", 1); |
| 843 webView->confirmComposition("world", 0); |
| 844 WebTextInputInfo info = webView->textInputInfo(); |
| 845 EXPECT_EQ("helloworld", std::string(info.value.utf8().data())); |
| 846 EXPECT_EQ(5, info.selectionStart); |
| 847 EXPECT_EQ(5, info.selectionEnd); |
| 848 EXPECT_EQ(-1, info.compositionStart); |
| 849 EXPECT_EQ(-1, info.compositionEnd); |
| 850 |
| 851 WebVector<WebCompositionUnderline> emptyUnderlines; |
| 852 // Set up a composition that needs to be committed. |
| 853 std::string compositionText("ABC"); |
| 854 |
| 855 // Cursor is on the left of composing text. |
| 856 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU
nderlines, 0, 0); |
| 857 info = webView->textInputInfo(); |
| 858 EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); |
| 859 EXPECT_EQ(5, info.selectionStart); |
| 860 EXPECT_EQ(5, info.selectionEnd); |
| 861 EXPECT_EQ(5, info.compositionStart); |
| 862 EXPECT_EQ(8, info.compositionEnd); |
| 863 |
| 864 // Cursor is on the right of composing text. |
| 865 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU
nderlines, 3, 3); |
| 866 info = webView->textInputInfo(); |
| 867 EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); |
| 868 EXPECT_EQ(8, info.selectionStart); |
| 869 EXPECT_EQ(8, info.selectionEnd); |
| 870 EXPECT_EQ(5, info.compositionStart); |
| 871 EXPECT_EQ(8, info.compositionEnd); |
| 872 |
| 873 // Cursor is between composing text and left boundary. |
| 874 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU
nderlines, -2, -2); |
| 875 info = webView->textInputInfo(); |
| 876 EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); |
| 877 EXPECT_EQ(3, info.selectionStart); |
| 878 EXPECT_EQ(3, info.selectionEnd); |
| 879 EXPECT_EQ(5, info.compositionStart); |
| 880 EXPECT_EQ(8, info.compositionEnd); |
| 881 |
| 882 // Cursor is between composing text and right boundary. |
| 883 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU
nderlines, 5, 5); |
| 884 info = webView->textInputInfo(); |
| 885 EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); |
| 886 EXPECT_EQ(10, info.selectionStart); |
| 887 EXPECT_EQ(10, info.selectionEnd); |
| 888 EXPECT_EQ(5, info.compositionStart); |
| 889 EXPECT_EQ(8, info.compositionEnd); |
| 890 |
| 891 // Cursor is on the left boundary. |
| 892 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU
nderlines, -5, -5); |
| 893 info = webView->textInputInfo(); |
| 894 EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); |
| 895 EXPECT_EQ(0, info.selectionStart); |
| 896 EXPECT_EQ(0, info.selectionEnd); |
| 897 EXPECT_EQ(5, info.compositionStart); |
| 898 EXPECT_EQ(8, info.compositionEnd); |
| 899 |
| 900 // Cursor is on the right boundary. |
| 901 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU
nderlines, 8, 8); |
| 902 info = webView->textInputInfo(); |
| 903 EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); |
| 904 EXPECT_EQ(13, info.selectionStart); |
| 905 EXPECT_EQ(13, info.selectionEnd); |
| 906 EXPECT_EQ(5, info.compositionStart); |
| 907 EXPECT_EQ(8, info.compositionEnd); |
| 908 |
| 909 // Cursor exceeds the left boundary. |
| 910 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU
nderlines, -100, -100); |
| 911 info = webView->textInputInfo(); |
| 912 EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); |
| 913 EXPECT_EQ(0, info.selectionStart); |
| 914 EXPECT_EQ(0, info.selectionEnd); |
| 915 EXPECT_EQ(5, info.compositionStart); |
| 916 EXPECT_EQ(8, info.compositionEnd); |
| 917 |
| 918 // Cursor exceeds the right boundary. |
| 919 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU
nderlines, 100, 100); |
| 920 info = webView->textInputInfo(); |
| 921 EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); |
| 922 EXPECT_EQ(13, info.selectionStart); |
| 923 EXPECT_EQ(13, info.selectionEnd); |
| 924 EXPECT_EQ(5, info.compositionStart); |
| 925 EXPECT_EQ(8, info.compositionEnd); |
| 926 } |
| 927 |
| 928 TEST_F(WebViewTest, SetCompositionWithEmptyText) |
| 929 { |
| 930 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); |
| 931 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html"); |
| 932 webView->setInitialFocus(false); |
| 933 |
| 934 webView->confirmComposition("hello", 1); |
| 935 WebTextInputInfo info = webView->textInputInfo(); |
| 936 EXPECT_EQ("hello", std::string(info.value.utf8().data())); |
| 937 EXPECT_EQ(5, info.selectionStart); |
| 938 EXPECT_EQ(5, info.selectionEnd); |
| 939 EXPECT_EQ(-1, info.compositionStart); |
| 940 EXPECT_EQ(-1, info.compositionEnd); |
| 941 |
| 942 WebVector<WebCompositionUnderline> emptyUnderlines; |
| 943 |
| 944 webView->setComposition(WebString::fromUTF8(""), emptyUnderlines, 0, 0); |
| 945 info = webView->textInputInfo(); |
| 946 EXPECT_EQ("hello", std::string(info.value.utf8().data())); |
| 947 EXPECT_EQ(5, info.selectionStart); |
| 948 EXPECT_EQ(5, info.selectionEnd); |
| 949 EXPECT_EQ(-1, info.compositionStart); |
| 950 EXPECT_EQ(-1, info.compositionEnd); |
| 951 |
| 952 webView->setComposition(WebString::fromUTF8(""), emptyUnderlines, -2, -2); |
| 953 info = webView->textInputInfo(); |
| 954 EXPECT_EQ("hello", std::string(info.value.utf8().data())); |
| 955 EXPECT_EQ(3, info.selectionStart); |
| 956 EXPECT_EQ(3, info.selectionEnd); |
| 957 EXPECT_EQ(-1, info.compositionStart); |
| 958 EXPECT_EQ(-1, info.compositionEnd); |
| 959 } |
| 960 |
| 961 TEST_F(WebViewTest, ConfirmCompositionForDifferentnewCursorPositions) |
| 962 { |
| 963 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); |
| 964 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html"); |
| 965 webView->setInitialFocus(false); |
| 966 |
| 967 // Cursor is on the left of composing text. |
| 968 webView->confirmComposition("ab", 0); |
| 969 WebTextInputInfo info = webView->textInputInfo(); |
| 970 EXPECT_EQ("ab", std::string(info.value.utf8().data())); |
| 971 EXPECT_EQ(0, info.selectionStart); |
| 972 EXPECT_EQ(0, info.selectionEnd); |
| 973 EXPECT_EQ(-1, info.compositionStart); |
| 974 EXPECT_EQ(-1, info.compositionEnd); |
| 975 |
| 976 // Cursor is on the right of composing text. |
| 977 webView->confirmComposition("c", 2); |
| 978 info = webView->textInputInfo(); |
| 979 EXPECT_EQ("cab", std::string(info.value.utf8().data())); |
| 980 EXPECT_EQ(2, info.selectionStart); |
| 981 EXPECT_EQ(2, info.selectionEnd); |
| 982 EXPECT_EQ(-1, info.compositionStart); |
| 983 EXPECT_EQ(-1, info.compositionEnd); |
| 984 |
| 985 // Cursor is on the left boundary. |
| 986 webView->confirmComposition("def", -2); |
| 987 info = webView->textInputInfo(); |
| 988 EXPECT_EQ("cadefb", std::string(info.value.utf8().data())); |
| 989 EXPECT_EQ(0, info.selectionStart); |
| 990 EXPECT_EQ(0, info.selectionEnd); |
| 991 EXPECT_EQ(-1, info.compositionStart); |
| 992 EXPECT_EQ(-1, info.compositionEnd); |
| 993 |
| 994 // Cursor is on the right boundary. |
| 995 webView->confirmComposition("g", 7); |
| 996 info = webView->textInputInfo(); |
| 997 EXPECT_EQ("gcadefb", std::string(info.value.utf8().data())); |
| 998 EXPECT_EQ(7, info.selectionStart); |
| 999 EXPECT_EQ(7, info.selectionEnd); |
| 1000 EXPECT_EQ(-1, info.compositionStart); |
| 1001 EXPECT_EQ(-1, info.compositionEnd); |
| 1002 |
| 1003 // Cursor exceeds the left boundary. |
| 1004 webView->confirmComposition("hi", -100); |
| 1005 info = webView->textInputInfo(); |
| 1006 EXPECT_EQ("gcadefbhi", std::string(info.value.utf8().data())); |
| 1007 EXPECT_EQ(0, info.selectionStart); |
| 1008 EXPECT_EQ(0, info.selectionEnd); |
| 1009 EXPECT_EQ(-1, info.compositionStart); |
| 1010 EXPECT_EQ(-1, info.compositionEnd); |
| 1011 |
| 1012 // Cursor exceeds the right boundary. |
| 1013 webView->confirmComposition("jk", 100); |
| 1014 info = webView->textInputInfo(); |
| 1015 EXPECT_EQ("jkgcadefbhi", std::string(info.value.utf8().data())); |
| 1016 EXPECT_EQ(11, info.selectionStart); |
| 1017 EXPECT_EQ(11, info.selectionEnd); |
| 1018 EXPECT_EQ(-1, info.compositionStart); |
| 1019 EXPECT_EQ(-1, info.compositionEnd); |
| 1020 } |
| 1021 |
| 836 TEST_F(WebViewTest, FinishCompositionDoesNotRevealSelection) | 1022 TEST_F(WebViewTest, FinishCompositionDoesNotRevealSelection) |
| 837 { | 1023 { |
| 838 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("form_with_input.html")); | 1024 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("form_with_input.html")); |
| 839 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "form_w
ith_input.html"); | 1025 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "form_w
ith_input.html"); |
| 840 webView->resize(WebSize(800, 600)); | 1026 webView->resize(WebSize(800, 600)); |
| 841 webView->setInitialFocus(false); | 1027 webView->setInitialFocus(false); |
| 842 EXPECT_EQ(0, webView->mainFrame()->scrollOffset().width); | 1028 EXPECT_EQ(0, webView->mainFrame()->scrollOffset().width); |
| 843 EXPECT_EQ(0, webView->mainFrame()->scrollOffset().height); | 1029 EXPECT_EQ(0, webView->mainFrame()->scrollOffset().height); |
| 844 | 1030 |
| 845 // Set up a composition from existing text that needs to be committed. | 1031 // Set up a composition from existing text that needs to be committed. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 EXPECT_EQ(12, info.compositionEnd); | 1069 EXPECT_EQ(12, info.compositionEnd); |
| 884 | 1070 |
| 885 webView->confirmComposition(WebWidget::KeepSelection); | 1071 webView->confirmComposition(WebWidget::KeepSelection); |
| 886 info = webView->textInputInfo(); | 1072 info = webView->textInputInfo(); |
| 887 EXPECT_EQ(4, info.selectionStart); | 1073 EXPECT_EQ(4, info.selectionStart); |
| 888 EXPECT_EQ(4, info.selectionEnd); | 1074 EXPECT_EQ(4, info.selectionEnd); |
| 889 EXPECT_EQ(-1, info.compositionStart); | 1075 EXPECT_EQ(-1, info.compositionStart); |
| 890 EXPECT_EQ(-1, info.compositionEnd); | 1076 EXPECT_EQ(-1, info.compositionEnd); |
| 891 | 1077 |
| 892 std::string compositionText("\n"); | 1078 std::string compositionText("\n"); |
| 893 webView->confirmComposition(WebString::fromUTF8(compositionText.c_str())); | 1079 webView->confirmComposition(WebString::fromUTF8(compositionText.c_str()), 1)
; |
| 894 info = webView->textInputInfo(); | 1080 info = webView->textInputInfo(); |
| 895 EXPECT_EQ(5, info.selectionStart); | 1081 EXPECT_EQ(5, info.selectionStart); |
| 896 EXPECT_EQ(5, info.selectionEnd); | 1082 EXPECT_EQ(5, info.selectionEnd); |
| 897 EXPECT_EQ(-1, info.compositionStart); | 1083 EXPECT_EQ(-1, info.compositionStart); |
| 898 EXPECT_EQ(-1, info.compositionEnd); | 1084 EXPECT_EQ(-1, info.compositionEnd); |
| 899 EXPECT_EQ("0123\n456789abcdefghijklmnopqrstuvwxyz", std::string(info.value.u
tf8().data())); | 1085 EXPECT_EQ("0123\n456789abcdefghijklmnopqrstuvwxyz", std::string(info.value.u
tf8().data())); |
| 900 } | 1086 } |
| 901 | 1087 |
| 902 TEST_F(WebViewTest, ExtendSelectionAndDelete) | 1088 TEST_F(WebViewTest, ExtendSelectionAndDelete) |
| 903 { | 1089 { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 TEST_F(WebViewTest, SetCompositionFromExistingTextInTextArea) | 1129 TEST_F(WebViewTest, SetCompositionFromExistingTextInTextArea) |
| 944 { | 1130 { |
| 945 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("text_area_populated.html")); | 1131 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("text_area_populated.html")); |
| 946 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "text_a
rea_populated.html"); | 1132 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "text_a
rea_populated.html"); |
| 947 webView->setInitialFocus(false); | 1133 webView->setInitialFocus(false); |
| 948 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); | 1134 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); |
| 949 underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0); | 1135 underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0); |
| 950 WebLocalFrameImpl* frame = webView->mainFrameImpl(); | 1136 WebLocalFrameImpl* frame = webView->mainFrameImpl(); |
| 951 frame->setEditableSelectionOffsets(27, 27); | 1137 frame->setEditableSelectionOffsets(27, 27); |
| 952 std::string newLineText("\n"); | 1138 std::string newLineText("\n"); |
| 953 webView->confirmComposition(WebString::fromUTF8(newLineText.c_str())); | 1139 webView->confirmComposition(WebString::fromUTF8(newLineText.c_str()), 1); |
| 954 WebTextInputInfo info = webView->textInputInfo(); | 1140 WebTextInputInfo info = webView->textInputInfo(); |
| 955 EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz", std::string(info.value.u
tf8().data())); | 1141 EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz", std::string(info.value.u
tf8().data())); |
| 956 | 1142 |
| 957 frame->setEditableSelectionOffsets(31, 31); | 1143 frame->setEditableSelectionOffsets(31, 31); |
| 958 frame->setCompositionFromExistingText(30, 34, underlines); | 1144 frame->setCompositionFromExistingText(30, 34, underlines); |
| 959 info = webView->textInputInfo(); | 1145 info = webView->textInputInfo(); |
| 960 EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz", std::string(info.value.u
tf8().data())); | 1146 EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz", std::string(info.value.u
tf8().data())); |
| 961 EXPECT_EQ(31, info.selectionStart); | 1147 EXPECT_EQ(31, info.selectionStart); |
| 962 EXPECT_EQ(31, info.selectionEnd); | 1148 EXPECT_EQ(31, info.selectionEnd); |
| 963 EXPECT_EQ(30, info.compositionStart); | 1149 EXPECT_EQ(30, info.compositionStart); |
| 964 EXPECT_EQ(34, info.compositionEnd); | 1150 EXPECT_EQ(34, info.compositionEnd); |
| 965 | 1151 |
| 966 std::string compositionText("yolo"); | 1152 std::string compositionText("yolo"); |
| 967 webView->confirmComposition(WebString::fromUTF8(compositionText.c_str())); | 1153 webView->confirmComposition(WebString::fromUTF8(compositionText.c_str()), 1)
; |
| 968 info = webView->textInputInfo(); | 1154 info = webView->textInputInfo(); |
| 969 EXPECT_EQ("0123456789abcdefghijklmnopq\nrsyoloxyz", std::string(info.value.u
tf8().data())); | 1155 EXPECT_EQ("0123456789abcdefghijklmnopq\nrsyoloxyz", std::string(info.value.u
tf8().data())); |
| 970 EXPECT_EQ(34, info.selectionStart); | 1156 EXPECT_EQ(34, info.selectionStart); |
| 971 EXPECT_EQ(34, info.selectionEnd); | 1157 EXPECT_EQ(34, info.selectionEnd); |
| 972 EXPECT_EQ(-1, info.compositionStart); | 1158 EXPECT_EQ(-1, info.compositionStart); |
| 973 EXPECT_EQ(-1, info.compositionEnd); | 1159 EXPECT_EQ(-1, info.compositionEnd); |
| 974 } | 1160 } |
| 975 | 1161 |
| 976 TEST_F(WebViewTest, SetCompositionFromExistingTextInRichText) | 1162 TEST_F(WebViewTest, SetCompositionFromExistingTextInRichText) |
| 977 { | 1163 { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 991 TEST_F(WebViewTest, SetEditableSelectionOffsetsKeepsComposition) | 1177 TEST_F(WebViewTest, SetEditableSelectionOffsetsKeepsComposition) |
| 992 { | 1178 { |
| 993 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); | 1179 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); |
| 994 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_
field_populated.html"); | 1180 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_
field_populated.html"); |
| 995 webView->setInitialFocus(false); | 1181 webView->setInitialFocus(false); |
| 996 | 1182 |
| 997 std::string compositionTextFirst("hello "); | 1183 std::string compositionTextFirst("hello "); |
| 998 std::string compositionTextSecond("world"); | 1184 std::string compositionTextSecond("world"); |
| 999 WebVector<WebCompositionUnderline> emptyUnderlines; | 1185 WebVector<WebCompositionUnderline> emptyUnderlines; |
| 1000 | 1186 |
| 1001 webView->confirmComposition(WebString::fromUTF8(compositionTextFirst.c_str()
)); | 1187 webView->confirmComposition(WebString::fromUTF8(compositionTextFirst.c_str()
), 1); |
| 1002 webView->setComposition(WebString::fromUTF8(compositionTextSecond.c_str()),
emptyUnderlines, 5, 5); | 1188 webView->setComposition(WebString::fromUTF8(compositionTextSecond.c_str()),
emptyUnderlines, 5, 5); |
| 1003 | 1189 |
| 1004 WebTextInputInfo info = webView->textInputInfo(); | 1190 WebTextInputInfo info = webView->textInputInfo(); |
| 1005 EXPECT_EQ("hello world", std::string(info.value.utf8().data())); | 1191 EXPECT_EQ("hello world", std::string(info.value.utf8().data())); |
| 1006 EXPECT_EQ(11, info.selectionStart); | 1192 EXPECT_EQ(11, info.selectionStart); |
| 1007 EXPECT_EQ(11, info.selectionEnd); | 1193 EXPECT_EQ(11, info.selectionEnd); |
| 1008 EXPECT_EQ(6, info.compositionStart); | 1194 EXPECT_EQ(6, info.compositionStart); |
| 1009 EXPECT_EQ(11, info.compositionEnd); | 1195 EXPECT_EQ(11, info.compositionEnd); |
| 1010 | 1196 |
| 1011 WebLocalFrameImpl* frame = webView->mainFrameImpl(); | 1197 WebLocalFrameImpl* frame = webView->mainFrameImpl(); |
| (...skipping 2190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3202 | 3388 |
| 3203 TEST_F(WebViewTest, PasswordFieldEditingIsUserGesture) | 3389 TEST_F(WebViewTest, PasswordFieldEditingIsUserGesture) |
| 3204 { | 3390 { |
| 3205 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_password.html")); | 3391 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_password.html")); |
| 3206 MockAutofillClient client; | 3392 MockAutofillClient client; |
| 3207 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_
field_password.html", true); | 3393 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_
field_password.html", true); |
| 3208 WebLocalFrameImpl* frame = webView->mainFrameImpl(); | 3394 WebLocalFrameImpl* frame = webView->mainFrameImpl(); |
| 3209 frame->setAutofillClient(&client); | 3395 frame->setAutofillClient(&client); |
| 3210 webView->setInitialFocus(false); | 3396 webView->setInitialFocus(false); |
| 3211 | 3397 |
| 3212 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); | 3398 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()), 1)); |
| 3213 EXPECT_EQ(1, client.textChangesFromUserGesture()); | 3399 EXPECT_EQ(1, client.textChangesFromUserGesture()); |
| 3214 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); | 3400 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); |
| 3215 frame->setAutofillClient(0); | 3401 frame->setAutofillClient(0); |
| 3216 } | 3402 } |
| 3217 | 3403 |
| 3218 // Verify that a WebView created with a ScopedPageLoadDeferrer already on the | 3404 // Verify that a WebView created with a ScopedPageLoadDeferrer already on the |
| 3219 // stack defers its loads. | 3405 // stack defers its loads. |
| 3220 TEST_F(WebViewTest, CreatedDuringLoadDeferral) | 3406 TEST_F(WebViewTest, CreatedDuringLoadDeferral) |
| 3221 { | 3407 { |
| 3222 { | 3408 { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3280 EXPECT_TRUE(webView->page()->defersLoading()); | 3466 EXPECT_TRUE(webView->page()->defersLoading()); |
| 3281 } | 3467 } |
| 3282 | 3468 |
| 3283 EXPECT_TRUE(webView->page()->defersLoading()); | 3469 EXPECT_TRUE(webView->page()->defersLoading()); |
| 3284 } | 3470 } |
| 3285 | 3471 |
| 3286 EXPECT_FALSE(webView->page()->defersLoading()); | 3472 EXPECT_FALSE(webView->page()->defersLoading()); |
| 3287 } | 3473 } |
| 3288 | 3474 |
| 3289 } // namespace blink | 3475 } // namespace blink |
| OLD | NEW |