| 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/layers/texture_layer.h" | 5 #include "cc/layers/texture_layer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 uint32 sync_point1_; | 182 uint32 sync_point1_; |
| 183 uint32 sync_point2_; | 183 uint32 sync_point2_; |
| 184 scoped_ptr<SharedBitmap> shared_bitmap_; | 184 scoped_ptr<SharedBitmap> shared_bitmap_; |
| 185 }; | 185 }; |
| 186 | 186 |
| 187 class TextureLayerTest : public testing::Test { | 187 class TextureLayerTest : public testing::Test { |
| 188 public: | 188 public: |
| 189 TextureLayerTest() | 189 TextureLayerTest() |
| 190 : fake_client_( | 190 : fake_client_( |
| 191 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)), | 191 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)), |
| 192 output_surface_(FakeOutputSurface::Create3d()), |
| 192 host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_), | 193 host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_), |
| 193 test_data_(&shared_bitmap_manager_) {} | 194 test_data_(&shared_bitmap_manager_) {} |
| 194 | 195 |
| 195 protected: | 196 protected: |
| 196 void SetUp() override { | 197 void SetUp() override { |
| 197 layer_tree_host_ = | 198 layer_tree_host_ = |
| 198 MockLayerTreeHost::Create(&fake_client_, &task_graph_runner_); | 199 MockLayerTreeHost::Create(&fake_client_, &task_graph_runner_); |
| 199 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); | 200 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); |
| 200 layer_tree_host_->SetViewportSize(gfx::Size(10, 10)); | 201 layer_tree_host_->SetViewportSize(gfx::Size(10, 10)); |
| 201 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 202 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
| 202 } | 203 } |
| 203 | 204 |
| 204 void TearDown() override { | 205 void TearDown() override { |
| 205 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 206 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
| 206 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); | 207 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); |
| 207 | 208 |
| 208 layer_tree_host_->SetRootLayer(nullptr); | 209 layer_tree_host_->SetRootLayer(nullptr); |
| 209 layer_tree_host_ = nullptr; | 210 layer_tree_host_ = nullptr; |
| 210 } | 211 } |
| 211 | 212 |
| 212 scoped_ptr<MockLayerTreeHost> layer_tree_host_; | 213 scoped_ptr<MockLayerTreeHost> layer_tree_host_; |
| 213 FakeImplProxy proxy_; | 214 FakeImplProxy proxy_; |
| 214 FakeLayerTreeHostClient fake_client_; | 215 FakeLayerTreeHostClient fake_client_; |
| 215 TestSharedBitmapManager shared_bitmap_manager_; | 216 TestSharedBitmapManager shared_bitmap_manager_; |
| 216 TestTaskGraphRunner task_graph_runner_; | 217 TestTaskGraphRunner task_graph_runner_; |
| 218 scoped_ptr<OutputSurface> output_surface_; |
| 217 FakeLayerTreeHostImpl host_impl_; | 219 FakeLayerTreeHostImpl host_impl_; |
| 218 CommonMailboxObjects test_data_; | 220 CommonMailboxObjects test_data_; |
| 219 LayerSettings layer_settings_; | 221 LayerSettings layer_settings_; |
| 220 }; | 222 }; |
| 221 | 223 |
| 222 TEST_F(TextureLayerTest, CheckPropertyChangeCausesCorrectBehavior) { | 224 TEST_F(TextureLayerTest, CheckPropertyChangeCausesCorrectBehavior) { |
| 223 scoped_refptr<TextureLayer> test_layer = | 225 scoped_refptr<TextureLayer> test_layer = |
| 224 TextureLayer::CreateForMailbox(layer_settings_, nullptr); | 226 TextureLayer::CreateForMailbox(layer_settings_, nullptr); |
| 225 EXPECT_SET_NEEDS_COMMIT(1, layer_tree_host_->SetRootLayer(test_layer)); | 227 EXPECT_SET_NEEDS_COMMIT(1, layer_tree_host_->SetRootLayer(test_layer)); |
| 226 | 228 |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 class TextureLayerImplWithMailboxTest : public TextureLayerTest { | 828 class TextureLayerImplWithMailboxTest : public TextureLayerTest { |
| 827 protected: | 829 protected: |
| 828 TextureLayerImplWithMailboxTest() | 830 TextureLayerImplWithMailboxTest() |
| 829 : fake_client_( | 831 : fake_client_( |
| 830 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)) {} | 832 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)) {} |
| 831 | 833 |
| 832 void SetUp() override { | 834 void SetUp() override { |
| 833 TextureLayerTest::SetUp(); | 835 TextureLayerTest::SetUp(); |
| 834 layer_tree_host_ = | 836 layer_tree_host_ = |
| 835 MockLayerTreeHost::Create(&fake_client_, &task_graph_runner_); | 837 MockLayerTreeHost::Create(&fake_client_, &task_graph_runner_); |
| 836 EXPECT_TRUE(host_impl_.InitializeRenderer(FakeOutputSurface::Create3d())); | 838 EXPECT_TRUE(host_impl_.InitializeRenderer(output_surface_.get())); |
| 837 } | 839 } |
| 838 | 840 |
| 839 bool WillDraw(TextureLayerImpl* layer, DrawMode mode) { | 841 bool WillDraw(TextureLayerImpl* layer, DrawMode mode) { |
| 840 bool will_draw = layer->WillDraw( | 842 bool will_draw = layer->WillDraw( |
| 841 mode, host_impl_.active_tree()->resource_provider()); | 843 mode, host_impl_.active_tree()->resource_provider()); |
| 842 if (will_draw) | 844 if (will_draw) |
| 843 layer->DidDraw(host_impl_.active_tree()->resource_provider()); | 845 layer->DidDraw(host_impl_.active_tree()->resource_provider()); |
| 844 return will_draw; | 846 return will_draw; |
| 845 } | 847 } |
| 846 | 848 |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1456 int callback_count_; | 1458 int callback_count_; |
| 1457 scoped_refptr<Layer> root_; | 1459 scoped_refptr<Layer> root_; |
| 1458 scoped_refptr<TextureLayer> layer_; | 1460 scoped_refptr<TextureLayer> layer_; |
| 1459 }; | 1461 }; |
| 1460 | 1462 |
| 1461 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1463 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
| 1462 TextureLayerWithMailboxImplThreadDeleted); | 1464 TextureLayerWithMailboxImplThreadDeleted); |
| 1463 | 1465 |
| 1464 } // namespace | 1466 } // namespace |
| 1465 } // namespace cc | 1467 } // namespace cc |
| OLD | NEW |