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
3 // found in the LICENSE file.
6 #include "core/layout/LayoutTestHelper.h"
8 #include "core/loader/EmptyClients.h"
9 #include "platform/graphics/GraphicsLayer.h"
10 #include "platform/graphics/GraphicsLayerFactory.h"
11 #include "public/platform/WebCompositedDisplayList.h"
15 class FakeGraphicsLayerFactory
: public GraphicsLayerFactory
{
17 PassOwnPtr
<GraphicsLayer
> createGraphicsLayer(GraphicsLayerClient
* client
) override
19 return adoptPtr(new GraphicsLayer(client
));
23 class FakeChromeClient
: public EmptyChromeClient
{
25 static PassOwnPtrWillBeRawPtr
<FakeChromeClient
> create() { return adoptPtrWillBeNoop(new FakeChromeClient
); }
27 virtual GraphicsLayerFactory
* graphicsLayerFactory() const
29 static FakeGraphicsLayerFactory
* factory
= adoptPtr(new FakeGraphicsLayerFactory
).leakPtr();
33 void setCompositedDisplayList(PassOwnPtr
<CompositedDisplayList
> compositedDisplayList
) override
35 m_compositedDisplayList
.assign(compositedDisplayList
);
38 CompositedDisplayList
* compositedDisplayListForTesting() override
40 return m_compositedDisplayList
.compositedDisplayListForTesting();
44 WebCompositedDisplayList m_compositedDisplayList
;
47 void RenderingTest::SetUp()
49 Page::PageClients pageClients
;
50 fillWithEmptyClients(pageClients
);
51 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent
<FakeChromeClient
>, chromeClient
, (FakeChromeClient::create()));
52 pageClients
.chromeClient
= chromeClient
.get();
53 m_pageHolder
= DummyPageHolder::create(IntSize(800, 600), &pageClients
);
55 // This ensures that the minimal DOM tree gets attached
56 // correctly for tests that don't call setBodyInnerHTML.
57 document().view()->updateAllLifecyclePhases();