Chromium Code Reviews| 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 e00f06aa70a6649aab0bb09558f254099b4e8df7..160c1aa4a6a0c0d4b2661e6c7f82a937d00bdd92 100644 |
| --- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp |
| +++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp |
| @@ -74,6 +74,7 @@ |
| #include "public/platform/WebLayerTreeView.h" |
| #include "public/platform/WebMockClipboard.h" |
| #include "public/platform/WebSize.h" |
| +#include "public/platform/WebTextInputType.h" |
| #include "public/platform/WebThread.h" |
| #include "public/platform/WebURLLoaderMockFactory.h" |
| #include "public/web/WebAutofillClient.h" |
| @@ -4361,4 +4362,40 @@ TEST_P(WebViewTest, ViewportOverrideAdaptsToScaleAndScroll) { |
| *devToolsEmulator->visibleContentRectForPainting()); |
| } |
| +TEST_P(WebViewTest, CompositionIsRemovedOnDeletingElement) { |
|
Changwan Ryu
2016/11/24 09:34:38
Hmm... Could you also rename this to something lik
yosin_UTC9
2016/11/25 01:28:23
Can we do this test in |InputMethodControllerTest|
yoichio
2016/11/25 09:19:41
Done.
|
| + WebViewImpl* webView = m_webViewHelper.initializeAndLoad( |
| + "data:text/html, <input id='a' /><br><input type='te' id='b' />"); |
|
Changwan Ryu
2016/11/24 09:23:51
typo: te -> tel
yoichio
2016/11/25 09:19:41
Done.
|
| + webView->settings()->setJavaScriptEnabled(true); |
| + // webView->setInitialFocus(false); |
|
Changwan Ryu
2016/11/24 09:15:00
could you remove this?
yoichio
2016/11/25 09:19:41
Done.
|
| + WebLocalFrameImpl* frame = webView->mainFrameImpl(); |
| + |
| + WebInputMethodController* inputMethodController = |
| + frame->frameWidget()->getActiveWebInputMethodController(); |
| + |
| + EXPECT_EQ(WebTextInputTypeNone, webView->textInputType()); |
| + // Focus element 'a'. |
| + frame->executeScript( |
| + WebScriptSource("document.getElementById('a').focus();")); |
| + EXPECT_EQ(WebTextInputTypeText, webView->textInputType()); |
| + |
| + // The test requires non-empty composition. |
| + std::string compositionText("hello"); |
| + WebVector<WebCompositionUnderline> emptyUnderlines; |
| + inputMethodController->setComposition("hello", emptyUnderlines, 5, 5); |
| + EXPECT_EQ(WebTextInputTypeText, webView->textInputType()); |
| + |
| + // Remove element 'a'. |
| + frame->executeScript( |
| + WebScriptSource("document.getElementById('a').outerHTML = '';")); |
| + EXPECT_EQ(WebTextInputTypeNone, webView->textInputType()); |
| + |
| + frame->executeScript( |
| + WebScriptSource("document.getElementById('b').focus();")); |
| + // TODO: EXPECT_EQ(WebTextInputTypeTelephone, webView->textInputType()); |
|
Changwan Ryu
2016/11/24 09:15:00
Hmm... Does it still not fix crbug.com/664317?
I
Changwan Ryu
2016/11/24 09:34:38
If the test passes after typo is fixed, then this
yoichio
2016/11/25 09:19:41
Done.
|
| + |
| + inputMethodController->finishComposingText( |
| + WebInputMethodController::KeepSelection); |
| + // TODO: EXPECT_EQ(WebTextInputTypeTelephone, webView->textInputType()); |
| +} |
| + |
| } // namespace blink |