| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 3511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3522 quad_sink->Append(my_quad.PassAs<DrawQuad>(), append_quads_data); | 3522 quad_sink->Append(my_quad.PassAs<DrawQuad>(), append_quads_data); |
| 3523 } | 3523 } |
| 3524 | 3524 |
| 3525 private: | 3525 private: |
| 3526 FakeLayerWithQuads(LayerTreeImpl* tree_impl, int id) | 3526 FakeLayerWithQuads(LayerTreeImpl* tree_impl, int id) |
| 3527 : LayerImpl(tree_impl, id) {} | 3527 : LayerImpl(tree_impl, id) {} |
| 3528 }; | 3528 }; |
| 3529 | 3529 |
| 3530 class MockContext : public TestWebGraphicsContext3D { | 3530 class MockContext : public TestWebGraphicsContext3D { |
| 3531 public: | 3531 public: |
| 3532 MOCK_METHOD1(useProgram, void(blink::WebGLId program)); | 3532 MOCK_METHOD1(useProgram, void(GLuint program)); |
| 3533 MOCK_METHOD5(uniform4f, void(blink::WGC3Dint location, | 3533 MOCK_METHOD5(uniform4f, void(GLint location, |
| 3534 blink::WGC3Dfloat x, | 3534 GLfloat x, |
| 3535 blink::WGC3Dfloat y, | 3535 GLfloat y, |
| 3536 blink::WGC3Dfloat z, | 3536 GLfloat z, |
| 3537 blink::WGC3Dfloat w)); | 3537 GLfloat w)); |
| 3538 MOCK_METHOD4(uniformMatrix4fv, void(blink::WGC3Dint location, | 3538 MOCK_METHOD4(uniformMatrix4fv, void(GLint location, |
| 3539 blink::WGC3Dsizei count, | 3539 GLsizei count, |
| 3540 blink::WGC3Dboolean transpose, | 3540 GLboolean transpose, |
| 3541 const blink::WGC3Dfloat* value)); | 3541 const GLfloat* value)); |
| 3542 MOCK_METHOD4(drawElements, void(blink::WGC3Denum mode, | 3542 MOCK_METHOD4(drawElements, void(GLenum mode, |
| 3543 blink::WGC3Dsizei count, | 3543 GLsizei count, |
| 3544 blink::WGC3Denum type, | 3544 GLenum type, |
| 3545 blink::WGC3Dintptr offset)); | 3545 GLintptr offset)); |
| 3546 MOCK_METHOD0(getRequestableExtensionsCHROMIUM, blink::WebString()); | 3546 MOCK_METHOD0(getRequestableExtensionsCHROMIUM, blink::WebString()); |
| 3547 MOCK_METHOD1(enable, void(blink::WGC3Denum cap)); | 3547 MOCK_METHOD1(enable, void(GLenum cap)); |
| 3548 MOCK_METHOD1(disable, void(blink::WGC3Denum cap)); | 3548 MOCK_METHOD1(disable, void(GLenum cap)); |
| 3549 MOCK_METHOD4(scissor, void(blink::WGC3Dint x, | 3549 MOCK_METHOD4(scissor, void(GLint x, |
| 3550 blink::WGC3Dint y, | 3550 GLint y, |
| 3551 blink::WGC3Dsizei width, | 3551 GLsizei width, |
| 3552 blink::WGC3Dsizei height)); | 3552 GLsizei height)); |
| 3553 }; | 3553 }; |
| 3554 | 3554 |
| 3555 class MockContextHarness { | 3555 class MockContextHarness { |
| 3556 private: | 3556 private: |
| 3557 MockContext* context_; | 3557 MockContext* context_; |
| 3558 | 3558 |
| 3559 public: | 3559 public: |
| 3560 explicit MockContextHarness(MockContext* context) | 3560 explicit MockContextHarness(MockContext* context) |
| 3561 : context_(context) { | 3561 : context_(context) { |
| 3562 context_->set_have_post_sub_buffer(true); | 3562 context_->set_have_post_sub_buffer(true); |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3863 | 3863 |
| 3864 // Kill the layer tree. | 3864 // Kill the layer tree. |
| 3865 host_impl_->active_tree()->SetRootLayer( | 3865 host_impl_->active_tree()->SetRootLayer( |
| 3866 LayerImpl::Create(host_impl_->active_tree(), 100)); | 3866 LayerImpl::Create(host_impl_->active_tree(), 100)); |
| 3867 // There should be no textures left in use after. | 3867 // There should be no textures left in use after. |
| 3868 EXPECT_EQ(0u, context3d->NumTextures()); | 3868 EXPECT_EQ(0u, context3d->NumTextures()); |
| 3869 } | 3869 } |
| 3870 | 3870 |
| 3871 class MockDrawQuadsToFillScreenContext : public TestWebGraphicsContext3D { | 3871 class MockDrawQuadsToFillScreenContext : public TestWebGraphicsContext3D { |
| 3872 public: | 3872 public: |
| 3873 MOCK_METHOD1(useProgram, void(blink::WebGLId program)); | 3873 MOCK_METHOD1(useProgram, void(GLuint program)); |
| 3874 MOCK_METHOD4(drawElements, void(blink::WGC3Denum mode, | 3874 MOCK_METHOD4(drawElements, void(GLenum mode, |
| 3875 blink::WGC3Dsizei count, | 3875 GLsizei count, |
| 3876 blink::WGC3Denum type, | 3876 GLenum type, |
| 3877 blink::WGC3Dintptr offset)); | 3877 GLintptr offset)); |
| 3878 }; | 3878 }; |
| 3879 | 3879 |
| 3880 TEST_F(LayerTreeHostImplTest, HasTransparentBackground) { | 3880 TEST_F(LayerTreeHostImplTest, HasTransparentBackground) { |
| 3881 scoped_ptr<MockDrawQuadsToFillScreenContext> mock_context_owned( | 3881 scoped_ptr<MockDrawQuadsToFillScreenContext> mock_context_owned( |
| 3882 new MockDrawQuadsToFillScreenContext); | 3882 new MockDrawQuadsToFillScreenContext); |
| 3883 MockDrawQuadsToFillScreenContext* mock_context = mock_context_owned.get(); | 3883 MockDrawQuadsToFillScreenContext* mock_context = mock_context_owned.get(); |
| 3884 | 3884 |
| 3885 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( | 3885 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
| 3886 mock_context_owned.PassAs<TestWebGraphicsContext3D>())); | 3886 mock_context_owned.PassAs<TestWebGraphicsContext3D>())); |
| 3887 | 3887 |
| (...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5432 &set_needs_redraw_count)); | 5432 &set_needs_redraw_count)); |
| 5433 // Empty damage rect won't signal the monitor. | 5433 // Empty damage rect won't signal the monitor. |
| 5434 host_impl_->SetNeedsRedrawRect(gfx::Rect()); | 5434 host_impl_->SetNeedsRedrawRect(gfx::Rect()); |
| 5435 EXPECT_EQ(0, set_needs_commit_count); | 5435 EXPECT_EQ(0, set_needs_commit_count); |
| 5436 EXPECT_EQ(2, set_needs_redraw_count); | 5436 EXPECT_EQ(2, set_needs_redraw_count); |
| 5437 } | 5437 } |
| 5438 } | 5438 } |
| 5439 | 5439 |
| 5440 } // namespace | 5440 } // namespace |
| 5441 } // namespace cc | 5441 } // namespace cc |
| OLD | NEW |