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 "platform/graphics/CanvasSurfaceLayerBridge.h" | 5 #include "platform/graphics/CanvasSurfaceLayerBridge.h" |
6 | 6 |
7 #include "cc/surfaces/surface_id.h" | 7 #include "cc/surfaces/surface_id.h" |
8 #include "cc/surfaces/surface_sequence.h" | 8 #include "cc/surfaces/surface_sequence.h" |
9 #include "mojo/public/cpp/bindings/binding.h" | 9 #include "mojo/public/cpp/bindings/binding.h" |
10 #include "mojo/public/cpp/bindings/interface_request.h" | 10 #include "mojo/public/cpp/bindings/interface_request.h" |
11 #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom
-blink.h" | 11 #include "public/platform/modules/offscreencanvas/offscreen_canvas_surface.mojom
-blink.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "wtf/PtrUtil.h" | 14 #include "wtf/PtrUtil.h" |
15 #include <memory> | 15 #include <memory> |
16 | 16 |
17 namespace blink { | 17 namespace blink { |
18 | 18 |
19 //----------------------------------------------------------------------------- | 19 //----------------------------------------------------------------------------- |
20 | 20 |
21 class MockOffscreenCanvasSurface final | 21 class MockOffscreenCanvasSurface final |
22 : public mojom::blink::OffscreenCanvasSurface { | 22 : public mojom::blink::OffscreenCanvasSurface { |
23 public: | 23 public: |
24 MockOffscreenCanvasSurface(); | 24 MockOffscreenCanvasSurface(); |
25 ~MockOffscreenCanvasSurface() override; | 25 ~MockOffscreenCanvasSurface() override; |
26 | 26 |
27 mojom::blink::OffscreenCanvasSurfacePtr GetProxy(); | 27 mojom::blink::OffscreenCanvasSurfacePtr GetProxy(); |
28 | 28 |
29 void GetSurfaceId(const GetSurfaceIdCallback&) override; | 29 void GetSurfaceId(uint32_t canvasId, const GetSurfaceIdCallback&) override; |
30 void Require(const cc::SurfaceId&, const cc::SurfaceSequence&) override {} | 30 void Require(const cc::SurfaceId&, const cc::SurfaceSequence&) override {} |
31 void Satisfy(const cc::SurfaceSequence&) override {} | 31 void Satisfy(const cc::SurfaceSequence&) override {} |
32 | 32 |
33 private: | 33 private: |
34 mojo::Binding<mojom::blink::OffscreenCanvasSurface> m_binding; | 34 mojo::Binding<mojom::blink::OffscreenCanvasSurface> m_binding; |
35 cc::SurfaceId m_surfaceId; | 35 cc::SurfaceId m_surfaceId; |
36 }; | 36 }; |
37 | 37 |
38 //----------------------------------------------------------------------------- | 38 //----------------------------------------------------------------------------- |
39 | 39 |
(...skipping 15 matching lines...) Expand all Loading... |
55 | 55 |
56 MockOffscreenCanvasSurface::MockOffscreenCanvasSurface() : m_binding(this) {} | 56 MockOffscreenCanvasSurface::MockOffscreenCanvasSurface() : m_binding(this) {} |
57 | 57 |
58 MockOffscreenCanvasSurface::~MockOffscreenCanvasSurface() {} | 58 MockOffscreenCanvasSurface::~MockOffscreenCanvasSurface() {} |
59 | 59 |
60 mojom::blink::OffscreenCanvasSurfacePtr MockOffscreenCanvasSurface::GetProxy() { | 60 mojom::blink::OffscreenCanvasSurfacePtr MockOffscreenCanvasSurface::GetProxy() { |
61 return m_binding.CreateInterfacePtrAndBind(); | 61 return m_binding.CreateInterfacePtrAndBind(); |
62 } | 62 } |
63 | 63 |
64 void MockOffscreenCanvasSurface::GetSurfaceId( | 64 void MockOffscreenCanvasSurface::GetSurfaceId( |
| 65 uint32_t canvasId, |
65 const GetSurfaceIdCallback& callback) { | 66 const GetSurfaceIdCallback& callback) { |
66 callback.Run(cc::SurfaceId(cc::FrameSinkId(10, 11), cc::LocalFrameId(15, 0))); | 67 callback.Run(cc::SurfaceId(cc::FrameSinkId(10, 11), cc::LocalFrameId(15, 0))); |
67 } | 68 } |
68 | 69 |
69 void CanvasSurfaceLayerBridgeTest::SetUp() { | 70 void CanvasSurfaceLayerBridgeTest::SetUp() { |
70 m_surfaceLayerBridge = | 71 m_surfaceLayerBridge = |
71 wrapUnique(new CanvasSurfaceLayerBridge(m_service.GetProxy())); | 72 wrapUnique(new CanvasSurfaceLayerBridge(m_service.GetProxy())); |
72 } | 73 } |
73 | 74 |
74 TEST_F(CanvasSurfaceLayerBridgeTest, SurfaceLayerCreation) { | 75 TEST_F(CanvasSurfaceLayerBridgeTest, SurfaceLayerCreation) { |
75 bool success = this->surfaceLayerBridge()->createSurfaceLayer(50, 50); | 76 bool success = this->surfaceLayerBridge()->createSurfaceLayer(0, 50, 50); |
76 EXPECT_TRUE(success); | 77 EXPECT_TRUE(success); |
77 } | 78 } |
78 | 79 |
79 } // namespace blink | 80 } // namespace blink |
OLD | NEW |