Chromium Code Reviews| Index: content/renderer/render_view_browsertest.cc |
| diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc |
| index b8ec2149f8e1c17f0e7bfa5898b96d5127321f62..f4b6cd9cea0c14bfe049f749bcb85992031864c1 100644 |
| --- a/content/renderer/render_view_browsertest.cc |
| +++ b/content/renderer/render_view_browsertest.cc |
| @@ -1728,3 +1728,66 @@ TEST_F(RenderViewImplTest, ZoomLimit) { |
| ProcessPendingMessages(); |
| EXPECT_DOUBLE_EQ(kMaxZoomLevel, view()->GetWebView()->zoomLevel()); |
| } |
| + |
|
rniwa-cr
2012/08/23 17:46:26
Why didn't we add these tests in webkit side?
olilan
2012/08/24 09:30:49
Equivalent tests have been added on the webkit sid
|
| +TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) { |
| + // Load an HTML page consisting of an input field. |
| + LoadHTML("<html>" |
| + "<head>" |
| + "</head>" |
| + "<body>" |
| + "<input id=\"test1\" value=\"some test text hello\"></input>" |
| + "</body>" |
| + "</html>"); |
| + ExecuteJavaScript("document.getElementById('test1').focus();"); |
| + view()->OnSetEditableSelectionOffsets(4, 8); |
| + const std::vector<WebKit::WebCompositionUnderline> empty_underline; |
| + view()->OnSetCompositionFromExistingText(7,10, empty_underline); |
| + WebKit::WebTextInputInfo info = view()->webview()->textInputInfo(); |
| + EXPECT_EQ(4, info.selectionStart); |
| + EXPECT_EQ(8, info.selectionEnd); |
| + EXPECT_EQ(7, info.compositionStart); |
| + EXPECT_EQ(10, info.compositionEnd); |
| + view()->OnUnselect(); |
| + info = view()->webview()->textInputInfo(); |
| + EXPECT_EQ(0, info.selectionStart); |
| + EXPECT_EQ(0, info.selectionEnd); |
| +} |
| + |
| +TEST_F(RenderViewImplTest, OnReplaceAll) { |
| + // Load an HTML page consisting of an input field. |
| + LoadHTML("<html>" |
| + "<head>" |
| + "</head>" |
| + "<body>" |
| + "<input id=\"test1\" value=\"some test text hello\"></input>" |
| + "</body>" |
| + "</html>"); |
| + ExecuteJavaScript("document.getElementById('test1').focus();"); |
| + view()->OnReplaceAll(UTF8ToUTF16("replacement words")); |
| + WebKit::WebTextInputInfo info = view()->webview()->textInputInfo(); |
| + EXPECT_EQ("replacement words", info.value); |
| +} |
| + |
| +TEST_F(RenderViewImplTest, OnExtendSelectionAndDelete) { |
| + // Load an HTML page consisting of an input field. |
| + LoadHTML("<html>" |
| + "<head>" |
| + "</head>" |
| + "<body>" |
| + "<input id=\"test1\" value=\"abcdefghijklmnopqrstuvwxyz\"></input>" |
| + "</body>" |
| + "</html>"); |
| + ExecuteJavaScript("document.getElementById('test1').focus();"); |
| + view()->OnSetEditableSelectionOffsets(10, 10); |
| + view()->OnExtendSelectionAndDelete(3, 4); |
| + WebKit::WebTextInputInfo info = view()->webview()->textInputInfo(); |
| + EXPECT_EQ("abcdefgopqrstuvwxyz", info.value); |
| + EXPECT_EQ(7, info.selectionStart); |
| + EXPECT_EQ(7, info.selectionEnd); |
| + view()->OnSetEditableSelectionOffsets(4, 8); |
| + view()->OnExtendSelectionAndDelete(2, 5); |
| + info = view()->webview()->textInputInfo(); |
| + EXPECT_EQ("abuvwxyz", info.value); |
| + EXPECT_EQ(2, info.selectionStart); |
| + EXPECT_EQ(2, info.selectionEnd); |
| +} |