| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
| 10 #include "cc/output/compositor_frame_metadata.h" | 10 #include "cc/output/compositor_frame_metadata.h" |
| (...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 }; | 1052 }; |
| 1053 | 1053 |
| 1054 class NonReshapableOutputSurface : public FakeOutputSurface { | 1054 class NonReshapableOutputSurface : public FakeOutputSurface { |
| 1055 public: | 1055 public: |
| 1056 explicit NonReshapableOutputSurface( | 1056 explicit NonReshapableOutputSurface( |
| 1057 scoped_ptr<TestWebGraphicsContext3D> context3d) | 1057 scoped_ptr<TestWebGraphicsContext3D> context3d) |
| 1058 : FakeOutputSurface(TestContextProvider::Create(context3d.Pass()), | 1058 : FakeOutputSurface(TestContextProvider::Create(context3d.Pass()), |
| 1059 false) { | 1059 false) { |
| 1060 surface_size_ = gfx::Size(500, 500); | 1060 surface_size_ = gfx::Size(500, 500); |
| 1061 } | 1061 } |
| 1062 virtual void Reshape(const gfx::Size& size, float scale_factor) OVERRIDE {} | 1062 virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE {} |
| 1063 void set_fixed_size(const gfx::Size& size) { surface_size_ = size; } | 1063 void set_fixed_size(gfx::Size size) { surface_size_ = size; } |
| 1064 }; | 1064 }; |
| 1065 | 1065 |
| 1066 TEST_F(GLRendererTest, NoDiscardOnPartialUpdates) { | 1066 TEST_F(GLRendererTest, NoDiscardOnPartialUpdates) { |
| 1067 scoped_ptr<DiscardCheckingContext> context_owned(new DiscardCheckingContext); | 1067 scoped_ptr<DiscardCheckingContext> context_owned(new DiscardCheckingContext); |
| 1068 DiscardCheckingContext* context = context_owned.get(); | 1068 DiscardCheckingContext* context = context_owned.get(); |
| 1069 | 1069 |
| 1070 FakeOutputSurfaceClient output_surface_client; | 1070 FakeOutputSurfaceClient output_surface_client; |
| 1071 scoped_ptr<NonReshapableOutputSurface> output_surface( | 1071 scoped_ptr<NonReshapableOutputSurface> output_surface( |
| 1072 new NonReshapableOutputSurface( | 1072 new NonReshapableOutputSurface( |
| 1073 context_owned.PassAs<TestWebGraphicsContext3D>())); | 1073 context_owned.PassAs<TestWebGraphicsContext3D>())); |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1667 MockOutputSurface() | 1667 MockOutputSurface() |
| 1668 : OutputSurface( | 1668 : OutputSurface( |
| 1669 TestContextProvider::Create(scoped_ptr<TestWebGraphicsContext3D>( | 1669 TestContextProvider::Create(scoped_ptr<TestWebGraphicsContext3D>( |
| 1670 new StrictMock<OutputSurfaceMockContext>))) { | 1670 new StrictMock<OutputSurfaceMockContext>))) { |
| 1671 surface_size_ = gfx::Size(100, 100); | 1671 surface_size_ = gfx::Size(100, 100); |
| 1672 } | 1672 } |
| 1673 virtual ~MockOutputSurface() {} | 1673 virtual ~MockOutputSurface() {} |
| 1674 | 1674 |
| 1675 MOCK_METHOD0(EnsureBackbuffer, void()); | 1675 MOCK_METHOD0(EnsureBackbuffer, void()); |
| 1676 MOCK_METHOD0(DiscardBackbuffer, void()); | 1676 MOCK_METHOD0(DiscardBackbuffer, void()); |
| 1677 MOCK_METHOD2(Reshape, void(const gfx::Size& size, float scale_factor)); | 1677 MOCK_METHOD2(Reshape, void(gfx::Size size, float scale_factor)); |
| 1678 MOCK_METHOD0(BindFramebuffer, void()); | 1678 MOCK_METHOD0(BindFramebuffer, void()); |
| 1679 MOCK_METHOD1(SwapBuffers, void(CompositorFrame* frame)); | 1679 MOCK_METHOD1(SwapBuffers, void(CompositorFrame* frame)); |
| 1680 }; | 1680 }; |
| 1681 | 1681 |
| 1682 class MockOutputSurfaceTest : public GLRendererTest { | 1682 class MockOutputSurfaceTest : public GLRendererTest { |
| 1683 protected: | 1683 protected: |
| 1684 virtual void SetUp() { | 1684 virtual void SetUp() { |
| 1685 FakeOutputSurfaceClient output_surface_client_; | 1685 FakeOutputSurfaceClient output_surface_client_; |
| 1686 CHECK(output_surface_.BindToClient(&output_surface_client_)); | 1686 CHECK(output_surface_.BindToClient(&output_surface_client_)); |
| 1687 | 1687 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1842 base::MessageLoop::current()->Run(); | 1842 base::MessageLoop::current()->Run(); |
| 1843 | 1843 |
| 1844 // The sync point should have happened. | 1844 // The sync point should have happened. |
| 1845 EXPECT_EQ(1, sync_point_callback_count); | 1845 EXPECT_EQ(1, sync_point_callback_count); |
| 1846 EXPECT_EQ(1, other_callback_count); | 1846 EXPECT_EQ(1, other_callback_count); |
| 1847 } | 1847 } |
| 1848 #endif // OS_ANDROID | 1848 #endif // OS_ANDROID |
| 1849 | 1849 |
| 1850 } // namespace | 1850 } // namespace |
| 1851 } // namespace cc | 1851 } // namespace cc |
| OLD | NEW |