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

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

Issue 2491643004: Update layout in WebInputMethodController::finishComposingText (Closed)
Patch Set: Change test name Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/web/WebInputMethodControllerImpl.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 694a33eff7f3de96b7f7581809241cebf75fc003..227304acf814f3b5b470585175ca87872c6e17b0 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -897,6 +897,38 @@ TEST_P(WebViewTest, SetEditableSelectionOffsetsAndTextInputInfo) {
EXPECT_EQ(-1, info.compositionEnd);
}
+// Regression test for crbug.com/663645
+TEST_P(WebViewTest, FinishComposingTextDoesNotAssert) {
+ URLTestHelpers::registerMockedURLFromBaseURL(
+ WebString::fromUTF8(m_baseURL.c_str()),
+ WebString::fromUTF8("input_field_default.html"));
+ WebViewImpl* webView =
+ m_webViewHelper.initializeAndLoad(m_baseURL + "input_field_default.html");
+ webView->setInitialFocus(false);
+
+ WebInputMethodController* activeInputMethodController =
+ webView->mainFrameImpl()
+ ->frameWidget()
+ ->getActiveWebInputMethodController();
+
+ // The test requires non-empty composition.
+ std::string compositionText("hello");
+ WebVector<WebCompositionUnderline> emptyUnderlines;
+ activeInputMethodController->setComposition(
+ WebString::fromUTF8(compositionText.c_str()), emptyUnderlines, 5, 5);
+
+ // Do arbitrary change to make layout dirty.
+ Document& document = *webView->mainFrameImpl()->frame()->document();
+ Element* br = document.createElement("br", ASSERT_NO_EXCEPTION);
+ document.body()->appendChild(br);
+
+ // Should not hit assertion when calling
+ // WebInputMethodController::finishComposingText with non-empty composition
+ // and dirty layout.
+ activeInputMethodController->finishComposingText(
+ WebInputMethodController::KeepSelection);
+}
+
TEST_P(WebViewTest, FinishComposingTextCursorPositionChange) {
URLTestHelpers::registerMockedURLFromBaseURL(
WebString::fromUTF8(m_baseURL.c_str()),
« no previous file with comments | « third_party/WebKit/Source/web/WebInputMethodControllerImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698