OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/dom/Document.h" | 5 #include "core/dom/Document.h" |
6 #include "core/dom/Element.h" | 6 #include "core/dom/Element.h" |
7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
8 #include "core/html/HTMLIFrameElement.h" | 8 #include "core/html/HTMLIFrameElement.h" |
9 #include "platform/testing/URLTestHelpers.h" | 9 #include "platform/testing/URLTestHelpers.h" |
10 #include "platform/testing/UnitTestHelpers.h" | 10 #include "platform/testing/UnitTestHelpers.h" |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 FrameTestHelpers::TestWebViewClient viewClient; | 315 FrameTestHelpers::TestWebViewClient viewClient; |
316 WebViewImpl* webView = WebViewImpl::create(&viewClient); | 316 WebViewImpl* webView = WebViewImpl::create(&viewClient); |
317 webView->resize(WebSize(640, 480)); | 317 webView->resize(WebSize(640, 480)); |
318 | 318 |
319 // Create a remote root frame with a local child frame. | 319 // Create a remote root frame with a local child frame. |
320 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 320 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
321 webView->setMainFrame(remoteClient.frame()); | 321 webView->setMainFrame(remoteClient.frame()); |
322 remoteClient.frame()->setReplicatedOrigin(WebSecurityOrigin::createUnique())
; | 322 remoteClient.frame()->setReplicatedOrigin(WebSecurityOrigin::createUnique())
; |
323 | 323 |
324 WebFrameOwnerProperties properties; | 324 WebFrameOwnerProperties properties; |
325 FrameTestHelpers::TestWebFrameClient localFrameClient; | |
326 WebRemoteFrame* rootFrame = webView->mainFrame()->toWebRemoteFrame(); | 325 WebRemoteFrame* rootFrame = webView->mainFrame()->toWebRemoteFrame(); |
327 WebLocalFrame* localFrame = rootFrame->createLocalChild(WebTreeScopeType::Do
cument, "", WebSandboxFlags::None, &localFrameClient, nullptr, properties); | 326 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(rootFrame); |
328 | 327 |
329 WebString baseURL("http://internal.test/"); | 328 WebString baseURL("http://internal.test/"); |
330 URLTestHelpers::registerMockedURLFromBaseURL(baseURL, "simple_div.html"); | 329 URLTestHelpers::registerMockedURLFromBaseURL(baseURL, "simple_div.html"); |
331 FrameTestHelpers::loadFrame(localFrame, baseURL.utf8() + "simple_div.html"); | 330 FrameTestHelpers::loadFrame(localFrame, baseURL.utf8() + "simple_div.html"); |
332 | 331 |
333 FrameView* frameView = toWebLocalFrameImpl(localFrame)->frameView(); | 332 FrameView* frameView = toWebLocalFrameImpl(localFrame)->frameView(); |
334 EXPECT_TRUE(frameView->frame().isLocalRoot()); | 333 EXPECT_TRUE(frameView->frame().isLocalRoot()); |
335 | 334 |
336 // Enable throttling for the child frame. | 335 // Enable throttling for the child frame. |
337 frameView->setFrameRect(IntRect(0, 480, frameView->width(), frameView->heigh
t())); | 336 frameView->setFrameRect(IntRect(0, 480, frameView->width(), frameView->heigh
t())); |
(...skipping 13 matching lines...) Expand all Loading... |
351 // Update the lifecycle again. The frame's lifecycle should not advance | 350 // Update the lifecycle again. The frame's lifecycle should not advance |
352 // because of throttling even though it is the local root. | 351 // because of throttling even though it is the local root. |
353 DocumentLifecycle::AllowThrottlingScope throttlingScope(frameDocument->lifec
ycle()); | 352 DocumentLifecycle::AllowThrottlingScope throttlingScope(frameDocument->lifec
ycle()); |
354 frameView->updateAllLifecyclePhases(); | 353 frameView->updateAllLifecyclePhases(); |
355 testing::runPendingTasks(); | 354 testing::runPendingTasks(); |
356 EXPECT_EQ(DocumentLifecycle::VisualUpdatePending, frameDocument->lifecycle()
.state()); | 355 EXPECT_EQ(DocumentLifecycle::VisualUpdatePending, frameDocument->lifecycle()
.state()); |
357 webView->close(); | 356 webView->close(); |
358 } | 357 } |
359 | 358 |
360 } // namespace blink | 359 } // namespace blink |
OLD | NEW |