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 c542443721ecc9ea3c9f7e82fa981a181ebd2ffb..2b2b45ea3e00914784f39d40366c2aa56b472661 100644 |
| --- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp |
| +++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp |
| @@ -731,6 +731,35 @@ TEST_F(WebViewTest, TextInputType) |
| testTextInputType(WebTextInputTypeURL, "input_field_url.html"); |
| } |
| +TEST_F(WebViewTest, TextInputInfoUpdateStyleAndLayout) |
| +{ |
| + FrameTestHelpers::TestWebViewClient client; |
| + FrameTestHelpers::WebViewHelper m_webViewHelper; |
| + WebViewImpl* webViewImpl = m_webViewHelper.initialize(true, 0, &client); |
|
esprehn
2016/08/26 05:23:03
I suspect this would be a pretty simple SimTest wi
|
| + |
| + WebURL baseURL = URLTestHelpers::toKURL("http://example.com/"); |
| + // Here, we need to construct a document that has a special property: |
| + // Adding id="foo" to the <path> element will trigger creation of an SVG instance tree |
| + // for the use <use> element. |
| + // This is significant, because SVG instance trees are actually created lazily |
| + // during Document::updateStyleAndLayout code, thus incrementing the DOM tree version |
| + // and freaking out the EphemeralRange (invalidating it). |
| + FrameTestHelpers::loadHTMLString(webViewImpl->mainFrame(), |
| + "<svg height=\"100%\" version=\"1.1\" viewBox=\"0 0 14 14\" width=\"100%\">" |
|
esprehn
2016/08/26 05:23:03
if you use single quotes you can avoid the escapes
|
| + "<use xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"#foo\"></use>" |
| + "<path d=\"M 100 100 L 300 100 L 200 300 z\" fill=\"#000\"></path>" |
| + "</svg>" |
| + "<input>", baseURL); |
| + webViewImpl->setInitialFocus(false); |
| + |
| + // Add id="foo" to <path>, thus triggering the condition described above. |
| + LocalFrame* mainFrameLocal = toLocalFrame(webViewImpl->page()->mainFrame()); |
| + mainFrameLocal->document()->body()->querySelector("path", IGNORE_EXCEPTION)->setIdAttribute("foo"); |
|
esprehn
2016/08/26 05:23:02
don't ignore the exception, ASSERT_NO_EXCEPTION, w
|
| + |
| + // This should not DCHECK. |
| + EXPECT_EQ(WebTextInputTypeText, webViewImpl->textInputInfo().type); |
| +} |
| + |
| void WebViewTest::testInputMode(const WebString& expectedInputMode, const std::string& htmlFile) |
| { |
| URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(htmlFile.c_str())); |