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 "platform/loader/fetch/MemoryCache.h" | 9 #include "platform/loader/fetch/MemoryCache.h" |
10 #include "platform/scroll/ScrollbarTheme.h" | 10 #include "platform/scroll/ScrollbarTheme.h" |
(...skipping 14 matching lines...) Expand all Loading... |
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 { | 34 ChromeClient& RenderingTest::chromeClient() const { |
35 DEFINE_STATIC_LOCAL(EmptyChromeClient, client, (EmptyChromeClient::create())); | 35 // |ChromeClient| contains a weak reference to a |Node| (which derives |
| 36 // from |ScriptWrappable|). That reference is only used for unit testing |
| 37 // purposes and will not accidentally leak between contexts. Consequently, |
| 38 // disable the singleton verification check. |
| 39 DEFINE_STATIC_LOCAL(EmptyChromeClient, client, (EmptyChromeClient::create()), |
| 40 CheckScriptWrappable::No); |
36 return client; | 41 return client; |
37 } | 42 } |
38 | 43 |
39 RenderingTest::RenderingTest(FrameLoaderClient* frameLoaderClient) | 44 RenderingTest::RenderingTest(FrameLoaderClient* frameLoaderClient) |
40 : m_frameLoaderClient(frameLoaderClient) {} | 45 : m_frameLoaderClient(frameLoaderClient) {} |
41 | 46 |
42 void RenderingTest::SetUp() { | 47 void RenderingTest::SetUp() { |
43 Page::PageClients pageClients; | 48 Page::PageClients pageClients; |
44 fillWithEmptyClients(pageClients); | 49 fillWithEmptyClients(pageClients); |
45 pageClients.chromeClient = &chromeClient(); | 50 pageClients.chromeClient = &chromeClient(); |
(...skipping 19 matching lines...) Expand all Loading... |
65 // Clear memory cache, otherwise we can leak pruned resources. | 70 // Clear memory cache, otherwise we can leak pruned resources. |
66 memoryCache()->evictResources(); | 71 memoryCache()->evictResources(); |
67 } | 72 } |
68 | 73 |
69 void RenderingTest::setChildFrameHTML(const String& html) { | 74 void RenderingTest::setChildFrameHTML(const String& html) { |
70 childDocument().setBaseURLOverride(KURL(ParsedURLString, "http://test.com")); | 75 childDocument().setBaseURLOverride(KURL(ParsedURLString, "http://test.com")); |
71 childDocument().body()->setInnerHTML(html, ASSERT_NO_EXCEPTION); | 76 childDocument().body()->setInnerHTML(html, ASSERT_NO_EXCEPTION); |
72 } | 77 } |
73 | 78 |
74 } // namespace blink | 79 } // namespace blink |
OLD | NEW |