Index: Source/core/rendering/RenderingTestHelper.cpp |
diff --git a/Source/core/rendering/RenderingTestHelper.cpp b/Source/core/rendering/RenderingTestHelper.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..86b8f6a2c56a6d3db49024489b684e99734ade80 |
--- /dev/null |
+++ b/Source/core/rendering/RenderingTestHelper.cpp |
@@ -0,0 +1,46 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "config.h" |
+#include "core/rendering/RenderingTestHelper.h" |
+ |
+#include "core/loader/EmptyClients.h" |
+#include "platform/graphics/GraphicsLayer.h" |
+#include "platform/graphics/GraphicsLayerFactory.h" |
+ |
+namespace blink { |
+ |
+class FakeGraphicsLayerFactory : public GraphicsLayerFactory { |
+public: |
+ virtual PassOwnPtr<GraphicsLayer> createGraphicsLayer(GraphicsLayerClient* client) override |
+ { |
+ return adoptPtr(new GraphicsLayer(client)); |
+ } |
+}; |
+ |
+class FakeChromeClient : public EmptyChromeClient { |
+public: |
+ virtual GraphicsLayerFactory* graphicsLayerFactory() const |
+ { |
+ static FakeGraphicsLayerFactory* factory = adoptPtr(new FakeGraphicsLayerFactory).leakPtr(); |
+ return factory; |
+ } |
+}; |
+ |
+void RenderingTest::SetUp() |
+{ |
+ fillWithEmptyClients(m_pageClients); |
+ static FakeChromeClient* chromeClient = adoptPtr(new FakeChromeClient).leakPtr(); |
+ m_pageClients.chromeClient = chromeClient; |
+ m_pageHolder = DummyPageHolder::create(IntSize(800, 600), &m_pageClients); |
+ |
+ document().settings()->setRegionBasedColumnsEnabled(true); |
+ |
+ // This ensures that the minimal DOM tree gets attached |
+ // correctly for tests that don't call setBodyInnerHTML. |
+ document().view()->updateLayoutAndStyleIfNeededRecursive(); |
+} |
+ |
+ |
+} // namespace blink |