| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/paint/HTMLCanvasPainter.h" | 5 #include "core/paint/HTMLCanvasPainter.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
| 9 #include "core/html/HTMLCanvasElement.h" | 9 #include "core/html/HTMLCanvasElement.h" |
| 10 #include "core/html/canvas/CanvasContextCreationAttributes.h" | 10 #include "core/html/canvas/CanvasContextCreationAttributes.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 void TearDown() override { m_featuresBackup.restore(); } | 45 void TearDown() override { m_featuresBackup.restore(); } |
| 46 | 46 |
| 47 Document& document() { return m_pageHolder->document(); } | 47 Document& document() { return m_pageHolder->document(); } |
| 48 bool hasLayerAttached(const WebLayer& layer) { | 48 bool hasLayerAttached(const WebLayer& layer) { |
| 49 return m_chromeClient->hasLayer(layer); | 49 return m_chromeClient->hasLayer(layer); |
| 50 } | 50 } |
| 51 | 51 |
| 52 PassRefPtr<Canvas2DLayerBridge> makeCanvas2DLayerBridge(const IntSize& size) { | 52 PassRefPtr<Canvas2DLayerBridge> makeCanvas2DLayerBridge(const IntSize& size) { |
| 53 return adoptRef(new Canvas2DLayerBridge( | 53 return adoptRef(new Canvas2DLayerBridge( |
| 54 wrapUnique(new FakeWebGraphicsContext3DProvider(&m_gl)), size, 0, | 54 wrapUnique(new FakeWebGraphicsContext3DProvider(&m_gl)), size, 0, |
| 55 NonOpaque, Canvas2DLayerBridge::ForceAccelerationForTesting, nullptr)); | 55 NonOpaque, Canvas2DLayerBridge::ForceAccelerationForTesting, nullptr, |
| 56 kN32_SkColorType)); |
| 56 } | 57 } |
| 57 | 58 |
| 58 private: | 59 private: |
| 59 RuntimeEnabledFeatures::Backup m_featuresBackup; | 60 RuntimeEnabledFeatures::Backup m_featuresBackup; |
| 60 Persistent<StubChromeClientForSPv2> m_chromeClient; | 61 Persistent<StubChromeClientForSPv2> m_chromeClient; |
| 61 FakeGLES2Interface m_gl; | 62 FakeGLES2Interface m_gl; |
| 62 std::unique_ptr<DummyPageHolder> m_pageHolder; | 63 std::unique_ptr<DummyPageHolder> m_pageHolder; |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 TEST_F(HTMLCanvasPainterTestForSPv2, Canvas2DLayerAppearsInLayerTree) { | 66 TEST_F(HTMLCanvasPainterTestForSPv2, Canvas2DLayerAppearsInLayerTree) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 84 | 85 |
| 85 // Fetch the layer associated with the <canvas>, and check that it was | 86 // Fetch the layer associated with the <canvas>, and check that it was |
| 86 // correctly configured in the layer tree. | 87 // correctly configured in the layer tree. |
| 87 const WebLayer* layer = context->platformLayer(); | 88 const WebLayer* layer = context->platformLayer(); |
| 88 ASSERT_TRUE(layer); | 89 ASSERT_TRUE(layer); |
| 89 EXPECT_TRUE(hasLayerAttached(*layer)); | 90 EXPECT_TRUE(hasLayerAttached(*layer)); |
| 90 EXPECT_EQ(WebSize(300, 200), layer->bounds()); | 91 EXPECT_EQ(WebSize(300, 200), layer->bounds()); |
| 91 } | 92 } |
| 92 | 93 |
| 93 } // namespace blink | 94 } // namespace blink |
| OLD | NEW |