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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2611753003: Rename blink::Page's load deferral to suspension (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 #include "core/layout/HitTestResult.h" 67 #include "core/layout/HitTestResult.h"
68 #include "core/layout/LayoutFullScreen.h" 68 #include "core/layout/LayoutFullScreen.h"
69 #include "core/layout/api/LayoutViewItem.h" 69 #include "core/layout/api/LayoutViewItem.h"
70 #include "core/layout/compositing/PaintLayerCompositor.h" 70 #include "core/layout/compositing/PaintLayerCompositor.h"
71 #include "core/loader/DocumentLoader.h" 71 #include "core/loader/DocumentLoader.h"
72 #include "core/loader/DocumentThreadableLoader.h" 72 #include "core/loader/DocumentThreadableLoader.h"
73 #include "core/loader/DocumentThreadableLoaderClient.h" 73 #include "core/loader/DocumentThreadableLoaderClient.h"
74 #include "core/loader/FrameLoadRequest.h" 74 #include "core/loader/FrameLoadRequest.h"
75 #include "core/loader/ThreadableLoader.h" 75 #include "core/loader/ThreadableLoader.h"
76 #include "core/page/Page.h" 76 #include "core/page/Page.h"
77 #include "core/page/ScopedPageLoadDeferrer.h" 77 #include "core/page/ScopedPageSuspender.h"
78 #include "core/paint/PaintLayer.h" 78 #include "core/paint/PaintLayer.h"
79 #include "core/testing/NullExecutionContext.h" 79 #include "core/testing/NullExecutionContext.h"
80 #include "modules/mediastream/MediaStream.h" 80 #include "modules/mediastream/MediaStream.h"
81 #include "modules/mediastream/MediaStreamRegistry.h" 81 #include "modules/mediastream/MediaStreamRegistry.h"
82 #include "platform/Cursor.h" 82 #include "platform/Cursor.h"
83 #include "platform/DragImage.h" 83 #include "platform/DragImage.h"
84 #include "platform/PlatformMouseEvent.h" 84 #include "platform/PlatformMouseEvent.h"
85 #include "platform/PlatformResourceLoader.h" 85 #include "platform/PlatformResourceLoader.h"
86 #include "platform/RuntimeEnabledFeatures.h" 86 #include "platform/RuntimeEnabledFeatures.h"
87 #include "platform/UserGestureIndicator.h" 87 #include "platform/UserGestureIndicator.h"
(...skipping 9358 matching lines...) Expand 10 before | Expand all | Expand 10 after
9446 // Load a page with a child frame in the new root to make sure this doesn't 9446 // Load a page with a child frame in the new root to make sure this doesn't
9447 // crash when the child frame invokes setCoreFrame. 9447 // crash when the child frame invokes setCoreFrame.
9448 registerMockedHttpURLLoad("single_iframe.html"); 9448 registerMockedHttpURLLoad("single_iframe.html");
9449 registerMockedHttpURLLoad("visible_iframe.html"); 9449 registerMockedHttpURLLoad("visible_iframe.html");
9450 FrameTestHelpers::loadFrame(localRoot, m_baseURL + "single_iframe.html"); 9450 FrameTestHelpers::loadFrame(localRoot, m_baseURL + "single_iframe.html");
9451 9451
9452 view->close(); 9452 view->close();
9453 } 9453 }
9454 9454
9455 // See https://crbug.com/628942. 9455 // See https://crbug.com/628942.
9456 TEST_P(ParameterizedWebFrameTest, DeferredPageLoadWithRemoteMainFrame) { 9456 TEST_P(ParameterizedWebFrameTest, SuspendedPageLoadWithRemoteMainFrame) {
9457 // Prepare a page with a remote main frame. 9457 // Prepare a page with a remote main frame.
9458 FrameTestHelpers::TestWebViewClient viewClient; 9458 FrameTestHelpers::TestWebViewClient viewClient;
9459 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; 9459 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
9460 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible); 9460 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible);
9461 view->setMainFrame(remoteClient.frame()); 9461 view->setMainFrame(remoteClient.frame());
9462 WebRemoteFrame* remoteRoot = view->mainFrame()->toWebRemoteFrame(); 9462 WebRemoteFrame* remoteRoot = view->mainFrame()->toWebRemoteFrame();
9463 remoteRoot->setReplicatedOrigin(SecurityOrigin::createUnique()); 9463 remoteRoot->setReplicatedOrigin(SecurityOrigin::createUnique());
9464 9464
9465 // Check that ScopedPageLoadDeferrer properly triggers deferred loading for 9465 // Check that ScopedPageSuspender properly triggers deferred loading for
9466 // the current Page. 9466 // the current Page.
9467 Page* page = remoteRoot->toImplBase()->frame()->page(); 9467 Page* page = remoteRoot->toImplBase()->frame()->page();
9468 EXPECT_FALSE(page->defersLoading()); 9468 EXPECT_FALSE(page->suspended());
9469 { 9469 {
9470 ScopedPageLoadDeferrer deferrer; 9470 ScopedPageSuspender suspender;
9471 EXPECT_TRUE(page->defersLoading()); 9471 EXPECT_TRUE(page->suspended());
9472 } 9472 }
9473 EXPECT_FALSE(page->defersLoading()); 9473 EXPECT_FALSE(page->suspended());
9474 9474
9475 // Repeat this for a page with a local child frame, and ensure that the 9475 // Repeat this for a page with a local child frame, and ensure that the
9476 // child frame's loads are also deferred. 9476 // child frame's loads are also suspended.
9477 WebLocalFrame* webLocalChild = FrameTestHelpers::createLocalChild(remoteRoot); 9477 WebLocalFrame* webLocalChild = FrameTestHelpers::createLocalChild(remoteRoot);
9478 registerMockedHttpURLLoad("foo.html"); 9478 registerMockedHttpURLLoad("foo.html");
9479 FrameTestHelpers::loadFrame(webLocalChild, m_baseURL + "foo.html"); 9479 FrameTestHelpers::loadFrame(webLocalChild, m_baseURL + "foo.html");
9480 LocalFrame* localChild = toWebLocalFrameImpl(webLocalChild)->frame(); 9480 LocalFrame* localChild = toWebLocalFrameImpl(webLocalChild)->frame();
9481 EXPECT_FALSE(page->defersLoading()); 9481 EXPECT_FALSE(page->suspended());
9482 EXPECT_FALSE(localChild->document()->fetcher()->defersLoading()); 9482 EXPECT_FALSE(localChild->document()->fetcher()->defersLoading());
9483 { 9483 {
9484 ScopedPageLoadDeferrer deferrer; 9484 ScopedPageSuspender suspender;
9485 EXPECT_TRUE(page->defersLoading()); 9485 EXPECT_TRUE(page->suspended());
9486 EXPECT_TRUE(localChild->document()->fetcher()->defersLoading()); 9486 EXPECT_TRUE(localChild->document()->fetcher()->defersLoading());
9487 } 9487 }
9488 EXPECT_FALSE(page->defersLoading()); 9488 EXPECT_FALSE(page->suspended());
9489 EXPECT_FALSE(localChild->document()->fetcher()->defersLoading()); 9489 EXPECT_FALSE(localChild->document()->fetcher()->defersLoading());
9490 9490
9491 view->close(); 9491 view->close();
9492 } 9492 }
9493 9493
9494 class OverscrollWebViewClient : public FrameTestHelpers::TestWebViewClient { 9494 class OverscrollWebViewClient : public FrameTestHelpers::TestWebViewClient {
9495 public: 9495 public:
9496 MOCK_METHOD4(didOverscroll, 9496 MOCK_METHOD4(didOverscroll,
9497 void(const WebFloatSize&, 9497 void(const WebFloatSize&,
9498 const WebFloatSize&, 9498 const WebFloatSize&,
(...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after
10774 Frame* mainFrame = webViewHelper.webView()->mainFrameImpl()->frame(); 10774 Frame* mainFrame = webViewHelper.webView()->mainFrameImpl()->frame();
10775 HashSet<AtomicString> names; 10775 HashSet<AtomicString> names;
10776 for (Frame* frame = mainFrame->tree().firstChild(); frame; 10776 for (Frame* frame = mainFrame->tree().firstChild(); frame;
10777 frame = frame->tree().traverseNext()) { 10777 frame = frame->tree().traverseNext()) {
10778 EXPECT_TRUE(names.add(frame->tree().uniqueName()).isNewEntry); 10778 EXPECT_TRUE(names.add(frame->tree().uniqueName()).isNewEntry);
10779 } 10779 }
10780 EXPECT_EQ(10u, names.size()); 10780 EXPECT_EQ(10u, names.size());
10781 } 10781 }
10782 10782
10783 } // namespace blink 10783 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/ChromeClientImplTest.cpp ('k') | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698