| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/layout/LayoutTestHelper.h" | 5 #include "core/layout/LayoutTestHelper.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameHost.h" | 7 #include "core/frame/FrameHost.h" |
| 8 #include "core/html/HTMLIFrameElement.h" | 8 #include "core/html/HTMLIFrameElement.h" |
| 9 #include "core/loader/FrameLoaderStateMachine.h" |
| 9 #include "platform/graphics/test/FakeGraphicsLayerFactory.h" | 10 #include "platform/graphics/test/FakeGraphicsLayerFactory.h" |
| 10 #include "platform/scroll/ScrollbarTheme.h" | 11 #include "platform/scroll/ScrollbarTheme.h" |
| 11 | 12 |
| 12 namespace blink { | 13 namespace blink { |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 class FakeChromeClient : public EmptyChromeClient { | 17 class FakeChromeClient : public EmptyChromeClient { |
| 17 public: | 18 public: |
| 18 static PassOwnPtrWillBeRawPtr<FakeChromeClient> create() { return adoptPtrWi
llBeNoop(new FakeChromeClient); } | 19 static PassOwnPtrWillBeRawPtr<FakeChromeClient> create() { return adoptPtrWi
llBeNoop(new FakeChromeClient); } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 } | 55 } |
| 55 | 56 |
| 56 // We need to destroy most of the Blink structure here because derived tests
may restore | 57 // We need to destroy most of the Blink structure here because derived tests
may restore |
| 57 // RuntimeEnabledFeatures setting during teardown, which happens before our
destructor | 58 // RuntimeEnabledFeatures setting during teardown, which happens before our
destructor |
| 58 // getting invoked, breaking the assumption that REF can't change during Bli
nk lifetime. | 59 // getting invoked, breaking the assumption that REF can't change during Bli
nk lifetime. |
| 59 m_pageHolder = nullptr; | 60 m_pageHolder = nullptr; |
| 60 } | 61 } |
| 61 | 62 |
| 62 Document& RenderingTest::setupChildIframe(const AtomicString& iframeElementId, c
onst String& htmlContentOfIframe) | 63 Document& RenderingTest::setupChildIframe(const AtomicString& iframeElementId, c
onst String& htmlContentOfIframe) |
| 63 { | 64 { |
| 64 | |
| 65 HTMLIFrameElement& iframe = *toHTMLIFrameElement(document().getElementById(i
frameElementId)); | 65 HTMLIFrameElement& iframe = *toHTMLIFrameElement(document().getElementById(i
frameElementId)); |
| 66 m_childFrameLoaderClient = FrameLoaderClientWithParent::create(document().fr
ame()); | 66 m_childFrameLoaderClient = FrameLoaderClientWithParent::create(document().fr
ame()); |
| 67 m_subframe = LocalFrame::create(m_childFrameLoaderClient.get(), document().f
rame()->host(), &iframe); | 67 m_subframe = LocalFrame::create(m_childFrameLoaderClient.get(), document().f
rame()->host(), &iframe); |
| 68 m_subframe->setView(FrameView::create(m_subframe.get(), IntSize(500, 500))); | 68 m_subframe->setView(FrameView::create(m_subframe.get(), IntSize(500, 500))); |
| 69 m_subframe->init(); | 69 m_subframe->init(); |
| 70 // Some tests directly inject content into the initial empty document. |
| 71 // Unmark it so that unforced layout would also run on the document. |
| 72 m_subframe->loader().stateMachine()->advanceTo(FrameLoaderStateMachine::Comm
ittedFirstRealLoad); |
| 70 m_subframe->view()->setParentVisible(true); | 73 m_subframe->view()->setParentVisible(true); |
| 71 m_subframe->view()->setSelfVisible(true); | 74 m_subframe->view()->setSelfVisible(true); |
| 72 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se
tChild(m_subframe.get()); | 75 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se
tChild(m_subframe.get()); |
| 73 document().frame()->host()->incrementSubframeCount(); | 76 document().frame()->host()->incrementSubframeCount(); |
| 74 Document& frameDocument = *iframe.contentDocument(); | 77 Document& frameDocument = *iframe.contentDocument(); |
| 75 | 78 |
| 76 frameDocument.setBaseURLOverride(KURL(ParsedURLString, "http://test.com")); | 79 frameDocument.setBaseURLOverride(KURL(ParsedURLString, "http://test.com")); |
| 77 frameDocument.body()->setInnerHTML(htmlContentOfIframe, ASSERT_NO_EXCEPTION)
; | 80 frameDocument.body()->setInnerHTML(htmlContentOfIframe, ASSERT_NO_EXCEPTION)
; |
| 78 return frameDocument; | 81 return frameDocument; |
| 79 } | 82 } |
| 80 | 83 |
| 81 } // namespace blink | 84 } // namespace blink |
| OLD | NEW |