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 239123de6927ea4f08f3ac23fc9e5ed4c4a64c41..7f81bb918be815c8e12547ac3df62d397f144258 100644 |
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp |
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp |
@@ -82,6 +82,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" |
@@ -91,6 +92,7 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
#include "third_party/skia/include/core/SkBitmap.h" |
#include "third_party/skia/include/core/SkCanvas.h" |
+#include "web/WebInputMethodControllerImpl.h" |
#include "web/WebLocalFrameImpl.h" |
#include "web/WebSettingsImpl.h" |
#include "web/WebViewImpl.h" |
@@ -237,6 +239,7 @@ protected: |
void testInputMode(const WebString& expectedInputMode, const std::string& htmlFile); |
bool tapElement(WebInputEvent::Type, Element*); |
bool tapElementById(WebInputEvent::Type, const WebString& id); |
+ WebInputMethodController* inputMethodController() const; |
std::string m_baseURL; |
FrameTestHelpers::WebViewHelper m_webViewHelper; |
@@ -830,7 +833,7 @@ TEST_F(WebViewTest, FinishComposingTextCursorPositionChange) |
std::string compositionText("hello"); |
WebVector<WebCompositionUnderline> emptyUnderlines; |
- webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 3, 3); |
+ inputMethodController()->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 3, 3); |
WebTextInputInfo info = webView->textInputInfo(); |
EXPECT_EQ("hello", std::string(info.value.utf8().data())); |
@@ -839,14 +842,14 @@ TEST_F(WebViewTest, FinishComposingTextCursorPositionChange) |
EXPECT_EQ(0, info.compositionStart); |
EXPECT_EQ(5, info.compositionEnd); |
- webView->finishComposingText(WebWidget::KeepSelection); |
+ inputMethodController()->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); |
+ inputMethodController()->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); |
@@ -854,7 +857,7 @@ TEST_F(WebViewTest, FinishComposingTextCursorPositionChange) |
EXPECT_EQ(3, info.compositionStart); |
EXPECT_EQ(8, info.compositionEnd); |
- webView->finishComposingText(WebWidget::DoNotKeepSelection); |
+ inputMethodController()->finishComposingText(WebInputMethodController::DoNotKeepSelection); |
info = webView->textInputInfo(); |
EXPECT_EQ(8, info.selectionStart); |
EXPECT_EQ(8, info.selectionEnd); |
@@ -868,8 +871,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); |
+ inputMethodController()->commitText("hello", 0); |
+ inputMethodController()->commitText("world", -5); |
WebTextInputInfo info = webView->textInputInfo(); |
EXPECT_EQ("helloworld", std::string(info.value.utf8().data())); |
EXPECT_EQ(5, info.selectionStart); |
@@ -882,7 +885,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); |
+ inputMethodController()->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); |
@@ -891,7 +894,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); |
+ inputMethodController()->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); |
@@ -900,7 +903,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); |
+ inputMethodController()->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); |
@@ -909,7 +912,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); |
+ inputMethodController()->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); |
@@ -918,7 +921,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); |
+ inputMethodController()->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); |
@@ -927,7 +930,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); |
+ inputMethodController()->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); |
@@ -936,7 +939,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); |
+ inputMethodController()->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); |
@@ -945,7 +948,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); |
+ inputMethodController()->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); |
@@ -960,7 +963,7 @@ TEST_F(WebViewTest, SetCompositionWithEmptyText) |
WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_populated.html"); |
webView->setInitialFocus(false); |
- webView->commitText("hello", 0); |
+ inputMethodController()->commitText("hello", 0); |
WebTextInputInfo info = webView->textInputInfo(); |
EXPECT_EQ("hello", std::string(info.value.utf8().data())); |
EXPECT_EQ(5, info.selectionStart); |
@@ -970,7 +973,7 @@ TEST_F(WebViewTest, SetCompositionWithEmptyText) |
WebVector<WebCompositionUnderline> emptyUnderlines; |
- webView->setComposition(WebString::fromUTF8(""), emptyUnderlines, 0, 0); |
+ inputMethodController()->setComposition(WebString::fromUTF8(""), emptyUnderlines, 0, 0); |
info = webView->textInputInfo(); |
EXPECT_EQ("hello", std::string(info.value.utf8().data())); |
EXPECT_EQ(5, info.selectionStart); |
@@ -978,7 +981,7 @@ TEST_F(WebViewTest, SetCompositionWithEmptyText) |
EXPECT_EQ(-1, info.compositionStart); |
EXPECT_EQ(-1, info.compositionEnd); |
- webView->setComposition(WebString::fromUTF8(""), emptyUnderlines, -2, -2); |
+ inputMethodController()->setComposition(WebString::fromUTF8(""), emptyUnderlines, -2, -2); |
info = webView->textInputInfo(); |
EXPECT_EQ("hello", std::string(info.value.utf8().data())); |
EXPECT_EQ(3, info.selectionStart); |
@@ -994,7 +997,7 @@ TEST_F(WebViewTest, CommitTextForNewCaretPositions) |
webView->setInitialFocus(false); |
// Caret is on the left of composing text. |
- webView->commitText("ab", -2); |
+ inputMethodController()->commitText("ab", -2); |
WebTextInputInfo info = webView->textInputInfo(); |
EXPECT_EQ("ab", std::string(info.value.utf8().data())); |
EXPECT_EQ(0, info.selectionStart); |
@@ -1003,7 +1006,7 @@ TEST_F(WebViewTest, CommitTextForNewCaretPositions) |
EXPECT_EQ(-1, info.compositionEnd); |
// Caret is on the right of composing text. |
- webView->commitText("c", 1); |
+ inputMethodController()->commitText("c", 1); |
info = webView->textInputInfo(); |
EXPECT_EQ("cab", std::string(info.value.utf8().data())); |
EXPECT_EQ(2, info.selectionStart); |
@@ -1012,7 +1015,7 @@ TEST_F(WebViewTest, CommitTextForNewCaretPositions) |
EXPECT_EQ(-1, info.compositionEnd); |
// Caret is on the left boundary. |
- webView->commitText("def", -5); |
+ inputMethodController()->commitText("def", -5); |
info = webView->textInputInfo(); |
EXPECT_EQ("cadefb", std::string(info.value.utf8().data())); |
EXPECT_EQ(0, info.selectionStart); |
@@ -1021,7 +1024,7 @@ TEST_F(WebViewTest, CommitTextForNewCaretPositions) |
EXPECT_EQ(-1, info.compositionEnd); |
// Caret is on the right boundary. |
- webView->commitText("g", 6); |
+ inputMethodController()->commitText("g", 6); |
info = webView->textInputInfo(); |
EXPECT_EQ("gcadefb", std::string(info.value.utf8().data())); |
EXPECT_EQ(7, info.selectionStart); |
@@ -1030,7 +1033,7 @@ TEST_F(WebViewTest, CommitTextForNewCaretPositions) |
EXPECT_EQ(-1, info.compositionEnd); |
// Caret exceeds the left boundary. |
- webView->commitText("hi", -100); |
+ inputMethodController()->commitText("hi", -100); |
info = webView->textInputInfo(); |
EXPECT_EQ("gcadefbhi", std::string(info.value.utf8().data())); |
EXPECT_EQ(0, info.selectionStart); |
@@ -1039,7 +1042,7 @@ TEST_F(WebViewTest, CommitTextForNewCaretPositions) |
EXPECT_EQ(-1, info.compositionEnd); |
// Caret exceeds the right boundary. |
- webView->commitText("jk", 100); |
+ inputMethodController()->commitText("jk", 100); |
info = webView->textInputInfo(); |
EXPECT_EQ("jkgcadefbhi", std::string(info.value.utf8().data())); |
EXPECT_EQ(11, info.selectionStart); |
@@ -1055,7 +1058,7 @@ TEST_F(WebViewTest, CommitTextWhileComposing) |
webView->setInitialFocus(false); |
WebVector<WebCompositionUnderline> emptyUnderlines; |
- webView->setComposition(WebString::fromUTF8("abc"), emptyUnderlines, 0, 0); |
+ inputMethodController()->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); |
@@ -1065,7 +1068,7 @@ TEST_F(WebViewTest, CommitTextWhileComposing) |
// Deletes ongoing composition, inserts the specified text and moves the |
// caret. |
- webView->commitText("hello", -2); |
+ inputMethodController()->commitText("hello", -2); |
info = webView->textInputInfo(); |
EXPECT_EQ("hello", std::string(info.value.utf8().data())); |
EXPECT_EQ(3, info.selectionStart); |
@@ -1073,7 +1076,7 @@ TEST_F(WebViewTest, CommitTextWhileComposing) |
EXPECT_EQ(-1, info.compositionStart); |
EXPECT_EQ(-1, info.compositionEnd); |
- webView->setComposition(WebString::fromUTF8("abc"), emptyUnderlines, 0, 0); |
+ inputMethodController()->setComposition(WebString::fromUTF8("abc"), emptyUnderlines, 0, 0); |
info = webView->textInputInfo(); |
EXPECT_EQ("helabclo", std::string(info.value.utf8().data())); |
EXPECT_EQ(3, info.selectionStart); |
@@ -1082,7 +1085,7 @@ TEST_F(WebViewTest, CommitTextWhileComposing) |
EXPECT_EQ(6, info.compositionEnd); |
// Deletes ongoing composition and moves the caret. |
- webView->commitText("", 2); |
+ inputMethodController()->commitText("", 2); |
info = webView->textInputInfo(); |
EXPECT_EQ("hello", std::string(info.value.utf8().data())); |
EXPECT_EQ(5, info.selectionStart); |
@@ -1091,7 +1094,7 @@ TEST_F(WebViewTest, CommitTextWhileComposing) |
EXPECT_EQ(-1, info.compositionEnd); |
// Inserts the specified text and moves the caret. |
- webView->commitText("world", -5); |
+ inputMethodController()->commitText("world", -5); |
info = webView->textInputInfo(); |
EXPECT_EQ("helloworld", std::string(info.value.utf8().data())); |
EXPECT_EQ(5, info.selectionStart); |
@@ -1100,7 +1103,7 @@ TEST_F(WebViewTest, CommitTextWhileComposing) |
EXPECT_EQ(-1, info.compositionEnd); |
// Only moves the caret. |
- webView->commitText("", 5); |
+ inputMethodController()->commitText("", 5); |
info = webView->textInputInfo(); |
EXPECT_EQ("helloworld", std::string(info.value.utf8().data())); |
EXPECT_EQ(10, info.selectionStart); |
@@ -1134,7 +1137,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); |
+ inputMethodController()->finishComposingText(WebInputMethodController::DoNotKeepSelection); |
EXPECT_EQ(0, webView->mainFrame()->scrollOffset().width); |
EXPECT_EQ(offsetHeight, webView->mainFrame()->scrollOffset().height); |
} |
@@ -1158,7 +1161,7 @@ TEST_F(WebViewTest, InsertNewLinePlacementAfterFinishComposingText) |
EXPECT_EQ(8, info.compositionStart); |
EXPECT_EQ(12, info.compositionEnd); |
- webView->finishComposingText(WebWidget::KeepSelection); |
+ inputMethodController()->finishComposingText(WebInputMethodController::KeepSelection); |
info = webView->textInputInfo(); |
EXPECT_EQ(4, info.selectionStart); |
EXPECT_EQ(4, info.selectionEnd); |
@@ -1166,7 +1169,7 @@ TEST_F(WebViewTest, InsertNewLinePlacementAfterFinishComposingText) |
EXPECT_EQ(-1, info.compositionEnd); |
std::string compositionText("\n"); |
- webView->commitText(WebString::fromUTF8(compositionText.c_str()), 0); |
+ inputMethodController()->commitText(WebString::fromUTF8(compositionText.c_str()), 0); |
info = webView->textInputInfo(); |
EXPECT_EQ(5, info.selectionStart); |
EXPECT_EQ(5, info.selectionEnd); |
@@ -1226,7 +1229,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); |
+ inputMethodController()->commitText(WebString::fromUTF8(newLineText.c_str()), 0); |
WebTextInputInfo info = webView->textInputInfo(); |
EXPECT_EQ("0123456789abcdefghijklmnopq\nrstuvwxyz", std::string(info.value.utf8().data())); |
@@ -1240,7 +1243,7 @@ TEST_F(WebViewTest, SetCompositionFromExistingTextInTextArea) |
EXPECT_EQ(34, info.compositionEnd); |
std::string compositionText("yolo"); |
- webView->commitText(WebString::fromUTF8(compositionText.c_str()), 0); |
+ inputMethodController()->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); |
@@ -1274,8 +1277,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); |
+ inputMethodController()->commitText(WebString::fromUTF8(compositionTextFirst.c_str()), 0); |
+ inputMethodController()->setComposition(WebString::fromUTF8(compositionTextSecond.c_str()), emptyUnderlines, 5, 5); |
WebTextInputInfo info = webView->textInputInfo(); |
EXPECT_EQ("hello world", std::string(info.value.utf8().data())); |
@@ -1672,8 +1675,8 @@ public: |
m_wasInMainFrame = false; |
m_contentDetectionResult = WebURL(); |
} |
- |
bool contentDetectionRequested() const { return m_contentDetectionRequested; } |
lfg
2016/09/16 20:17:09
Was this an intended change?
EhsanK
2016/09/20 15:38:29
No. Thanks for noticing it. I don't quite understa
|
+ |
bool pendingIntentsCancelled() const { return m_pendingIntentsCancelled; } |
const WebURL& scheduledIntentURL() const { return m_scheduledIntentURL; } |
bool wasInMainFrame() const { return m_wasInMainFrame; } |
@@ -1717,6 +1720,11 @@ bool WebViewTest::tapElementById(WebInputEvent::Type type, const WebString& id) |
return tapElement(type, element); |
} |
+WebInputMethodController* WebViewTest::inputMethodController() const |
+{ |
+ return m_webViewHelper.webView()->getActiveWebInputMethodController(); |
lfg
2016/09/16 20:17:09
Can you get this through the WebViewFrameWidget?
EhsanK
2016/09/20 15:38:29
Acknowledged.
|
+} |
+ |
TEST_F(WebViewTest, DetectContentAroundPosition) |
{ |
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("content_listeners.html")); |
@@ -2317,7 +2325,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(inputMethodController()->setComposition("fghij", emptyUnderlines, 0, 5)); |
frame->setEditableSelectionOffsets(11, 11); |
verifySelectionAndComposition(webView, 11, 11, 6, 11, "initial case"); |
@@ -2330,7 +2338,7 @@ TEST_F(WebViewTest, CompositionNotCancelledByBackspace) |
webView->handleInputEvent(keyEvent); |
frame->setEditableSelectionOffsets(6, 6); |
- EXPECT_TRUE(webView->setComposition("fghi", emptyUnderlines, 0, 4)); |
+ EXPECT_TRUE(inputMethodController()->setComposition("fghi", emptyUnderlines, 0, 4)); |
frame->setEditableSelectionOffsets(10, 10); |
verifySelectionAndComposition(webView, 10, 10, 6, 10, "after pressing Backspace"); |
@@ -2356,7 +2364,7 @@ TEST_F(WebViewTest, FinishComposingTextTriggersAutofillTextChange) |
std::string compositionText("testingtext"); |
WebVector<WebCompositionUnderline> emptyUnderlines; |
- webView->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 0, compositionText.length()); |
+ inputMethodController()->setComposition(WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 0, compositionText.length()); |
WebTextInputInfo info = webView->textInputInfo(); |
EXPECT_EQ(0, info.selectionStart); |
@@ -2365,7 +2373,7 @@ TEST_F(WebViewTest, FinishComposingTextTriggersAutofillTextChange) |
EXPECT_EQ((int) compositionText.length(), info.compositionEnd); |
client.clearChangeCounts(); |
- webView->finishComposingText(WebWidget::KeepSelection); |
+ inputMethodController()->finishComposingText(WebInputMethodController::KeepSelection); |
EXPECT_EQ(0, client.textChangesWhileIgnored()); |
EXPECT_EQ(1, client.textChangesWhileNotIgnored()); |
@@ -3067,8 +3075,8 @@ TEST_F(WebViewTest, NonUserInputTextUpdate) |
EXPECT_FALSE(client.textIsUpdated()); |
WebVector<WebCompositionUnderline> emptyUnderlines; |
- webViewImpl->setComposition(WebString::fromUTF8("2"), emptyUnderlines, 1, 1); |
- webViewImpl->finishComposingText(WebWidget::KeepSelection); |
+ inputMethodController()->setComposition(WebString::fromUTF8("2"), emptyUnderlines, 1, 1); |
+ inputMethodController()->finishComposingText(WebInputMethodController::KeepSelection); |
EXPECT_FALSE(client.textIsUpdated()); |
info = webViewImpl->textInputInfo(); |
EXPECT_EQ("testA2", std::string(info.value.utf8().data())); |
@@ -3098,8 +3106,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); |
+ inputMethodController()->setComposition(WebString::fromUTF8("2"), emptyUnderlines, 1, 1); |
+ inputMethodController()->finishComposingText(WebInputMethodController::KeepSelection); |
info = webViewImpl->textInputInfo(); |
EXPECT_EQ("testB2", std::string(info.value.utf8().data())); |
@@ -3192,7 +3200,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(inputMethodController()->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()); |
@@ -3540,7 +3548,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(inputMethodController()->commitText(WebString::fromUTF8(std::string("hello").c_str()), 0)); |
EXPECT_EQ(1, client.textChangesFromUserGesture()); |
EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); |
frame->setAutofillClient(0); |