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/fetch/MemoryCache.h" |
8 #include "core/frame/FrameHost.h" | 8 #include "core/frame/FrameHost.h" |
9 #include "core/html/HTMLIFrameElement.h" | 9 #include "core/html/HTMLIFrameElement.h" |
10 #include "platform/scroll/ScrollbarTheme.h" | 10 #include "platform/scroll/ScrollbarTheme.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 | 35 |
36 void RenderingTest::TearDown() { | 36 void RenderingTest::TearDown() { |
37 if (m_subframe) { | 37 if (m_subframe) { |
38 m_subframe->detach(FrameDetachType::Remove); | 38 m_subframe->detach(FrameDetachType::Remove); |
39 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client()) | 39 static_cast<SingleChildFrameLoaderClient*>(document().frame()->client()) |
40 ->setChild(nullptr); | 40 ->setChild(nullptr); |
41 document().frame()->host()->decrementSubframeCount(); | 41 document().frame()->host()->decrementSubframeCount(); |
42 } | 42 } |
43 | 43 |
44 // We need to destroy most of the Blink structure here because derived tests m
ay restore | 44 // We need to destroy most of the Blink structure here because derived tests |
45 // RuntimeEnabledFeatures setting during teardown, which happens before our de
structor | 45 // may restore RuntimeEnabledFeatures setting during teardown, which happens |
46 // getting invoked, breaking the assumption that REF can't change during Blink
lifetime. | 46 // before our destructor getting invoked, breaking the assumption that REF |
| 47 // can't change during Blink lifetime. |
47 m_pageHolder = nullptr; | 48 m_pageHolder = nullptr; |
48 | 49 |
49 // Clear memory cache, otherwise we can leak pruned resources. | 50 // Clear memory cache, otherwise we can leak pruned resources. |
50 memoryCache()->evictResources(); | 51 memoryCache()->evictResources(); |
51 } | 52 } |
52 | 53 |
53 Document& RenderingTest::setupChildIframe(const AtomicString& iframeElementId, | 54 Document& RenderingTest::setupChildIframe(const AtomicString& iframeElementId, |
54 const String& htmlContentOfIframe) { | 55 const String& htmlContentOfIframe) { |
55 // TODO(pdr): This should be refactored to share code with the actual setup | 56 // TODO(pdr): This should be refactored to share code with the actual setup |
56 // instead of partially duplicating it here (e.g., LocalFrame::createView). | 57 // instead of partially duplicating it here (e.g., LocalFrame::createView). |
(...skipping 12 matching lines...) Expand all Loading... |
69 ->setChild(m_subframe.get()); | 70 ->setChild(m_subframe.get()); |
70 document().frame()->host()->incrementSubframeCount(); | 71 document().frame()->host()->incrementSubframeCount(); |
71 Document& frameDocument = *iframe.contentDocument(); | 72 Document& frameDocument = *iframe.contentDocument(); |
72 | 73 |
73 frameDocument.setBaseURLOverride(KURL(ParsedURLString, "http://test.com")); | 74 frameDocument.setBaseURLOverride(KURL(ParsedURLString, "http://test.com")); |
74 frameDocument.body()->setInnerHTML(htmlContentOfIframe, ASSERT_NO_EXCEPTION); | 75 frameDocument.body()->setInnerHTML(htmlContentOfIframe, ASSERT_NO_EXCEPTION); |
75 return frameDocument; | 76 return frameDocument; |
76 } | 77 } |
77 | 78 |
78 } // namespace blink | 79 } // namespace blink |
OLD | NEW |