| 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 424d1c53d8df322a0f3e76d556267ae9a27dbf05..cdcc147ced037c7b552d330f572ec1fa5df1b7a9 100644
|
| --- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
|
| +++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
|
| @@ -86,6 +86,7 @@
|
| #include "public/web/WebFrameContentDumper.h"
|
| #include "public/web/WebHitTestResult.h"
|
| #include "public/web/WebInputEvent.h"
|
| +#include "public/web/WebInputMethodController.h"
|
| #include "public/web/WebScriptSource.h"
|
| #include "public/web/WebSettings.h"
|
| #include "public/web/WebTreeScopeType.h"
|
| @@ -96,6 +97,7 @@
|
| #include "third_party/skia/include/core/SkBitmap.h"
|
| #include "third_party/skia/include/core/SkCanvas.h"
|
| #include "web/DevToolsEmulator.h"
|
| +#include "web/WebInputMethodControllerImpl.h"
|
| #include "web/WebLocalFrameImpl.h"
|
| #include "web/WebSettingsImpl.h"
|
| #include "web/WebViewImpl.h"
|
| @@ -242,6 +244,8 @@ protected:
|
| void testInputMode(const WebString& expectedInputMode, const std::string& htmlFile);
|
| bool tapElement(WebInputEvent::Type, Element*);
|
| bool tapElementById(WebInputEvent::Type, const WebString& id);
|
| + // The WebInputMethodCotnroller corresponding to focused frame (could be nullptr).
|
| + WebInputMethodController* activeInputMethodController() const;
|
|
|
| std::string m_baseURL;
|
| FrameTestHelpers::WebViewHelper m_webViewHelper;
|
| @@ -835,7 +839,7 @@ TEST_F(WebViewTest, FinishComposingTextCursorPositionChange)
|
| std::string compositionText("hello");
|
|
|
| WebVector<WebCompositionUnderline> emptyUnderlines;
|
| - webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 3, 3);
|
| + activeInputMethodController()->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 3, 3);
|
|
|
| WebTextInputInfo info = webView->textInputInfo();
|
| EXPECT_EQ("hello", std::string(info.value.utf8().data()));
|
| @@ -844,14 +848,14 @@ TEST_F(WebViewTest, FinishComposingTextCursorPositionChange)
|
| EXPECT_EQ(0, info.compositionStart);
|
| EXPECT_EQ(5, info.compositionEnd);
|
|
|
| - webView->finishComposingText(WebWidget::KeepSelection);
|
| + activeInputMethodController()->finishComposingText(WebInputMethodController::KeepSelection);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ(3, info.selectionStart);
|
| EXPECT_EQ(3, info.selectionEnd);
|
| EXPECT_EQ(-1, info.compositionStart);
|
| EXPECT_EQ(-1, info.compositionEnd);
|
|
|
| - webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 3, 3);
|
| + activeInputMethodController()->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 3, 3);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("helhellolo", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(6, info.selectionStart);
|
| @@ -859,7 +863,7 @@ TEST_F(WebViewTest, FinishComposingTextCursorPositionChange)
|
| EXPECT_EQ(3, info.compositionStart);
|
| EXPECT_EQ(8, info.compositionEnd);
|
|
|
| - webView->finishComposingText(WebWidget::DoNotKeepSelection);
|
| + activeInputMethodController()->finishComposingText(WebInputMethodController::DoNotKeepSelection);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ(8, info.selectionStart);
|
| EXPECT_EQ(8, info.selectionEnd);
|
| @@ -873,8 +877,8 @@ TEST_F(WebViewTest, SetCompositionForNewCaretPositions)
|
| WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html");
|
| webView->setInitialFocus(false);
|
|
|
| - webView->commitText("hello", 0);
|
| - webView->commitText("world", -5);
|
| + activeInputMethodController()->commitText("hello", 0);
|
| + activeInputMethodController()->commitText("world", -5);
|
| WebTextInputInfo info = webView->textInputInfo();
|
| EXPECT_EQ("helloworld", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(5, info.selectionStart);
|
| @@ -887,7 +891,7 @@ TEST_F(WebViewTest, SetCompositionForNewCaretPositions)
|
| std::string compositionText("ABC");
|
|
|
| // Caret is on the left of composing text.
|
| - webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 0, 0);
|
| + activeInputMethodController()->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 0, 0);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(5, info.selectionStart);
|
| @@ -896,7 +900,7 @@ TEST_F(WebViewTest, SetCompositionForNewCaretPositions)
|
| EXPECT_EQ(8, info.compositionEnd);
|
|
|
| // Caret is on the right of composing text.
|
| - webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 3, 3);
|
| + activeInputMethodController()->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 3, 3);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(8, info.selectionStart);
|
| @@ -905,7 +909,7 @@ TEST_F(WebViewTest, SetCompositionForNewCaretPositions)
|
| EXPECT_EQ(8, info.compositionEnd);
|
|
|
| // Caret is between composing text and left boundary.
|
| - webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, -2, -2);
|
| + activeInputMethodController()->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, -2, -2);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(3, info.selectionStart);
|
| @@ -914,7 +918,7 @@ TEST_F(WebViewTest, SetCompositionForNewCaretPositions)
|
| EXPECT_EQ(8, info.compositionEnd);
|
|
|
| // Caret is between composing text and right boundary.
|
| - webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 5, 5);
|
| + activeInputMethodController()->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 5, 5);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(10, info.selectionStart);
|
| @@ -923,7 +927,7 @@ TEST_F(WebViewTest, SetCompositionForNewCaretPositions)
|
| EXPECT_EQ(8, info.compositionEnd);
|
|
|
| // Caret is on the left boundary.
|
| - webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, -5, -5);
|
| + activeInputMethodController()->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, -5, -5);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(0, info.selectionStart);
|
| @@ -932,7 +936,7 @@ TEST_F(WebViewTest, SetCompositionForNewCaretPositions)
|
| EXPECT_EQ(8, info.compositionEnd);
|
|
|
| // Caret is on the right boundary.
|
| - webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 8, 8);
|
| + activeInputMethodController()->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 8, 8);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(13, info.selectionStart);
|
| @@ -941,7 +945,7 @@ TEST_F(WebViewTest, SetCompositionForNewCaretPositions)
|
| EXPECT_EQ(8, info.compositionEnd);
|
|
|
| // Caret exceeds the left boundary.
|
| - webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, -100, -100);
|
| + activeInputMethodController()->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, -100, -100);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(0, info.selectionStart);
|
| @@ -950,7 +954,7 @@ TEST_F(WebViewTest, SetCompositionForNewCaretPositions)
|
| EXPECT_EQ(8, info.compositionEnd);
|
|
|
| // Caret exceeds the right boundary.
|
| - webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 100, 100);
|
| + activeInputMethodController()->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 100, 100);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("helloABCworld", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(13, info.selectionStart);
|
| @@ -965,7 +969,7 @@ TEST_F(WebViewTest, SetCompositionWithEmptyText)
|
| WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html");
|
| webView->setInitialFocus(false);
|
|
|
| - webView->commitText("hello", 0);
|
| + activeInputMethodController()->commitText("hello", 0);
|
| WebTextInputInfo info = webView->textInputInfo();
|
| EXPECT_EQ("hello", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(5, info.selectionStart);
|
| @@ -975,7 +979,7 @@ TEST_F(WebViewTest, SetCompositionWithEmptyText)
|
|
|
| WebVector<WebCompositionUnderline> emptyUnderlines;
|
|
|
| - webView->setComposition(WebString::fromUTF8(""), emptyUnderlines, 0, 0);
|
| + activeInputMethodController()->setComposition(WebString::fromUTF8(""), emptyUnderlines, 0, 0);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("hello", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(5, info.selectionStart);
|
| @@ -983,7 +987,7 @@ TEST_F(WebViewTest, SetCompositionWithEmptyText)
|
| EXPECT_EQ(-1, info.compositionStart);
|
| EXPECT_EQ(-1, info.compositionEnd);
|
|
|
| - webView->setComposition(WebString::fromUTF8(""), emptyUnderlines, -2, -2);
|
| + activeInputMethodController()->setComposition(WebString::fromUTF8(""), emptyUnderlines, -2, -2);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("hello", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(3, info.selectionStart);
|
| @@ -999,7 +1003,7 @@ TEST_F(WebViewTest, CommitTextForNewCaretPositions)
|
| webView->setInitialFocus(false);
|
|
|
| // Caret is on the left of composing text.
|
| - webView->commitText("ab", -2);
|
| + activeInputMethodController()->commitText("ab", -2);
|
| WebTextInputInfo info = webView->textInputInfo();
|
| EXPECT_EQ("ab", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(0, info.selectionStart);
|
| @@ -1008,7 +1012,7 @@ TEST_F(WebViewTest, CommitTextForNewCaretPositions)
|
| EXPECT_EQ(-1, info.compositionEnd);
|
|
|
| // Caret is on the right of composing text.
|
| - webView->commitText("c", 1);
|
| + activeInputMethodController()->commitText("c", 1);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("cab", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(2, info.selectionStart);
|
| @@ -1017,7 +1021,7 @@ TEST_F(WebViewTest, CommitTextForNewCaretPositions)
|
| EXPECT_EQ(-1, info.compositionEnd);
|
|
|
| // Caret is on the left boundary.
|
| - webView->commitText("def", -5);
|
| + activeInputMethodController()->commitText("def", -5);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("cadefb", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(0, info.selectionStart);
|
| @@ -1026,7 +1030,7 @@ TEST_F(WebViewTest, CommitTextForNewCaretPositions)
|
| EXPECT_EQ(-1, info.compositionEnd);
|
|
|
| // Caret is on the right boundary.
|
| - webView->commitText("g", 6);
|
| + activeInputMethodController()->commitText("g", 6);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("gcadefb", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(7, info.selectionStart);
|
| @@ -1035,7 +1039,7 @@ TEST_F(WebViewTest, CommitTextForNewCaretPositions)
|
| EXPECT_EQ(-1, info.compositionEnd);
|
|
|
| // Caret exceeds the left boundary.
|
| - webView->commitText("hi", -100);
|
| + activeInputMethodController()->commitText("hi", -100);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("gcadefbhi", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(0, info.selectionStart);
|
| @@ -1044,7 +1048,7 @@ TEST_F(WebViewTest, CommitTextForNewCaretPositions)
|
| EXPECT_EQ(-1, info.compositionEnd);
|
|
|
| // Caret exceeds the right boundary.
|
| - webView->commitText("jk", 100);
|
| + activeInputMethodController()->commitText("jk", 100);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("jkgcadefbhi", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(11, info.selectionStart);
|
| @@ -1060,7 +1064,7 @@ TEST_F(WebViewTest, CommitTextWhileComposing)
|
| webView->setInitialFocus(false);
|
|
|
| WebVector<WebCompositionUnderline> emptyUnderlines;
|
| - webView->setComposition(WebString::fromUTF8("abc"), emptyUnderlines, 0, 0);
|
| + activeInputMethodController()->setComposition(WebString::fromUTF8("abc"), emptyUnderlines, 0, 0);
|
| WebTextInputInfo info = webView->textInputInfo();
|
| EXPECT_EQ("abc", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(0, info.selectionStart);
|
| @@ -1070,7 +1074,7 @@ TEST_F(WebViewTest, CommitTextWhileComposing)
|
|
|
| // Deletes ongoing composition, inserts the specified text and moves the
|
| // caret.
|
| - webView->commitText("hello", -2);
|
| + activeInputMethodController()->commitText("hello", -2);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("hello", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(3, info.selectionStart);
|
| @@ -1078,7 +1082,7 @@ TEST_F(WebViewTest, CommitTextWhileComposing)
|
| EXPECT_EQ(-1, info.compositionStart);
|
| EXPECT_EQ(-1, info.compositionEnd);
|
|
|
| - webView->setComposition(WebString::fromUTF8("abc"), emptyUnderlines, 0, 0);
|
| + activeInputMethodController()->setComposition(WebString::fromUTF8("abc"), emptyUnderlines, 0, 0);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("helabclo", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(3, info.selectionStart);
|
| @@ -1087,7 +1091,7 @@ TEST_F(WebViewTest, CommitTextWhileComposing)
|
| EXPECT_EQ(6, info.compositionEnd);
|
|
|
| // Deletes ongoing composition and moves the caret.
|
| - webView->commitText("", 2);
|
| + activeInputMethodController()->commitText("", 2);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("hello", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(5, info.selectionStart);
|
| @@ -1096,7 +1100,7 @@ TEST_F(WebViewTest, CommitTextWhileComposing)
|
| EXPECT_EQ(-1, info.compositionEnd);
|
|
|
| // Inserts the specified text and moves the caret.
|
| - webView->commitText("world", -5);
|
| + activeInputMethodController()->commitText("world", -5);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("helloworld", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(5, info.selectionStart);
|
| @@ -1105,7 +1109,7 @@ TEST_F(WebViewTest, CommitTextWhileComposing)
|
| EXPECT_EQ(-1, info.compositionEnd);
|
|
|
| // Only moves the caret.
|
| - webView->commitText("", 5);
|
| + activeInputMethodController()->commitText("", 5);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("helloworld", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(10, info.selectionStart);
|
| @@ -1139,7 +1143,7 @@ TEST_F(WebViewTest, FinishCompositionDoesNotRevealSelection)
|
| EXPECT_EQ("hello", std::string(info.value.utf8().data()));
|
|
|
| // Verify that the input field is not scrolled back into the viewport.
|
| - webView->finishComposingText(WebWidget::DoNotKeepSelection);
|
| + activeInputMethodController()->finishComposingText(WebInputMethodController::DoNotKeepSelection);
|
| EXPECT_EQ(0, webView->mainFrame()->scrollOffset().width);
|
| EXPECT_EQ(offsetHeight, webView->mainFrame()->scrollOffset().height);
|
| }
|
| @@ -1163,7 +1167,7 @@ TEST_F(WebViewTest, InsertNewLinePlacementAfterFinishComposingText)
|
| EXPECT_EQ(8, info.compositionStart);
|
| EXPECT_EQ(12, info.compositionEnd);
|
|
|
| - webView->finishComposingText(WebWidget::KeepSelection);
|
| + activeInputMethodController()->finishComposingText(WebInputMethodController::KeepSelection);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ(4, info.selectionStart);
|
| EXPECT_EQ(4, info.selectionEnd);
|
| @@ -1171,7 +1175,7 @@ TEST_F(WebViewTest, InsertNewLinePlacementAfterFinishComposingText)
|
| EXPECT_EQ(-1, info.compositionEnd);
|
|
|
| std::string compositionText("\n");
|
| - webView->commitText(WebString::fromUTF8(compositionText.c_str()), 0);
|
| + activeInputMethodController()->commitText(WebString::fromUTF8(compositionText.c_str()), 0);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ(5, info.selectionStart);
|
| EXPECT_EQ(5, info.selectionEnd);
|
| @@ -1231,7 +1235,7 @@ TEST_F(WebViewTest, SetCompositionFromExistingTextInTextArea)
|
| WebLocalFrameImpl* frame = webView->mainFrameImpl();
|
| frame->setEditableSelectionOffsets(27, 27);
|
| std::string newLineText("\n");
|
| - webView->commitText(WebString::fromUTF8(newLineText.c_str()), 0);
|
| + activeInputMethodController()->commitText(WebString::fromUTF8(newLineText.c_str()), 0);
|
| WebTextInputInfo info = webView->textInputInfo();
|
| EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz", std::string(info.value.utf8().data()));
|
|
|
| @@ -1245,7 +1249,7 @@ TEST_F(WebViewTest, SetCompositionFromExistingTextInTextArea)
|
| EXPECT_EQ(34, info.compositionEnd);
|
|
|
| std::string compositionText("yolo");
|
| - webView->commitText(WebString::fromUTF8(compositionText.c_str()), 0);
|
| + activeInputMethodController()->commitText(WebString::fromUTF8(compositionText.c_str()), 0);
|
| info = webView->textInputInfo();
|
| EXPECT_EQ("0123456789abcdefghijklmnopq\nrsyoloxyz", std::string(info.value.utf8().data()));
|
| EXPECT_EQ(34, info.selectionStart);
|
| @@ -1279,8 +1283,8 @@ TEST_F(WebViewTest, SetEditableSelectionOffsetsKeepsComposition)
|
| std::string compositionTextSecond("world");
|
| WebVector<WebCompositionUnderline> emptyUnderlines;
|
|
|
| - webView->commitText(WebString::fromUTF8(compositionTextFirst.c_str()), 0);
|
| - webView->setComposition(WebString::fromUTF8(compositionTextSecond.c_str()), emptyUnderlines, 5, 5);
|
| + activeInputMethodController()->commitText(WebString::fromUTF8(compositionTextFirst.c_str()), 0);
|
| + activeInputMethodController()->setComposition(WebString::fromUTF8(compositionTextSecond.c_str()), emptyUnderlines, 5, 5);
|
|
|
| WebTextInputInfo info = webView->textInputInfo();
|
| EXPECT_EQ("hello world", std::string(info.value.utf8().data()));
|
| @@ -1722,6 +1726,11 @@ bool WebViewTest::tapElementById(WebInputEvent::Type type, const WebString& id)
|
| return tapElement(type, element);
|
| }
|
|
|
| +WebInputMethodController* WebViewTest::activeInputMethodController() const
|
| +{
|
| + return m_webViewHelper.webView()->mainFrameImpl()->frameWidget()->getActiveWebInputMethodController();
|
| +}
|
| +
|
| TEST_F(WebViewTest, DetectContentAroundPosition)
|
| {
|
| URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("content_listeners.html"));
|
| @@ -2322,7 +2331,7 @@ TEST_F(WebViewTest, CompositionNotCancelledByBackspace)
|
| // Select composition and do sanity check.
|
| WebVector<WebCompositionUnderline> emptyUnderlines;
|
| frame->setEditableSelectionOffsets(6, 6);
|
| - EXPECT_TRUE(webView->setComposition("fghij", emptyUnderlines, 0, 5));
|
| + EXPECT_TRUE(activeInputMethodController()->setComposition("fghij", emptyUnderlines, 0, 5));
|
| frame->setEditableSelectionOffsets(11, 11);
|
| verifySelectionAndComposition(webView, 11, 11, 6, 11, "initial case");
|
|
|
| @@ -2335,7 +2344,7 @@ TEST_F(WebViewTest, CompositionNotCancelledByBackspace)
|
| webView->handleInputEvent(keyEvent);
|
|
|
| frame->setEditableSelectionOffsets(6, 6);
|
| - EXPECT_TRUE(webView->setComposition("fghi", emptyUnderlines, 0, 4));
|
| + EXPECT_TRUE(activeInputMethodController()->setComposition("fghi", emptyUnderlines, 0, 4));
|
| frame->setEditableSelectionOffsets(10, 10);
|
| verifySelectionAndComposition(webView, 10, 10, 6, 10, "after pressing Backspace");
|
|
|
| @@ -2361,7 +2370,7 @@ TEST_F(WebViewTest, FinishComposingTextTriggersAutofillTextChange)
|
| std::string compositionText("testingtext");
|
|
|
| WebVector<WebCompositionUnderline> emptyUnderlines;
|
| - webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 0, compositionText.length());
|
| + activeInputMethodController()->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 0, compositionText.length());
|
|
|
| WebTextInputInfo info = webView->textInputInfo();
|
| EXPECT_EQ(0, info.selectionStart);
|
| @@ -2370,7 +2379,7 @@ TEST_F(WebViewTest, FinishComposingTextTriggersAutofillTextChange)
|
| EXPECT_EQ((int) compositionText.length(), info.compositionEnd);
|
|
|
| client.clearChangeCounts();
|
| - webView->finishComposingText(WebWidget::KeepSelection);
|
| + activeInputMethodController()->finishComposingText(WebInputMethodController::KeepSelection);
|
| EXPECT_EQ(0, client.textChangesWhileIgnored());
|
| EXPECT_EQ(1, client.textChangesWhileNotIgnored());
|
|
|
| @@ -3072,8 +3081,8 @@ TEST_F(WebViewTest, NonUserInputTextUpdate)
|
| EXPECT_FALSE(client.textIsUpdated());
|
|
|
| WebVector<WebCompositionUnderline> emptyUnderlines;
|
| - webViewImpl->setComposition(WebString::fromUTF8("2"), emptyUnderlines, 1, 1);
|
| - webViewImpl->finishComposingText(WebWidget::KeepSelection);
|
| + activeInputMethodController()->setComposition(WebString::fromUTF8("2"), emptyUnderlines, 1, 1);
|
| + activeInputMethodController()->finishComposingText(WebInputMethodController::KeepSelection);
|
| EXPECT_FALSE(client.textIsUpdated());
|
| info = webViewImpl->textInputInfo();
|
| EXPECT_EQ("testA2", std::string(info.value.utf8().data()));
|
| @@ -3103,8 +3112,8 @@ TEST_F(WebViewTest, NonUserInputTextUpdate)
|
| // (B.2) Focused and user input modifies value.
|
| client.reset();
|
| EXPECT_FALSE(client.textIsUpdated());
|
| - webViewImpl->setComposition(WebString::fromUTF8("2"), emptyUnderlines, 1, 1);
|
| - webViewImpl->finishComposingText(WebWidget::KeepSelection);
|
| + activeInputMethodController()->setComposition(WebString::fromUTF8("2"), emptyUnderlines, 1, 1);
|
| + activeInputMethodController()->finishComposingText(WebInputMethodController::KeepSelection);
|
| info = webViewImpl->textInputInfo();
|
| EXPECT_EQ("testB2", std::string(info.value.utf8().data()));
|
|
|
| @@ -3197,7 +3206,7 @@ TEST_F(WebViewTest, CompositionIsUserGesture)
|
| frame->setAutofillClient(&client);
|
| webView->setInitialFocus(false);
|
|
|
| - EXPECT_TRUE(webView->setComposition(WebString::fromUTF8(std::string("hello").c_str()), WebVector<WebCompositionUnderline>(), 3, 3));
|
| + EXPECT_TRUE(activeInputMethodController()->setComposition(WebString::fromUTF8(std::string("hello").c_str()), WebVector<WebCompositionUnderline>(), 3, 3));
|
| EXPECT_EQ(1, client.textChangesFromUserGesture());
|
| EXPECT_FALSE(UserGestureIndicator::processingUserGesture());
|
| EXPECT_TRUE(frame->hasMarkedText());
|
| @@ -3545,7 +3554,7 @@ TEST_F(WebViewTest, PasswordFieldEditingIsUserGesture)
|
| frame->setAutofillClient(&client);
|
| webView->setInitialFocus(false);
|
|
|
| - EXPECT_TRUE(webView->commitText(WebString::fromUTF8(std::string("hello").c_str()), 0));
|
| + EXPECT_TRUE(activeInputMethodController()->commitText(WebString::fromUTF8(std::string("hello").c_str()), 0));
|
| EXPECT_EQ(1, client.textChangesFromUserGesture());
|
| EXPECT_FALSE(UserGestureIndicator::processingUserGesture());
|
| frame->setAutofillClient(0);
|
|
|