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

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

Issue 1740173003: TextIteratorAlgorithm should not force layout update in constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed my WIP comment. Created 4 years, 10 months 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
Index: third_party/WebKit/Source/web/tests/WebFrameTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index 6626bf2b959e4cd2a92ec7da49f01e2dafbba6b3..3754e478f4dc16b40d92b4b83df5e69ed33294ac 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -325,6 +325,7 @@ TEST_P(ParameterizedWebFrameTest, ContentText)
webViewHelper.initializeAndLoad(m_baseURL + "iframes_test.html");
// Now retrieve the frames text and test it only includes visible elements.
+ webViewHelper.webView()->updateAllLifecyclePhases();
std::string content = WebFrameContentDumper::dumpFrameTreeAsText(webViewHelper.webView()->mainFrame()->toWebLocalFrame(), 1024).utf8();
EXPECT_NE(std::string::npos, content.find(" visible paragraph"));
EXPECT_NE(std::string::npos, content.find(" visible iframe"));
@@ -498,6 +499,8 @@ TEST_P(ParameterizedWebFrameTest, LocationSetHostWithMissingPort)
FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), "javascript:document.body.textContent = location.href; void 0;");
+ webViewHelper.webView()->updateAllLifecyclePhases();
+
std::string content = WebFrameContentDumper::dumpFrameTreeAsText(webViewHelper.webView()->mainFrame()->toWebLocalFrame(), 1024).utf8();
EXPECT_EQ("http://internal.test:0/" + fileName, content);
}
@@ -517,6 +520,8 @@ TEST_P(ParameterizedWebFrameTest, LocationSetEmptyPort)
FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), "javascript:document.body.textContent = location.href; void 0;");
+ webViewHelper.webView()->updateAllLifecyclePhases();
+
std::string content = WebFrameContentDumper::dumpFrameTreeAsText(webViewHelper.webView()->mainFrame()->toWebLocalFrame(), 1024).utf8();
EXPECT_EQ("http://internal.test:0/" + fileName, content);
}
@@ -1035,7 +1040,7 @@ TEST_P(ParameterizedWebFrameTest, DeviceScaleFactorUsesDefaultWithoutViewportTag
EXPECT_EQ(1, webViewHelper.webView()->pageScaleFactor());
// Force the layout to happen before leaving the test.
- WebFrameContentDumper::dumpFrameTreeAsText(webViewHelper.webView()->mainFrame()->toWebLocalFrame(), 1024).utf8();
+ webViewHelper.webView()->updateAllLifecyclePhases();
}
TEST_P(ParameterizedWebFrameTest, FixedLayoutInitializeAtMinimumScale)
@@ -3609,6 +3614,7 @@ TEST_P(ParameterizedWebFrameTest, GetContentAsPlainText)
// Make sure it comes out OK.
const std::string expected("Foo bar\nbaz");
+ webViewHelper.webView()->updateAllLifecyclePhases();
WebString text = WebFrameContentDumper::dumpFrameTreeAsText(frame->toWebLocalFrame(), std::numeric_limits<size_t>::max());
EXPECT_EQ(expected, text.utf8());
@@ -3626,6 +3632,7 @@ TEST_P(ParameterizedWebFrameTest, GetContentAsPlainText)
ASSERT_TRUE(subframe);
FrameTestHelpers::loadHTMLString(subframe, "sub<p>text", testURL);
+ webViewHelper.webView()->updateAllLifecyclePhases();
text = WebFrameContentDumper::dumpFrameTreeAsText(frame->toWebLocalFrame(), std::numeric_limits<size_t>::max());
EXPECT_EQ("Hello world\n\nsub\ntext", text.utf8());
@@ -3646,6 +3653,8 @@ TEST_P(ParameterizedWebFrameTest, GetFullHtmlOfPage)
KURL testURL = toKURL("about:blank");
FrameTestHelpers::loadHTMLString(frame, simpleSource, testURL);
+ webViewHelper.webView()->updateAllLifecyclePhases();
+
WebString text = WebFrameContentDumper::dumpFrameTreeAsText(frame->toWebLocalFrame(), std::numeric_limits<size_t>::max());
EXPECT_EQ("Hello\n\nWorld", text.utf8());
@@ -3656,6 +3665,8 @@ TEST_P(ParameterizedWebFrameTest, GetFullHtmlOfPage)
EXPECT_EQ(html, WebFrameContentDumper::dumpAsMarkup(frame->toWebLocalFrame()).utf8());
+ webViewHelper.webView()->updateAllLifecyclePhases();
+
text = WebFrameContentDumper::dumpFrameTreeAsText(frame->toWebLocalFrame(), std::numeric_limits<size_t>::max());
EXPECT_EQ("Hello\n\nWorld", text.utf8());
@@ -5132,6 +5143,8 @@ TEST_P(ParameterizedWebFrameTest, ReplaceNavigationAfterHistoryNavigation)
Platform::current()->unitTestSupport()->registerMockedErrorURL(URLTestHelpers::toKURL(errorURL), response, error);
FrameTestHelpers::loadHistoryItem(frame, errorHistoryItem, WebHistoryDifferentDocumentLoad, WebURLRequest::UseProtocolCachePolicy);
+ webViewHelper.webView()->updateAllLifecyclePhases();
+
WebString text = WebFrameContentDumper::dumpFrameTreeAsText(frame->toWebLocalFrame(), std::numeric_limits<size_t>::max());
EXPECT_EQ("This should appear", text.utf8());
EXPECT_TRUE(webFrameClient.commitCalled());
@@ -5245,6 +5258,8 @@ TEST_P(ParameterizedWebFrameTest, ReplaceMisspelledRange)
EXPECT_EQ(1U, document->markers().markersInRange(selectionRange, DocumentMarker::Spelling).size());
frame->replaceMisspelledRange("welcome");
+
+ webViewHelper.webView()->updateAllLifecyclePhases();
EXPECT_EQ("_welcome_.", WebFrameContentDumper::dumpFrameTreeAsText(frame, std::numeric_limits<size_t>::max()).utf8());
}
@@ -7059,6 +7074,7 @@ TEST_F(WebFrameSwapTest, SwapMainFrame)
// Finally, make sure an embedder triggered load in the local frame swapped
// back in works.
FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html");
+
std::string content = WebFrameContentDumper::dumpFrameTreeAsText(localFrame, 1024).utf8();
EXPECT_EQ("hello", content);

Powered by Google App Engine
This is Rietveld 408576698