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 "cc/output/delegating_renderer.h" | 5 #include "cc/output/delegating_renderer.h" |
6 #include "cc/output/gl_renderer.h" | 6 #include "cc/output/gl_renderer.h" |
7 #include "cc/output/output_surface.h" | 7 #include "cc/output/output_surface.h" |
8 #include "cc/test/fake_output_surface_client.h" | 8 #include "cc/test/fake_output_surface_client.h" |
9 #include "cc/test/fake_renderer_client.h" | 9 #include "cc/test/fake_renderer_client.h" |
10 #include "cc/test/fake_resource_provider.h" | 10 #include "cc/test/fake_resource_provider.h" |
11 #include "cc/test/test_context_provider.h" | 11 #include "cc/test/test_context_provider.h" |
12 #include "cc/test/test_web_graphics_context_3d.h" | 12 #include "cc/test/test_web_graphics_context_3d.h" |
13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 namespace cc { | 16 namespace cc { |
17 namespace { | 17 namespace { |
18 | 18 |
19 class TestOutputSurface : public OutputSurface { | 19 class TestOutputSurface : public OutputSurface { |
20 public: | 20 public: |
21 explicit TestOutputSurface(scoped_refptr<ContextProvider> context_provider); | 21 explicit TestOutputSurface(scoped_refptr<ContextProvider> context_provider); |
22 ~TestOutputSurface() override; | 22 ~TestOutputSurface() override; |
23 | 23 |
24 // OutputSurface implementation. | 24 // OutputSurface implementation. |
25 void SwapBuffers(CompositorFrame* frame) override; | 25 void SwapBuffers(CompositorFrame frame) override; |
26 uint32_t GetFramebufferCopyTextureFormat() override { return GL_RGB; } | 26 uint32_t GetFramebufferCopyTextureFormat() override { return GL_RGB; } |
27 }; | 27 }; |
28 | 28 |
29 TestOutputSurface::TestOutputSurface( | 29 TestOutputSurface::TestOutputSurface( |
30 scoped_refptr<ContextProvider> context_provider) | 30 scoped_refptr<ContextProvider> context_provider) |
31 : OutputSurface(std::move(context_provider), nullptr, nullptr) {} | 31 : OutputSurface(std::move(context_provider), nullptr, nullptr) {} |
32 | 32 |
33 TestOutputSurface::~TestOutputSurface() { | 33 TestOutputSurface::~TestOutputSurface() { |
34 } | 34 } |
35 | 35 |
36 void TestOutputSurface::SwapBuffers(CompositorFrame* frame) { | 36 void TestOutputSurface::SwapBuffers(CompositorFrame frame) { |
37 client_->DidSwapBuffers(); | 37 client_->DidSwapBuffers(); |
38 client_->DidSwapBuffersComplete(); | 38 client_->DidSwapBuffersComplete(); |
39 } | 39 } |
40 | 40 |
41 class MockContextProvider : public TestContextProvider { | 41 class MockContextProvider : public TestContextProvider { |
42 public: | 42 public: |
43 explicit MockContextProvider( | 43 explicit MockContextProvider( |
44 std::unique_ptr<TestWebGraphicsContext3D> context) | 44 std::unique_ptr<TestWebGraphicsContext3D> context) |
45 : TestContextProvider(std::move(context)) {} | 45 : TestContextProvider(std::move(context)) {} |
46 MOCK_METHOD0(DeleteCachedResources, void()); | 46 MOCK_METHOD0(DeleteCachedResources, void()); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 EXPECT_CALL(*(this->context_provider_.get()), DeleteCachedResources()) | 107 EXPECT_CALL(*(this->context_provider_.get()), DeleteCachedResources()) |
108 .Times(1); | 108 .Times(1); |
109 | 109 |
110 EXPECT_TRUE(this->renderer_->visible()); | 110 EXPECT_TRUE(this->renderer_->visible()); |
111 this->renderer_->SetVisible(false); | 111 this->renderer_->SetVisible(false); |
112 EXPECT_FALSE(this->renderer_->visible()); | 112 EXPECT_FALSE(this->renderer_->visible()); |
113 } | 113 } |
114 | 114 |
115 } // namespace | 115 } // namespace |
116 } // namespace cc | 116 } // namespace cc |
OLD | NEW |