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 3545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3556 quad_sink->Append(my_quad.PassAs<DrawQuad>(), append_quads_data); | 3556 quad_sink->Append(my_quad.PassAs<DrawQuad>(), append_quads_data); |
3557 } | 3557 } |
3558 | 3558 |
3559 private: | 3559 private: |
3560 FakeLayerWithQuads(LayerTreeImpl* tree_impl, int id) | 3560 FakeLayerWithQuads(LayerTreeImpl* tree_impl, int id) |
3561 : LayerImpl(tree_impl, id) {} | 3561 : LayerImpl(tree_impl, id) {} |
3562 }; | 3562 }; |
3563 | 3563 |
3564 class MockContext : public TestWebGraphicsContext3D { | 3564 class MockContext : public TestWebGraphicsContext3D { |
3565 public: | 3565 public: |
3566 MOCK_METHOD1(useProgram, void(WebKit::WebGLId program)); | 3566 MOCK_METHOD1(useProgram, void(blink::WebGLId program)); |
3567 MOCK_METHOD5(uniform4f, void(WebKit::WGC3Dint location, | 3567 MOCK_METHOD5(uniform4f, void(blink::WGC3Dint location, |
3568 WebKit::WGC3Dfloat x, | 3568 blink::WGC3Dfloat x, |
3569 WebKit::WGC3Dfloat y, | 3569 blink::WGC3Dfloat y, |
3570 WebKit::WGC3Dfloat z, | 3570 blink::WGC3Dfloat z, |
3571 WebKit::WGC3Dfloat w)); | 3571 blink::WGC3Dfloat w)); |
3572 MOCK_METHOD4(uniformMatrix4fv, void(WebKit::WGC3Dint location, | 3572 MOCK_METHOD4(uniformMatrix4fv, void(blink::WGC3Dint location, |
3573 WebKit::WGC3Dsizei count, | 3573 blink::WGC3Dsizei count, |
3574 WebKit::WGC3Dboolean transpose, | 3574 blink::WGC3Dboolean transpose, |
3575 const WebKit::WGC3Dfloat* value)); | 3575 const blink::WGC3Dfloat* value)); |
3576 MOCK_METHOD4(drawElements, void(WebKit::WGC3Denum mode, | 3576 MOCK_METHOD4(drawElements, void(blink::WGC3Denum mode, |
3577 WebKit::WGC3Dsizei count, | 3577 blink::WGC3Dsizei count, |
3578 WebKit::WGC3Denum type, | 3578 blink::WGC3Denum type, |
3579 WebKit::WGC3Dintptr offset)); | 3579 blink::WGC3Dintptr offset)); |
3580 MOCK_METHOD0(getRequestableExtensionsCHROMIUM, WebKit::WebString()); | 3580 MOCK_METHOD0(getRequestableExtensionsCHROMIUM, blink::WebString()); |
3581 MOCK_METHOD1(enable, void(WebKit::WGC3Denum cap)); | 3581 MOCK_METHOD1(enable, void(blink::WGC3Denum cap)); |
3582 MOCK_METHOD1(disable, void(WebKit::WGC3Denum cap)); | 3582 MOCK_METHOD1(disable, void(blink::WGC3Denum cap)); |
3583 MOCK_METHOD4(scissor, void(WebKit::WGC3Dint x, | 3583 MOCK_METHOD4(scissor, void(blink::WGC3Dint x, |
3584 WebKit::WGC3Dint y, | 3584 blink::WGC3Dint y, |
3585 WebKit::WGC3Dsizei width, | 3585 blink::WGC3Dsizei width, |
3586 WebKit::WGC3Dsizei height)); | 3586 blink::WGC3Dsizei height)); |
3587 }; | 3587 }; |
3588 | 3588 |
3589 class MockContextHarness { | 3589 class MockContextHarness { |
3590 private: | 3590 private: |
3591 MockContext* context_; | 3591 MockContext* context_; |
3592 | 3592 |
3593 public: | 3593 public: |
3594 explicit MockContextHarness(MockContext* context) | 3594 explicit MockContextHarness(MockContext* context) |
3595 : context_(context) { | 3595 : context_(context) { |
3596 context_->set_have_post_sub_buffer(true); | 3596 context_->set_have_post_sub_buffer(true); |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3893 | 3893 |
3894 // Kill the layer tree. | 3894 // Kill the layer tree. |
3895 host_impl_->active_tree()->SetRootLayer( | 3895 host_impl_->active_tree()->SetRootLayer( |
3896 LayerImpl::Create(host_impl_->active_tree(), 100)); | 3896 LayerImpl::Create(host_impl_->active_tree(), 100)); |
3897 // There should be no textures left in use after. | 3897 // There should be no textures left in use after. |
3898 EXPECT_EQ(0u, context3d->NumTextures()); | 3898 EXPECT_EQ(0u, context3d->NumTextures()); |
3899 } | 3899 } |
3900 | 3900 |
3901 class MockDrawQuadsToFillScreenContext : public TestWebGraphicsContext3D { | 3901 class MockDrawQuadsToFillScreenContext : public TestWebGraphicsContext3D { |
3902 public: | 3902 public: |
3903 MOCK_METHOD1(useProgram, void(WebKit::WebGLId program)); | 3903 MOCK_METHOD1(useProgram, void(blink::WebGLId program)); |
3904 MOCK_METHOD4(drawElements, void(WebKit::WGC3Denum mode, | 3904 MOCK_METHOD4(drawElements, void(blink::WGC3Denum mode, |
3905 WebKit::WGC3Dsizei count, | 3905 blink::WGC3Dsizei count, |
3906 WebKit::WGC3Denum type, | 3906 blink::WGC3Denum type, |
3907 WebKit::WGC3Dintptr offset)); | 3907 blink::WGC3Dintptr offset)); |
3908 }; | 3908 }; |
3909 | 3909 |
3910 TEST_F(LayerTreeHostImplTest, HasTransparentBackground) { | 3910 TEST_F(LayerTreeHostImplTest, HasTransparentBackground) { |
3911 scoped_ptr<MockDrawQuadsToFillScreenContext> mock_context_owned( | 3911 scoped_ptr<MockDrawQuadsToFillScreenContext> mock_context_owned( |
3912 new MockDrawQuadsToFillScreenContext); | 3912 new MockDrawQuadsToFillScreenContext); |
3913 MockDrawQuadsToFillScreenContext* mock_context = mock_context_owned.get(); | 3913 MockDrawQuadsToFillScreenContext* mock_context = mock_context_owned.get(); |
3914 | 3914 |
3915 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( | 3915 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
3916 mock_context_owned.PassAs<TestWebGraphicsContext3D>())); | 3916 mock_context_owned.PassAs<TestWebGraphicsContext3D>())); |
3917 | 3917 |
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5329 // The root should have scrolled. | 5329 // The root should have scrolled. |
5330 ASSERT_EQ(2u, scroll_info->scrolls.size()); | 5330 ASSERT_EQ(2u, scroll_info->scrolls.size()); |
5331 ExpectContains(*scroll_info.get(), | 5331 ExpectContains(*scroll_info.get(), |
5332 host_impl_->active_tree()->root_layer()->id(), | 5332 host_impl_->active_tree()->root_layer()->id(), |
5333 gfx::Vector2d(0, 10)); | 5333 gfx::Vector2d(0, 10)); |
5334 } | 5334 } |
5335 } | 5335 } |
5336 | 5336 |
5337 } // namespace | 5337 } // namespace |
5338 } // namespace cc | 5338 } // namespace cc |
OLD | NEW |