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/fetch/MemoryCache.h" | |
7 #include "core/frame/FrameHost.h" | 8 #include "core/frame/FrameHost.h" |
8 #include "core/html/HTMLIFrameElement.h" | 9 #include "core/html/HTMLIFrameElement.h" |
9 #include "platform/scroll/ScrollbarTheme.h" | 10 #include "platform/scroll/ScrollbarTheme.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 RenderingTest::RenderingTest(FrameLoaderClient* frameLoaderClient) | 14 RenderingTest::RenderingTest(FrameLoaderClient* frameLoaderClient) |
14 : m_frameLoaderClient(frameLoaderClient) { } | 15 : m_frameLoaderClient(frameLoaderClient) { } |
15 | 16 |
16 void RenderingTest::SetUp() | 17 void RenderingTest::SetUp() |
(...skipping 18 matching lines...) Expand all Loading... | |
35 if (m_subframe) { | 36 if (m_subframe) { |
36 m_subframe->detach(FrameDetachType::Remove); | 37 m_subframe->detach(FrameDetachType::Remove); |
37 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client()) ->setChild(nullptr); | 38 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client()) ->setChild(nullptr); |
38 document().frame()->host()->decrementSubframeCount(); | 39 document().frame()->host()->decrementSubframeCount(); |
39 } | 40 } |
40 | 41 |
41 // We need to destroy most of the Blink structure here because derived tests may restore | 42 // We need to destroy most of the Blink structure here because derived tests may restore |
42 // RuntimeEnabledFeatures setting during teardown, which happens before our destructor | 43 // RuntimeEnabledFeatures setting during teardown, which happens before our destructor |
43 // getting invoked, breaking the assumption that REF can't change during Bli nk lifetime. | 44 // getting invoked, breaking the assumption that REF can't change during Bli nk lifetime. |
44 m_pageHolder = nullptr; | 45 m_pageHolder = nullptr; |
46 | |
47 // Clear memory cache, otherwise we can leak pruned resources. | |
48 memoryCache()->evictResources(); | |
haraken
2016/08/26 00:58:49
Just help me understand: What's a difference betwe
| |
45 } | 49 } |
46 | 50 |
47 Document& RenderingTest::setupChildIframe(const AtomicString& iframeElementId, c onst String& htmlContentOfIframe) | 51 Document& RenderingTest::setupChildIframe(const AtomicString& iframeElementId, c onst String& htmlContentOfIframe) |
48 { | 52 { |
49 // TODO(pdr): This should be refactored to share code with the actual setup | 53 // TODO(pdr): This should be refactored to share code with the actual setup |
50 // instead of partially duplicating it here (e.g., LocalFrame::createView). | 54 // instead of partially duplicating it here (e.g., LocalFrame::createView). |
51 HTMLIFrameElement& iframe = *toHTMLIFrameElement(document().getElementById(i frameElementId)); | 55 HTMLIFrameElement& iframe = *toHTMLIFrameElement(document().getElementById(i frameElementId)); |
52 m_childFrameLoaderClient = FrameLoaderClientWithParent::create(document().fr ame()); | 56 m_childFrameLoaderClient = FrameLoaderClientWithParent::create(document().fr ame()); |
53 m_subframe = LocalFrame::create(m_childFrameLoaderClient.get(), document().f rame()->host(), &iframe); | 57 m_subframe = LocalFrame::create(m_childFrameLoaderClient.get(), document().f rame()->host(), &iframe); |
54 m_subframe->setView(FrameView::create(m_subframe.get(), IntSize(500, 500))); | 58 m_subframe->setView(FrameView::create(m_subframe.get(), IntSize(500, 500))); |
55 m_subframe->init(); | 59 m_subframe->init(); |
56 m_subframe->view()->setParentVisible(true); | 60 m_subframe->view()->setParentVisible(true); |
57 m_subframe->view()->setSelfVisible(true); | 61 m_subframe->view()->setSelfVisible(true); |
58 iframe.setWidget(m_subframe->view()); | 62 iframe.setWidget(m_subframe->view()); |
59 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se tChild(m_subframe.get()); | 63 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client())->se tChild(m_subframe.get()); |
60 document().frame()->host()->incrementSubframeCount(); | 64 document().frame()->host()->incrementSubframeCount(); |
61 Document& frameDocument = *iframe.contentDocument(); | 65 Document& frameDocument = *iframe.contentDocument(); |
62 | 66 |
63 frameDocument.setBaseURLOverride(KURL(ParsedURLString, "http://test.com")); | 67 frameDocument.setBaseURLOverride(KURL(ParsedURLString, "http://test.com")); |
64 frameDocument.body()->setInnerHTML(htmlContentOfIframe, ASSERT_NO_EXCEPTION) ; | 68 frameDocument.body()->setInnerHTML(htmlContentOfIframe, ASSERT_NO_EXCEPTION) ; |
65 return frameDocument; | 69 return frameDocument; |
66 } | 70 } |
67 | 71 |
68 } // namespace blink | 72 } // namespace blink |
OLD | NEW |