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 2629721103184e7191ab460df5941463fa1657c4..823719c2d9ed8074596ef552c1edecfd3d66cc09 100644 |
| --- a/content/renderer/render_view_browsertest.cc |
| +++ b/content/renderer/render_view_browsertest.cc |
| @@ -1667,6 +1667,37 @@ TEST_F(RenderViewImplTest, OnDeleteSurroundingText) { |
| EXPECT_EQ(0, info.selectionEnd); |
| } |
| +TEST_F(RenderViewImplTest, OnDeleteSurroundingTextInCodePoints) { |
| + // Load an HTML page consisting of an input field. |
| + LoadHTML( |
| + "<html>" |
|
yosin_UTC9
2017/02/09 07:19:27
Are HTML, HEAD, BODY required for test or changes
yabinh
2017/02/09 10:37:03
Done.
|
| + "<head>" |
| + "</head>" |
| + "<body>" |
| + // "ab" + trophy + space + "cdef" + trophy + space + "gh". |
| + "<input id=\"test1\" value=\"ab🏆 cdef🏆 gh\"></input>" |
|
yosin_UTC9
2017/02/09 07:19:27
- It is better to use single quote to avoid escapi
yabinh
2017/02/09 10:37:03
Done.
|
| + "</body>" |
| + "</html>"); |
| + ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); |
| + |
| + frame()->SetEditableSelectionOffsets(4, 4); |
| + frame()->DeleteSurroundingTextInCodePoints(2, 2); |
| + blink::WebInputMethodController* controller = |
| + frame()->GetWebFrame()->inputMethodController(); |
| + blink::WebTextInputInfo info = controller->textInputInfo(); |
| + // "a" + "def" + trophy + space + "gh". |
| + EXPECT_EQ(WebString::fromUTF8("adef\xF0\x9F\x8F\x86 gh"), info.value); |
| + EXPECT_EQ(1, info.selectionStart); |
| + EXPECT_EQ(1, info.selectionEnd); |
| + |
| + frame()->SetEditableSelectionOffsets(1, 3); |
| + frame()->DeleteSurroundingTextInCodePoints(1, 4); |
| + info = controller->textInputInfo(); |
| + EXPECT_EQ("deh", info.value); |
| + EXPECT_EQ(0, info.selectionStart); |
| + EXPECT_EQ(2, info.selectionEnd); |
| +} |
| + |
| // Test that the navigating specific frames works correctly. |
| TEST_F(RenderViewImplTest, NavigateSubframe) { |
| // Load page A. |