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

Unified Diff: third_party/WebKit/Source/web/tests/WebViewTest.cpp

Issue 2617443002: Implement ThreadedInputConnection.deleteSurroundingTextInCodePoints() (Closed)
Patch Set: Convert UTF8 to UTF16 Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/tests/WebViewTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebViewTest.cpp b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
index 1bf6e399b662dcadcf11434e50694f3b3f028622..0b5c2cfbd2a8ae9a5c1c20e42335ed1a0359a442 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -1434,6 +1434,34 @@ TEST_P(WebViewTest, DeleteSurroundingText) {
EXPECT_EQ(0, info.selectionEnd);
}
+TEST_P(WebViewTest, DeleteSurroundingTextInCodePoints) {
Changwan Ryu 2017/01/25 07:30:56 I don't think that this test adds any value becaus
yabinh 2017/02/08 12:32:42 Done. Removed.
+ URLTestHelpers::registerMockedURLFromBaseURL(
+ WebString::fromUTF8(m_baseURL.c_str()),
+ WebString::fromUTF8("input_field_populated.html"));
+ WebView* webView = m_webViewHelper.initializeAndLoad(
+ m_baseURL + "input_field_populated.html");
+ WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame());
+ // Focus on node "sample2".
+ webView->setInitialFocus(true);
+
+ frame->setEditableSelectionOffsets(4, 4);
+ frame->deleteSurroundingTextInCodePoints(2, 2);
+ WebInputMethodController* activeInputMethodController =
+ frame->inputMethodController();
+ WebTextInputInfo info = activeInputMethodController->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 = activeInputMethodController->textInputInfo();
+ EXPECT_EQ("deh", info.value);
+ EXPECT_EQ(0, info.selectionStart);
+ EXPECT_EQ(2, info.selectionEnd);
+}
+
TEST_P(WebViewTest, SetCompositionFromExistingText) {
URLTestHelpers::registerMockedURLFromBaseURL(
WebString::fromUTF8(m_baseURL.c_str()),

Powered by Google App Engine
This is Rietveld 408576698