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 "config.h" | 5 #include "config.h" |
6 #include "core/layout/LayoutTestHelper.h" | 6 #include "core/layout/LayoutTestHelper.h" |
7 | 7 |
8 #include "core/loader/EmptyClients.h" | 8 #include "core/loader/EmptyClients.h" |
9 #include "platform/graphics/GraphicsLayer.h" | 9 #include "platform/graphics/GraphicsLayer.h" |
10 #include "platform/graphics/GraphicsLayerFactory.h" | 10 #include "platform/graphics/GraphicsLayerFactory.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class FakeGraphicsLayerFactory : public GraphicsLayerFactory { | 14 class FakeGraphicsLayerFactory : public GraphicsLayerFactory { |
15 public: | 15 public: |
16 PassOwnPtr<GraphicsLayer> createGraphicsLayer(GraphicsLayerClient* client) o
verride | 16 PassOwnPtr<GraphicsLayer> createGraphicsLayer(GraphicsLayerClient* client) o
verride |
17 { | 17 { |
18 return adoptPtr(new GraphicsLayer(client)); | 18 return adoptPtr(new GraphicsLayer(client)); |
19 } | 19 } |
20 }; | 20 }; |
21 | 21 |
22 class FakeChromeClient : public EmptyChromeClient { | 22 class FakeChromeClient : public EmptyChromeClient { |
23 public: | 23 public: |
| 24 static PassOwnPtrWillBeRawPtr<FakeChromeClient> create() { return adoptPtrWi
llBeNoop(new FakeChromeClient); } |
| 25 |
24 virtual GraphicsLayerFactory* graphicsLayerFactory() const | 26 virtual GraphicsLayerFactory* graphicsLayerFactory() const |
25 { | 27 { |
26 static FakeGraphicsLayerFactory* factory = adoptPtr(new FakeGraphicsLaye
rFactory).leakPtr(); | 28 static FakeGraphicsLayerFactory* factory = adoptPtr(new FakeGraphicsLaye
rFactory).leakPtr(); |
27 return factory; | 29 return factory; |
28 } | 30 } |
29 }; | 31 }; |
30 | 32 |
31 void RenderingTest::SetUp() | 33 void RenderingTest::SetUp() |
32 { | 34 { |
33 fillWithEmptyClients(m_pageClients); | 35 fillWithEmptyClients(m_pageClients); |
34 static FakeChromeClient* chromeClient = adoptPtr(new FakeChromeClient).leakP
tr(); | 36 static FakeChromeClient* chromeClient = FakeChromeClient::create().leakPtr()
; |
35 m_pageClients.chromeClient = chromeClient; | 37 m_pageClients.chromeClient = chromeClient; |
36 m_pageHolder = DummyPageHolder::create(IntSize(800, 600), &m_pageClients); | 38 m_pageHolder = DummyPageHolder::create(IntSize(800, 600), &m_pageClients); |
37 | 39 |
38 // This ensures that the minimal DOM tree gets attached | 40 // This ensures that the minimal DOM tree gets attached |
39 // correctly for tests that don't call setBodyInnerHTML. | 41 // correctly for tests that don't call setBodyInnerHTML. |
40 document().view()->updateAllLifecyclePhases(); | 42 document().view()->updateAllLifecyclePhases(); |
41 } | 43 } |
42 | 44 |
43 | 45 |
44 } // namespace blink | 46 } // namespace blink |
OLD | NEW |