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

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

Issue 1302333003: Adds test coverage for 521663 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: moar Created 5 years, 3 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
« no previous file with comments | « no previous file | Source/web/tests/data/frame-a-b-c.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index 4a3f112917626400b361734eda6193e2b88165a5..de6a02718ed84ceb70f1f69e1c535dde4c9aa2cc 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -7022,6 +7022,38 @@ TEST_F(WebFrameSwapTest, SwapMainFrame)
remoteFrame->close();
}
+namespace {
+
+class SwapMainFrameWhenTitleChangesWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
+public:
+ SwapMainFrameWhenTitleChangesWebFrameClient() {}
+ ~SwapMainFrameWhenTitleChangesWebFrameClient() override {}
+
+ void didReceiveTitle(WebLocalFrame* frame, const WebString& title, WebTextDirection direction) override
Nate Chapin 2015/09/04 18:30:47 Style nit: drop the unused variable names.
sky 2015/09/04 18:57:13 Done.
+ {
+ if (!frame->parent())
+ frame->swap(WebRemoteFrame::create(WebTreeScopeType::Document, nullptr));
+ }
+
+private:
Nate Chapin 2015/09/04 18:30:47 Nit: remove this
sky 2015/09/04 18:57:13 Done.
+};
+
+} // anonymous namespace
+
+TEST_F(WebFrameTest, SwapMainFrameWhileLoading)
+{
+ SwapMainFrameWhenTitleChangesWebFrameClient frameClient;
+
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ registerMockedHttpURLLoad("frame-a-b-c.html");
+ registerMockedHttpURLLoad("subframe-a.html");
+ registerMockedHttpURLLoad("subframe-b.html");
+ registerMockedHttpURLLoad("subframe-c.html");
+ registerMockedHttpURLLoad("subframe-hello.html");
+
+ webViewHelper.initializeAndLoad(m_baseURL + "frame-a-b-c.html", true, &frameClient);
+}
+
void swapAndVerifyFirstChildConsistency(const char* const message, WebFrame* parent, WebFrame* newChild)
{
SCOPED_TRACE(message);
« no previous file with comments | « no previous file | Source/web/tests/data/frame-a-b-c.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698