| 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" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 15 #include "base/synchronization/waitable_event.h" | 15 #include "base/synchronization/waitable_event.h" |
| 16 #include "base/thread_task_runner_handle.h" | 16 #include "base/thread_task_runner_handle.h" |
| 17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
| 18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 19 #include "cc/layers/solid_color_layer.h" | 19 #include "cc/layers/solid_color_layer.h" |
| 20 #include "cc/layers/texture_layer_client.h" | 20 #include "cc/layers/texture_layer_client.h" |
| 21 #include "cc/layers/texture_layer_impl.h" | 21 #include "cc/layers/texture_layer_impl.h" |
| 22 #include "cc/output/compositor_frame_ack.h" | 22 #include "cc/output/compositor_frame_ack.h" |
| 23 #include "cc/output/context_provider.h" | 23 #include "cc/output/context_provider.h" |
| 24 #include "cc/resources/returned_resource.h" | 24 #include "cc/resources/returned_resource.h" |
| 25 #include "cc/test/fake_impl_proxy.h" | 25 #include "cc/test/fake_impl_task_runner_provider.h" |
| 26 #include "cc/test/fake_layer_tree_host_client.h" | 26 #include "cc/test/fake_layer_tree_host_client.h" |
| 27 #include "cc/test/fake_layer_tree_host_impl.h" | 27 #include "cc/test/fake_layer_tree_host_impl.h" |
| 28 #include "cc/test/fake_output_surface.h" | 28 #include "cc/test/fake_output_surface.h" |
| 29 #include "cc/test/layer_test_common.h" | 29 #include "cc/test/layer_test_common.h" |
| 30 #include "cc/test/layer_tree_test.h" | 30 #include "cc/test/layer_tree_test.h" |
| 31 #include "cc/test/test_task_graph_runner.h" | 31 #include "cc/test/test_task_graph_runner.h" |
| 32 #include "cc/test/test_web_graphics_context_3d.h" | 32 #include "cc/test/test_web_graphics_context_3d.h" |
| 33 #include "cc/trees/blocking_task_runner.h" | 33 #include "cc/trees/blocking_task_runner.h" |
| 34 #include "cc/trees/layer_tree_host.h" | 34 #include "cc/trees/layer_tree_host.h" |
| 35 #include "cc/trees/layer_tree_impl.h" | 35 #include "cc/trees/layer_tree_impl.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 output_surface_(FakeOutputSurface::Create3d()), |
| 193 host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_), | 193 host_impl_(&task_runner_provider_, |
| 194 &shared_bitmap_manager_, |
| 195 &task_graph_runner_), |
| 194 test_data_(&shared_bitmap_manager_) {} | 196 test_data_(&shared_bitmap_manager_) {} |
| 195 | 197 |
| 196 protected: | 198 protected: |
| 197 void SetUp() override { | 199 void SetUp() override { |
| 198 layer_tree_host_ = | 200 layer_tree_host_ = |
| 199 MockLayerTreeHost::Create(&fake_client_, &task_graph_runner_); | 201 MockLayerTreeHost::Create(&fake_client_, &task_graph_runner_); |
| 200 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); | 202 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); |
| 201 layer_tree_host_->SetViewportSize(gfx::Size(10, 10)); | 203 layer_tree_host_->SetViewportSize(gfx::Size(10, 10)); |
| 202 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 204 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
| 203 } | 205 } |
| 204 | 206 |
| 205 void TearDown() override { | 207 void TearDown() override { |
| 206 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 208 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
| 207 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); | 209 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); |
| 208 | 210 |
| 209 layer_tree_host_->SetRootLayer(nullptr); | 211 layer_tree_host_->SetRootLayer(nullptr); |
| 210 layer_tree_host_ = nullptr; | 212 layer_tree_host_ = nullptr; |
| 211 } | 213 } |
| 212 | 214 |
| 213 scoped_ptr<MockLayerTreeHost> layer_tree_host_; | 215 scoped_ptr<MockLayerTreeHost> layer_tree_host_; |
| 214 FakeImplProxy proxy_; | 216 FakeImplTaskRunnerProvider task_runner_provider_; |
| 215 FakeLayerTreeHostClient fake_client_; | 217 FakeLayerTreeHostClient fake_client_; |
| 216 TestSharedBitmapManager shared_bitmap_manager_; | 218 TestSharedBitmapManager shared_bitmap_manager_; |
| 217 TestTaskGraphRunner task_graph_runner_; | 219 TestTaskGraphRunner task_graph_runner_; |
| 218 scoped_ptr<OutputSurface> output_surface_; | 220 scoped_ptr<OutputSurface> output_surface_; |
| 219 FakeLayerTreeHostImpl host_impl_; | 221 FakeLayerTreeHostImpl host_impl_; |
| 220 CommonMailboxObjects test_data_; | 222 CommonMailboxObjects test_data_; |
| 221 LayerSettings layer_settings_; | 223 LayerSettings layer_settings_; |
| 222 }; | 224 }; |
| 223 | 225 |
| 224 TEST_F(TextureLayerTest, CheckPropertyChangeCausesCorrectBehavior) { | 226 TEST_F(TextureLayerTest, CheckPropertyChangeCausesCorrectBehavior) { |
| (...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1459 int callback_count_; | 1461 int callback_count_; |
| 1460 scoped_refptr<Layer> root_; | 1462 scoped_refptr<Layer> root_; |
| 1461 scoped_refptr<TextureLayer> layer_; | 1463 scoped_refptr<TextureLayer> layer_; |
| 1462 }; | 1464 }; |
| 1463 | 1465 |
| 1464 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1466 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
| 1465 TextureLayerWithMailboxImplThreadDeleted); | 1467 TextureLayerWithMailboxImplThreadDeleted); |
| 1466 | 1468 |
| 1467 } // namespace | 1469 } // namespace |
| 1468 } // namespace cc | 1470 } // namespace cc |
| OLD | NEW |