| 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 #include "public/platform/WebCompositedDisplayList.h" |
| 11 | 12 |
| 12 namespace blink { | 13 namespace blink { |
| 13 | 14 |
| 14 class FakeGraphicsLayerFactory : public GraphicsLayerFactory { | 15 class FakeGraphicsLayerFactory : public GraphicsLayerFactory { |
| 15 public: | 16 public: |
| 16 PassOwnPtr<GraphicsLayer> createGraphicsLayer(GraphicsLayerClient* client) o
verride | 17 PassOwnPtr<GraphicsLayer> createGraphicsLayer(GraphicsLayerClient* client) o
verride |
| 17 { | 18 { |
| 18 return adoptPtr(new GraphicsLayer(client)); | 19 return adoptPtr(new GraphicsLayer(client)); |
| 19 } | 20 } |
| 20 }; | 21 }; |
| 21 | 22 |
| 22 class FakeChromeClient : public EmptyChromeClient { | 23 class FakeChromeClient : public EmptyChromeClient { |
| 23 public: | 24 public: |
| 24 static PassOwnPtrWillBeRawPtr<FakeChromeClient> create() { return adoptPtrWi
llBeNoop(new FakeChromeClient); } | 25 static PassOwnPtrWillBeRawPtr<FakeChromeClient> create() { return adoptPtrWi
llBeNoop(new FakeChromeClient); } |
| 25 | 26 |
| 26 virtual GraphicsLayerFactory* graphicsLayerFactory() const | 27 virtual GraphicsLayerFactory* graphicsLayerFactory() const |
| 27 { | 28 { |
| 28 static FakeGraphicsLayerFactory* factory = adoptPtr(new FakeGraphicsLaye
rFactory).leakPtr(); | 29 static FakeGraphicsLayerFactory* factory = adoptPtr(new FakeGraphicsLaye
rFactory).leakPtr(); |
| 29 return factory; | 30 return factory; |
| 30 } | 31 } |
| 32 |
| 33 void setCompositedDisplayList(PassOwnPtr<CompositedDisplayList> compositedDi
splayList) override |
| 34 { |
| 35 m_compositedDisplayList.assign(compositedDisplayList); |
| 36 } |
| 37 |
| 38 CompositedDisplayList* compositedDisplayListForTesting() override |
| 39 { |
| 40 return m_compositedDisplayList.compositedDisplayListForTesting(); |
| 41 } |
| 42 |
| 43 private: |
| 44 WebCompositedDisplayList m_compositedDisplayList; |
| 31 }; | 45 }; |
| 32 | 46 |
| 33 void RenderingTest::SetUp() | 47 void RenderingTest::SetUp() |
| 34 { | 48 { |
| 35 Page::PageClients pageClients; | 49 Page::PageClients pageClients; |
| 36 fillWithEmptyClients(pageClients); | 50 fillWithEmptyClients(pageClients); |
| 37 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<FakeChromeClient>, chromeClient,
(FakeChromeClient::create())); | 51 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<FakeChromeClient>, chromeClient,
(FakeChromeClient::create())); |
| 38 pageClients.chromeClient = chromeClient.get(); | 52 pageClients.chromeClient = chromeClient.get(); |
| 39 m_pageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients); | 53 m_pageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients); |
| 40 | 54 |
| 41 // This ensures that the minimal DOM tree gets attached | 55 // This ensures that the minimal DOM tree gets attached |
| 42 // correctly for tests that don't call setBodyInnerHTML. | 56 // correctly for tests that don't call setBodyInnerHTML. |
| 43 document().view()->updateAllLifecyclePhases(); | 57 document().view()->updateAllLifecyclePhases(); |
| 44 } | 58 } |
| 45 | 59 |
| 46 | 60 |
| 47 } // namespace blink | 61 } // namespace blink |
| OLD | NEW |