| 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 13 matching lines...) Expand all Loading... |
| 24 m_child->init(); | 24 m_child->init(); |
| 25 | 25 |
| 26 return m_child.get(); | 26 return m_child.get(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void FrameLoaderClientWithParent::detached(FrameDetachType) { | 29 void FrameLoaderClientWithParent::detached(FrameDetachType) { |
| 30 static_cast<SingleChildFrameLoaderClient*>(parent()->client()) | 30 static_cast<SingleChildFrameLoaderClient*>(parent()->client()) |
| 31 ->didDetachChild(); | 31 ->didDetachChild(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 ChromeClient& RenderingTest::chromeClient() const { |
| 35 DEFINE_STATIC_LOCAL(EmptyChromeClient, client, (EmptyChromeClient::create())); |
| 36 return client; |
| 37 } |
| 38 |
| 34 RenderingTest::RenderingTest(FrameLoaderClient* frameLoaderClient) | 39 RenderingTest::RenderingTest(FrameLoaderClient* frameLoaderClient) |
| 35 : m_frameLoaderClient(frameLoaderClient) {} | 40 : m_frameLoaderClient(frameLoaderClient) {} |
| 36 | 41 |
| 37 void RenderingTest::SetUp() { | 42 void RenderingTest::SetUp() { |
| 38 Page::PageClients pageClients; | 43 Page::PageClients pageClients; |
| 39 fillWithEmptyClients(pageClients); | 44 fillWithEmptyClients(pageClients); |
| 40 DEFINE_STATIC_LOCAL(EmptyChromeClient, chromeClient, | 45 pageClients.chromeClient = &chromeClient(); |
| 41 (EmptyChromeClient::create())); | |
| 42 pageClients.chromeClient = &chromeClient; | |
| 43 m_pageHolder = DummyPageHolder::create( | 46 m_pageHolder = DummyPageHolder::create( |
| 44 IntSize(800, 600), &pageClients, m_frameLoaderClient, settingOverrider()); | 47 IntSize(800, 600), &pageClients, m_frameLoaderClient, settingOverrider()); |
| 45 | 48 |
| 46 Settings::setMockScrollbarsEnabled(true); | 49 Settings::setMockScrollbarsEnabled(true); |
| 47 RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(true); | 50 RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(true); |
| 48 EXPECT_TRUE(ScrollbarTheme::theme().usesOverlayScrollbars()); | 51 EXPECT_TRUE(ScrollbarTheme::theme().usesOverlayScrollbars()); |
| 49 | 52 |
| 50 // This ensures that the minimal DOM tree gets attached | 53 // This ensures that the minimal DOM tree gets attached |
| 51 // correctly for tests that don't call setBodyInnerHTML. | 54 // correctly for tests that don't call setBodyInnerHTML. |
| 52 document().view()->updateAllLifecyclePhases(); | 55 document().view()->updateAllLifecyclePhases(); |
| 53 } | 56 } |
| 54 | 57 |
| 55 void RenderingTest::TearDown() { | 58 void RenderingTest::TearDown() { |
| 56 // We need to destroy most of the Blink structure here because derived tests | 59 // We need to destroy most of the Blink structure here because derived tests |
| 57 // may restore RuntimeEnabledFeatures setting during teardown, which happens | 60 // may restore RuntimeEnabledFeatures setting during teardown, which happens |
| 58 // before our destructor getting invoked, breaking the assumption that REF | 61 // before our destructor getting invoked, breaking the assumption that REF |
| 59 // can't change during Blink lifetime. | 62 // can't change during Blink lifetime. |
| 60 m_pageHolder = nullptr; | 63 m_pageHolder = nullptr; |
| 61 | 64 |
| 62 // Clear memory cache, otherwise we can leak pruned resources. | 65 // Clear memory cache, otherwise we can leak pruned resources. |
| 63 memoryCache()->evictResources(); | 66 memoryCache()->evictResources(); |
| 64 } | 67 } |
| 65 | 68 |
| 66 void RenderingTest::setChildFrameHTML(const String& html) { | 69 void RenderingTest::setChildFrameHTML(const String& html) { |
| 67 childDocument().setBaseURLOverride(KURL(ParsedURLString, "http://test.com")); | 70 childDocument().setBaseURLOverride(KURL(ParsedURLString, "http://test.com")); |
| 68 childDocument().body()->setInnerHTML(html, ASSERT_NO_EXCEPTION); | 71 childDocument().body()->setInnerHTML(html, ASSERT_NO_EXCEPTION); |
| 69 } | 72 } |
| 70 | 73 |
| 71 } // namespace blink | 74 } // namespace blink |
| OLD | NEW |