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

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

Issue 2155393002: Fix ScopedPageLoadDeferrer to work with pages that have remote main frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a test Created 4 years, 5 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 | « third_party/WebKit/Source/core/page/ScopedPageLoadDeferrer.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/WebFrameTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index 6cf1755d31342f65ff5cc46c1e0e0c02a3bbca4f..5a711e16adb932c761d069ceb8ac8297284042f7 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -73,6 +73,7 @@
#include "core/loader/FrameLoadRequest.h"
#include "core/loader/ThreadableLoader.h"
#include "core/page/Page.h"
+#include "core/page/ScopedPageLoadDeferrer.h"
#include "core/paint/PaintLayer.h"
#include "core/testing/NullExecutionContext.h"
#include "modules/mediastream/MediaStream.h"
@@ -8153,6 +8154,46 @@ TEST_P(ParameterizedWebFrameTest, RemoteToLocalSwapOnMainFrameInitializesCoreFra
view->close();
}
+// See https://crbug.com/628942.
+TEST_P(ParameterizedWebFrameTest, DeferredPageLoadWithRemoteMainFrame)
+{
+ // Prepare a page with a remote main frame.
+ FrameTestHelpers::TestWebViewClient viewClient;
+ FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
+ WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible);
+ view->setMainFrame(remoteClient.frame());
+ WebRemoteFrame* remoteRoot = view->mainFrame()->toWebRemoteFrame();
+ remoteRoot->setReplicatedOrigin(SecurityOrigin::createUnique());
+
+ // Check that ScopedPageLoadDeferrer properly triggers deferred loading for
+ // the current Page.
+ Page* page = remoteRoot->toImplBase()->frame()->page();
+ EXPECT_FALSE(page->defersLoading());
+ {
+ ScopedPageLoadDeferrer deferrer;
+ EXPECT_TRUE(page->defersLoading());
+ }
+ EXPECT_FALSE(page->defersLoading());
+
+ // Repeat this for a page with a local child frame, and ensure that the
+ // child frame's loads are also deferred.
+ WebLocalFrame* webLocalChild = FrameTestHelpers::createLocalChild(remoteRoot);
+ registerMockedHttpURLLoad("foo.html");
+ FrameTestHelpers::loadFrame(webLocalChild, m_baseURL + "foo.html");
+ LocalFrame* localChild = toWebLocalFrameImpl(webLocalChild)->frame();
+ EXPECT_FALSE(page->defersLoading());
+ EXPECT_FALSE(localChild->document()->fetcher()->defersLoading());
+ {
+ ScopedPageLoadDeferrer deferrer;
+ EXPECT_TRUE(page->defersLoading());
+ EXPECT_TRUE(localChild->document()->fetcher()->defersLoading());
+ }
+ EXPECT_FALSE(remoteRoot->toImplBase()->frame()->page()->defersLoading());
dcheng 2016/07/20 02:08:57 Nit: page->defersLoading()?
alexmos 2016/07/20 16:08:32 Done.
+ EXPECT_FALSE(localChild->document()->fetcher()->defersLoading());
+
+ view->close();
+}
+
class OverscrollWebViewClient : public FrameTestHelpers::TestWebViewClient {
public:
MOCK_METHOD4(didOverscroll, void(const WebFloatSize&, const WebFloatSize&, const WebFloatPoint&, const WebFloatSize&));
« no previous file with comments | « third_party/WebKit/Source/core/page/ScopedPageLoadDeferrer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698