| 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()), | |
| 193 host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_), | 192 host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_), |
| 194 test_data_(&shared_bitmap_manager_) {} | 193 test_data_(&shared_bitmap_manager_) {} |
| 195 | 194 |
| 196 protected: | 195 protected: |
| 197 void SetUp() override { | 196 void SetUp() override { |
| 198 layer_tree_host_ = | 197 layer_tree_host_ = |
| 199 MockLayerTreeHost::Create(&fake_client_, &task_graph_runner_); | 198 MockLayerTreeHost::Create(&fake_client_, &task_graph_runner_); |
| 200 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); | 199 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); |
| 201 layer_tree_host_->SetViewportSize(gfx::Size(10, 10)); | 200 layer_tree_host_->SetViewportSize(gfx::Size(10, 10)); |
| 202 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 201 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
| 203 } | 202 } |
| 204 | 203 |
| 205 void TearDown() override { | 204 void TearDown() override { |
| 206 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 205 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
| 207 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); | 206 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); |
| 208 | 207 |
| 209 layer_tree_host_->SetRootLayer(nullptr); | 208 layer_tree_host_->SetRootLayer(nullptr); |
| 210 layer_tree_host_ = nullptr; | 209 layer_tree_host_ = nullptr; |
| 211 } | 210 } |
| 212 | 211 |
| 213 scoped_ptr<MockLayerTreeHost> layer_tree_host_; | 212 scoped_ptr<MockLayerTreeHost> layer_tree_host_; |
| 214 FakeImplProxy proxy_; | 213 FakeImplProxy proxy_; |
| 215 FakeLayerTreeHostClient fake_client_; | 214 FakeLayerTreeHostClient fake_client_; |
| 216 TestSharedBitmapManager shared_bitmap_manager_; | 215 TestSharedBitmapManager shared_bitmap_manager_; |
| 217 TestTaskGraphRunner task_graph_runner_; | 216 TestTaskGraphRunner task_graph_runner_; |
| 218 scoped_ptr<OutputSurface> output_surface_; | |
| 219 FakeLayerTreeHostImpl host_impl_; | 217 FakeLayerTreeHostImpl host_impl_; |
| 220 CommonMailboxObjects test_data_; | 218 CommonMailboxObjects test_data_; |
| 221 LayerSettings layer_settings_; | 219 LayerSettings layer_settings_; |
| 222 }; | 220 }; |
| 223 | 221 |
| 224 TEST_F(TextureLayerTest, CheckPropertyChangeCausesCorrectBehavior) { | 222 TEST_F(TextureLayerTest, CheckPropertyChangeCausesCorrectBehavior) { |
| 225 scoped_refptr<TextureLayer> test_layer = | 223 scoped_refptr<TextureLayer> test_layer = |
| 226 TextureLayer::CreateForMailbox(layer_settings_, nullptr); | 224 TextureLayer::CreateForMailbox(layer_settings_, nullptr); |
| 227 EXPECT_SET_NEEDS_COMMIT(1, layer_tree_host_->SetRootLayer(test_layer)); | 225 EXPECT_SET_NEEDS_COMMIT(1, layer_tree_host_->SetRootLayer(test_layer)); |
| 228 | 226 |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 class TextureLayerImplWithMailboxTest : public TextureLayerTest { | 875 class TextureLayerImplWithMailboxTest : public TextureLayerTest { |
| 878 protected: | 876 protected: |
| 879 TextureLayerImplWithMailboxTest() | 877 TextureLayerImplWithMailboxTest() |
| 880 : fake_client_( | 878 : fake_client_( |
| 881 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)) {} | 879 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)) {} |
| 882 | 880 |
| 883 void SetUp() override { | 881 void SetUp() override { |
| 884 TextureLayerTest::SetUp(); | 882 TextureLayerTest::SetUp(); |
| 885 layer_tree_host_ = | 883 layer_tree_host_ = |
| 886 MockLayerTreeHost::Create(&fake_client_, &task_graph_runner_); | 884 MockLayerTreeHost::Create(&fake_client_, &task_graph_runner_); |
| 887 EXPECT_TRUE(host_impl_.InitializeRenderer(output_surface_.get())); | 885 EXPECT_TRUE(host_impl_.InitializeRenderer(FakeOutputSurface::Create3d())); |
| 888 } | 886 } |
| 889 | 887 |
| 890 bool WillDraw(TextureLayerImpl* layer, DrawMode mode) { | 888 bool WillDraw(TextureLayerImpl* layer, DrawMode mode) { |
| 891 bool will_draw = layer->WillDraw( | 889 bool will_draw = layer->WillDraw( |
| 892 mode, host_impl_.active_tree()->resource_provider()); | 890 mode, host_impl_.active_tree()->resource_provider()); |
| 893 if (will_draw) | 891 if (will_draw) |
| 894 layer->DidDraw(host_impl_.active_tree()->resource_provider()); | 892 layer->DidDraw(host_impl_.active_tree()->resource_provider()); |
| 895 return will_draw; | 893 return will_draw; |
| 896 } | 894 } |
| 897 | 895 |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 int callback_count_; | 1505 int callback_count_; |
| 1508 scoped_refptr<Layer> root_; | 1506 scoped_refptr<Layer> root_; |
| 1509 scoped_refptr<TextureLayer> layer_; | 1507 scoped_refptr<TextureLayer> layer_; |
| 1510 }; | 1508 }; |
| 1511 | 1509 |
| 1512 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1510 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
| 1513 TextureLayerWithMailboxImplThreadDeleted); | 1511 TextureLayerWithMailboxImplThreadDeleted); |
| 1514 | 1512 |
| 1515 } // namespace | 1513 } // namespace |
| 1516 } // namespace cc | 1514 } // namespace cc |
| OLD | NEW |