| 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 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 EXPECT_EQ(8, info.compositionEnd); | 855 EXPECT_EQ(8, info.compositionEnd); |
| 856 | 856 |
| 857 webView->confirmComposition(WebWidget::DoNotKeepSelection); | 857 webView->confirmComposition(WebWidget::DoNotKeepSelection); |
| 858 info = webView->textInputInfo(); | 858 info = webView->textInputInfo(); |
| 859 EXPECT_EQ(8, info.selectionStart); | 859 EXPECT_EQ(8, info.selectionStart); |
| 860 EXPECT_EQ(8, info.selectionEnd); | 860 EXPECT_EQ(8, info.selectionEnd); |
| 861 EXPECT_EQ(-1, info.compositionStart); | 861 EXPECT_EQ(-1, info.compositionStart); |
| 862 EXPECT_EQ(-1, info.compositionEnd); | 862 EXPECT_EQ(-1, info.compositionEnd); |
| 863 } | 863 } |
| 864 | 864 |
| 865 TEST_F(WebViewTest, SetCompositionForNewCaretPositions) |
| 866 { |
| 867 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); |
| 868 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html"); |
| 869 webView->setInitialFocus(false); |
| 870 |
| 871 webView->confirmComposition("hello", 1); |
| 872 webView->confirmComposition("world", 0); |
| 873 WebTextInputInfo info = webView->textInputInfo(); |
| 874 EXPECT_EQ("helloworld", std::string(info.value.utf8().data())); |
| 875 EXPECT_EQ(5, info.selectionStart); |
| 876 EXPECT_EQ(5, info.selectionEnd); |
| 877 EXPECT_EQ(-1, info.compositionStart); |
| 878 EXPECT_EQ(-1, info.compositionEnd); |
| 879 |
| 880 WebVector<WebCompositionUnderline> emptyUnderlines; |
| 881 // Set up a composition that needs to be committed. |
| 882 std::string compositionText("ABC"); |
| 883 |
| 884 // Caret is on the left of composing text. |
| 885 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU
nderlines, 0, 0); |
| 886 info = webView->textInputInfo(); |
| 887 EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); |
| 888 EXPECT_EQ(5, info.selectionStart); |
| 889 EXPECT_EQ(5, info.selectionEnd); |
| 890 EXPECT_EQ(5, info.compositionStart); |
| 891 EXPECT_EQ(8, info.compositionEnd); |
| 892 |
| 893 // Caret is on the right of composing text. |
| 894 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU
nderlines, 3, 3); |
| 895 info = webView->textInputInfo(); |
| 896 EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); |
| 897 EXPECT_EQ(8, info.selectionStart); |
| 898 EXPECT_EQ(8, info.selectionEnd); |
| 899 EXPECT_EQ(5, info.compositionStart); |
| 900 EXPECT_EQ(8, info.compositionEnd); |
| 901 |
| 902 // Caret is between composing text and left boundary. |
| 903 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU
nderlines, -2, -2); |
| 904 info = webView->textInputInfo(); |
| 905 EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); |
| 906 EXPECT_EQ(3, info.selectionStart); |
| 907 EXPECT_EQ(3, info.selectionEnd); |
| 908 EXPECT_EQ(5, info.compositionStart); |
| 909 EXPECT_EQ(8, info.compositionEnd); |
| 910 |
| 911 // Caret is between composing text and right boundary. |
| 912 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU
nderlines, 5, 5); |
| 913 info = webView->textInputInfo(); |
| 914 EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); |
| 915 EXPECT_EQ(10, info.selectionStart); |
| 916 EXPECT_EQ(10, info.selectionEnd); |
| 917 EXPECT_EQ(5, info.compositionStart); |
| 918 EXPECT_EQ(8, info.compositionEnd); |
| 919 |
| 920 // Caret is on the left boundary. |
| 921 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU
nderlines, -5, -5); |
| 922 info = webView->textInputInfo(); |
| 923 EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); |
| 924 EXPECT_EQ(0, info.selectionStart); |
| 925 EXPECT_EQ(0, info.selectionEnd); |
| 926 EXPECT_EQ(5, info.compositionStart); |
| 927 EXPECT_EQ(8, info.compositionEnd); |
| 928 |
| 929 // Caret is on the right boundary. |
| 930 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU
nderlines, 8, 8); |
| 931 info = webView->textInputInfo(); |
| 932 EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); |
| 933 EXPECT_EQ(13, info.selectionStart); |
| 934 EXPECT_EQ(13, info.selectionEnd); |
| 935 EXPECT_EQ(5, info.compositionStart); |
| 936 EXPECT_EQ(8, info.compositionEnd); |
| 937 |
| 938 // Caret exceeds the left boundary. |
| 939 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU
nderlines, -100, -100); |
| 940 info = webView->textInputInfo(); |
| 941 EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); |
| 942 EXPECT_EQ(0, info.selectionStart); |
| 943 EXPECT_EQ(0, info.selectionEnd); |
| 944 EXPECT_EQ(5, info.compositionStart); |
| 945 EXPECT_EQ(8, info.compositionEnd); |
| 946 |
| 947 // Caret exceeds the right boundary. |
| 948 webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyU
nderlines, 100, 100); |
| 949 info = webView->textInputInfo(); |
| 950 EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data())); |
| 951 EXPECT_EQ(13, info.selectionStart); |
| 952 EXPECT_EQ(13, info.selectionEnd); |
| 953 EXPECT_EQ(5, info.compositionStart); |
| 954 EXPECT_EQ(8, info.compositionEnd); |
| 955 } |
| 956 |
| 957 TEST_F(WebViewTest, SetCompositionWithEmptyText) |
| 958 { |
| 959 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); |
| 960 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html"); |
| 961 webView->setInitialFocus(false); |
| 962 |
| 963 webView->confirmComposition("hello", 1); |
| 964 WebTextInputInfo info = webView->textInputInfo(); |
| 965 EXPECT_EQ("hello", std::string(info.value.utf8().data())); |
| 966 EXPECT_EQ(5, info.selectionStart); |
| 967 EXPECT_EQ(5, info.selectionEnd); |
| 968 EXPECT_EQ(-1, info.compositionStart); |
| 969 EXPECT_EQ(-1, info.compositionEnd); |
| 970 |
| 971 WebVector<WebCompositionUnderline> emptyUnderlines; |
| 972 |
| 973 webView->setComposition(WebString::fromUTF8(""), emptyUnderlines, 0, 0); |
| 974 info = webView->textInputInfo(); |
| 975 EXPECT_EQ("hello", std::string(info.value.utf8().data())); |
| 976 EXPECT_EQ(5, info.selectionStart); |
| 977 EXPECT_EQ(5, info.selectionEnd); |
| 978 EXPECT_EQ(-1, info.compositionStart); |
| 979 EXPECT_EQ(-1, info.compositionEnd); |
| 980 |
| 981 webView->setComposition(WebString::fromUTF8(""), emptyUnderlines, -2, -2); |
| 982 info = webView->textInputInfo(); |
| 983 EXPECT_EQ("hello", std::string(info.value.utf8().data())); |
| 984 EXPECT_EQ(3, info.selectionStart); |
| 985 EXPECT_EQ(3, info.selectionEnd); |
| 986 EXPECT_EQ(-1, info.compositionStart); |
| 987 EXPECT_EQ(-1, info.compositionEnd); |
| 988 } |
| 989 |
| 990 TEST_F(WebViewTest, ConfirmCompositionForNewCaretPositions) |
| 991 { |
| 992 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); |
| 993 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_fiel
d_populated.html"); |
| 994 webView->setInitialFocus(false); |
| 995 |
| 996 // Caret is on the left of composing text. |
| 997 webView->confirmComposition("ab", 0); |
| 998 WebTextInputInfo info = webView->textInputInfo(); |
| 999 EXPECT_EQ("ab", std::string(info.value.utf8().data())); |
| 1000 EXPECT_EQ(0, info.selectionStart); |
| 1001 EXPECT_EQ(0, info.selectionEnd); |
| 1002 EXPECT_EQ(-1, info.compositionStart); |
| 1003 EXPECT_EQ(-1, info.compositionEnd); |
| 1004 |
| 1005 // Caret is on the right of composing text. |
| 1006 webView->confirmComposition("c", 2); |
| 1007 info = webView->textInputInfo(); |
| 1008 EXPECT_EQ("cab", std::string(info.value.utf8().data())); |
| 1009 EXPECT_EQ(2, info.selectionStart); |
| 1010 EXPECT_EQ(2, info.selectionEnd); |
| 1011 EXPECT_EQ(-1, info.compositionStart); |
| 1012 EXPECT_EQ(-1, info.compositionEnd); |
| 1013 |
| 1014 // Caret is on the left boundary. |
| 1015 webView->confirmComposition("def", -2); |
| 1016 info = webView->textInputInfo(); |
| 1017 EXPECT_EQ("cadefb", std::string(info.value.utf8().data())); |
| 1018 EXPECT_EQ(0, info.selectionStart); |
| 1019 EXPECT_EQ(0, info.selectionEnd); |
| 1020 EXPECT_EQ(-1, info.compositionStart); |
| 1021 EXPECT_EQ(-1, info.compositionEnd); |
| 1022 |
| 1023 // Caret is on the right boundary. |
| 1024 webView->confirmComposition("g", 7); |
| 1025 info = webView->textInputInfo(); |
| 1026 EXPECT_EQ("gcadefb", std::string(info.value.utf8().data())); |
| 1027 EXPECT_EQ(7, info.selectionStart); |
| 1028 EXPECT_EQ(7, info.selectionEnd); |
| 1029 EXPECT_EQ(-1, info.compositionStart); |
| 1030 EXPECT_EQ(-1, info.compositionEnd); |
| 1031 |
| 1032 // Caret exceeds the left boundary. |
| 1033 webView->confirmComposition("hi", -100); |
| 1034 info = webView->textInputInfo(); |
| 1035 EXPECT_EQ("gcadefbhi", std::string(info.value.utf8().data())); |
| 1036 EXPECT_EQ(0, info.selectionStart); |
| 1037 EXPECT_EQ(0, info.selectionEnd); |
| 1038 EXPECT_EQ(-1, info.compositionStart); |
| 1039 EXPECT_EQ(-1, info.compositionEnd); |
| 1040 |
| 1041 // Caret exceeds the right boundary. |
| 1042 webView->confirmComposition("jk", 100); |
| 1043 info = webView->textInputInfo(); |
| 1044 EXPECT_EQ("jkgcadefbhi", std::string(info.value.utf8().data())); |
| 1045 EXPECT_EQ(11, info.selectionStart); |
| 1046 EXPECT_EQ(11, info.selectionEnd); |
| 1047 EXPECT_EQ(-1, info.compositionStart); |
| 1048 EXPECT_EQ(-1, info.compositionEnd); |
| 1049 } |
| 1050 |
| 865 TEST_F(WebViewTest, FinishCompositionDoesNotRevealSelection) | 1051 TEST_F(WebViewTest, FinishCompositionDoesNotRevealSelection) |
| 866 { | 1052 { |
| 867 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("form_with_input.html")); | 1053 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("form_with_input.html")); |
| 868 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "form_w
ith_input.html"); | 1054 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "form_w
ith_input.html"); |
| 869 webView->resize(WebSize(800, 600)); | 1055 webView->resize(WebSize(800, 600)); |
| 870 webView->setInitialFocus(false); | 1056 webView->setInitialFocus(false); |
| 871 EXPECT_EQ(0, webView->mainFrame()->scrollOffset().width); | 1057 EXPECT_EQ(0, webView->mainFrame()->scrollOffset().width); |
| 872 EXPECT_EQ(0, webView->mainFrame()->scrollOffset().height); | 1058 EXPECT_EQ(0, webView->mainFrame()->scrollOffset().height); |
| 873 | 1059 |
| 874 // Set up a composition from existing text that needs to be committed. | 1060 // 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... |
| 912 EXPECT_EQ(12, info.compositionEnd); | 1098 EXPECT_EQ(12, info.compositionEnd); |
| 913 | 1099 |
| 914 webView->confirmComposition(WebWidget::KeepSelection); | 1100 webView->confirmComposition(WebWidget::KeepSelection); |
| 915 info = webView->textInputInfo(); | 1101 info = webView->textInputInfo(); |
| 916 EXPECT_EQ(4, info.selectionStart); | 1102 EXPECT_EQ(4, info.selectionStart); |
| 917 EXPECT_EQ(4, info.selectionEnd); | 1103 EXPECT_EQ(4, info.selectionEnd); |
| 918 EXPECT_EQ(-1, info.compositionStart); | 1104 EXPECT_EQ(-1, info.compositionStart); |
| 919 EXPECT_EQ(-1, info.compositionEnd); | 1105 EXPECT_EQ(-1, info.compositionEnd); |
| 920 | 1106 |
| 921 std::string compositionText("\n"); | 1107 std::string compositionText("\n"); |
| 922 webView->confirmComposition(WebString::fromUTF8(compositionText.c_str())); | 1108 webView->confirmComposition(WebString::fromUTF8(compositionText.c_str()), 1)
; |
| 923 info = webView->textInputInfo(); | 1109 info = webView->textInputInfo(); |
| 924 EXPECT_EQ(5, info.selectionStart); | 1110 EXPECT_EQ(5, info.selectionStart); |
| 925 EXPECT_EQ(5, info.selectionEnd); | 1111 EXPECT_EQ(5, info.selectionEnd); |
| 926 EXPECT_EQ(-1, info.compositionStart); | 1112 EXPECT_EQ(-1, info.compositionStart); |
| 927 EXPECT_EQ(-1, info.compositionEnd); | 1113 EXPECT_EQ(-1, info.compositionEnd); |
| 928 EXPECT_EQ("0123\n456789abcdefghijklmnopqrstuvwxyz", std::string(info.value.u
tf8().data())); | 1114 EXPECT_EQ("0123\n456789abcdefghijklmnopqrstuvwxyz", std::string(info.value.u
tf8().data())); |
| 929 } | 1115 } |
| 930 | 1116 |
| 931 TEST_F(WebViewTest, ExtendSelectionAndDelete) | 1117 TEST_F(WebViewTest, ExtendSelectionAndDelete) |
| 932 { | 1118 { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 TEST_F(WebViewTest, SetCompositionFromExistingTextInTextArea) | 1158 TEST_F(WebViewTest, SetCompositionFromExistingTextInTextArea) |
| 973 { | 1159 { |
| 974 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("text_area_populated.html")); | 1160 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("text_area_populated.html")); |
| 975 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "text_a
rea_populated.html"); | 1161 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "text_a
rea_populated.html"); |
| 976 webView->setInitialFocus(false); | 1162 webView->setInitialFocus(false); |
| 977 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); | 1163 WebVector<WebCompositionUnderline> underlines(static_cast<size_t>(1)); |
| 978 underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0); | 1164 underlines[0] = WebCompositionUnderline(0, 4, 0, false, 0); |
| 979 WebLocalFrameImpl* frame = webView->mainFrameImpl(); | 1165 WebLocalFrameImpl* frame = webView->mainFrameImpl(); |
| 980 frame->setEditableSelectionOffsets(27, 27); | 1166 frame->setEditableSelectionOffsets(27, 27); |
| 981 std::string newLineText("\n"); | 1167 std::string newLineText("\n"); |
| 982 webView->confirmComposition(WebString::fromUTF8(newLineText.c_str())); | 1168 webView->confirmComposition(WebString::fromUTF8(newLineText.c_str()), 1); |
| 983 WebTextInputInfo info = webView->textInputInfo(); | 1169 WebTextInputInfo info = webView->textInputInfo(); |
| 984 EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz", std::string(info.value.u
tf8().data())); | 1170 EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz", std::string(info.value.u
tf8().data())); |
| 985 | 1171 |
| 986 frame->setEditableSelectionOffsets(31, 31); | 1172 frame->setEditableSelectionOffsets(31, 31); |
| 987 frame->setCompositionFromExistingText(30, 34, underlines); | 1173 frame->setCompositionFromExistingText(30, 34, underlines); |
| 988 info = webView->textInputInfo(); | 1174 info = webView->textInputInfo(); |
| 989 EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz", std::string(info.value.u
tf8().data())); | 1175 EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz", std::string(info.value.u
tf8().data())); |
| 990 EXPECT_EQ(31, info.selectionStart); | 1176 EXPECT_EQ(31, info.selectionStart); |
| 991 EXPECT_EQ(31, info.selectionEnd); | 1177 EXPECT_EQ(31, info.selectionEnd); |
| 992 EXPECT_EQ(30, info.compositionStart); | 1178 EXPECT_EQ(30, info.compositionStart); |
| 993 EXPECT_EQ(34, info.compositionEnd); | 1179 EXPECT_EQ(34, info.compositionEnd); |
| 994 | 1180 |
| 995 std::string compositionText("yolo"); | 1181 std::string compositionText("yolo"); |
| 996 webView->confirmComposition(WebString::fromUTF8(compositionText.c_str())); | 1182 webView->confirmComposition(WebString::fromUTF8(compositionText.c_str()), 1)
; |
| 997 info = webView->textInputInfo(); | 1183 info = webView->textInputInfo(); |
| 998 EXPECT_EQ("0123456789abcdefghijklmnopq\nrsyoloxyz", std::string(info.value.u
tf8().data())); | 1184 EXPECT_EQ("0123456789abcdefghijklmnopq\nrsyoloxyz", std::string(info.value.u
tf8().data())); |
| 999 EXPECT_EQ(34, info.selectionStart); | 1185 EXPECT_EQ(34, info.selectionStart); |
| 1000 EXPECT_EQ(34, info.selectionEnd); | 1186 EXPECT_EQ(34, info.selectionEnd); |
| 1001 EXPECT_EQ(-1, info.compositionStart); | 1187 EXPECT_EQ(-1, info.compositionStart); |
| 1002 EXPECT_EQ(-1, info.compositionEnd); | 1188 EXPECT_EQ(-1, info.compositionEnd); |
| 1003 } | 1189 } |
| 1004 | 1190 |
| 1005 TEST_F(WebViewTest, SetCompositionFromExistingTextInRichText) | 1191 TEST_F(WebViewTest, SetCompositionFromExistingTextInRichText) |
| 1006 { | 1192 { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1020 TEST_F(WebViewTest, SetEditableSelectionOffsetsKeepsComposition) | 1206 TEST_F(WebViewTest, SetEditableSelectionOffsetsKeepsComposition) |
| 1021 { | 1207 { |
| 1022 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); | 1208 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_populated.html")); |
| 1023 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_
field_populated.html"); | 1209 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_
field_populated.html"); |
| 1024 webView->setInitialFocus(false); | 1210 webView->setInitialFocus(false); |
| 1025 | 1211 |
| 1026 std::string compositionTextFirst("hello "); | 1212 std::string compositionTextFirst("hello "); |
| 1027 std::string compositionTextSecond("world"); | 1213 std::string compositionTextSecond("world"); |
| 1028 WebVector<WebCompositionUnderline> emptyUnderlines; | 1214 WebVector<WebCompositionUnderline> emptyUnderlines; |
| 1029 | 1215 |
| 1030 webView->confirmComposition(WebString::fromUTF8(compositionTextFirst.c_str()
)); | 1216 webView->confirmComposition(WebString::fromUTF8(compositionTextFirst.c_str()
), 1); |
| 1031 webView->setComposition(WebString::fromUTF8(compositionTextSecond.c_str()),
emptyUnderlines, 5, 5); | 1217 webView->setComposition(WebString::fromUTF8(compositionTextSecond.c_str()),
emptyUnderlines, 5, 5); |
| 1032 | 1218 |
| 1033 WebTextInputInfo info = webView->textInputInfo(); | 1219 WebTextInputInfo info = webView->textInputInfo(); |
| 1034 EXPECT_EQ("hello world", std::string(info.value.utf8().data())); | 1220 EXPECT_EQ("hello world", std::string(info.value.utf8().data())); |
| 1035 EXPECT_EQ(11, info.selectionStart); | 1221 EXPECT_EQ(11, info.selectionStart); |
| 1036 EXPECT_EQ(11, info.selectionEnd); | 1222 EXPECT_EQ(11, info.selectionEnd); |
| 1037 EXPECT_EQ(6, info.compositionStart); | 1223 EXPECT_EQ(6, info.compositionStart); |
| 1038 EXPECT_EQ(11, info.compositionEnd); | 1224 EXPECT_EQ(11, info.compositionEnd); |
| 1039 | 1225 |
| 1040 WebLocalFrameImpl* frame = webView->mainFrameImpl(); | 1226 WebLocalFrameImpl* frame = webView->mainFrameImpl(); |
| (...skipping 2223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3264 | 3450 |
| 3265 TEST_F(WebViewTest, PasswordFieldEditingIsUserGesture) | 3451 TEST_F(WebViewTest, PasswordFieldEditingIsUserGesture) |
| 3266 { | 3452 { |
| 3267 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_password.html")); | 3453 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("input_field_password.html")); |
| 3268 MockAutofillClient client; | 3454 MockAutofillClient client; |
| 3269 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_
field_password.html", true); | 3455 WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_
field_password.html", true); |
| 3270 WebLocalFrameImpl* frame = webView->mainFrameImpl(); | 3456 WebLocalFrameImpl* frame = webView->mainFrameImpl(); |
| 3271 frame->setAutofillClient(&client); | 3457 frame->setAutofillClient(&client); |
| 3272 webView->setInitialFocus(false); | 3458 webView->setInitialFocus(false); |
| 3273 | 3459 |
| 3274 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); | 3460 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()), 1)); |
| 3275 EXPECT_EQ(1, client.textChangesFromUserGesture()); | 3461 EXPECT_EQ(1, client.textChangesFromUserGesture()); |
| 3276 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); | 3462 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); |
| 3277 frame->setAutofillClient(0); | 3463 frame->setAutofillClient(0); |
| 3278 } | 3464 } |
| 3279 | 3465 |
| 3280 // Verify that a WebView created with a ScopedPageLoadDeferrer already on the | 3466 // Verify that a WebView created with a ScopedPageLoadDeferrer already on the |
| 3281 // stack defers its loads. | 3467 // stack defers its loads. |
| 3282 TEST_F(WebViewTest, CreatedDuringLoadDeferral) | 3468 TEST_F(WebViewTest, CreatedDuringLoadDeferral) |
| 3283 { | 3469 { |
| 3284 { | 3470 { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3342 EXPECT_TRUE(webView->page()->defersLoading()); | 3528 EXPECT_TRUE(webView->page()->defersLoading()); |
| 3343 } | 3529 } |
| 3344 | 3530 |
| 3345 EXPECT_TRUE(webView->page()->defersLoading()); | 3531 EXPECT_TRUE(webView->page()->defersLoading()); |
| 3346 } | 3532 } |
| 3347 | 3533 |
| 3348 EXPECT_FALSE(webView->page()->defersLoading()); | 3534 EXPECT_FALSE(webView->page()->defersLoading()); |
| 3349 } | 3535 } |
| 3350 | 3536 |
| 3351 } // namespace blink | 3537 } // namespace blink |
| OLD | NEW |