| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 class TextureLayerTest : public testing::Test { | 170 class TextureLayerTest : public testing::Test { |
| 171 public: | 171 public: |
| 172 TextureLayerTest() | 172 TextureLayerTest() |
| 173 : fake_client_( | 173 : fake_client_( |
| 174 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)), | 174 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)), |
| 175 host_impl_(&proxy_, &shared_bitmap_manager_), | 175 host_impl_(&proxy_, &shared_bitmap_manager_), |
| 176 test_data_(&shared_bitmap_manager_) {} | 176 test_data_(&shared_bitmap_manager_) {} |
| 177 | 177 |
| 178 protected: | 178 protected: |
| 179 virtual void SetUp() { | 179 void SetUp() override { |
| 180 layer_tree_host_.reset(new MockLayerTreeHost(&fake_client_)); | 180 layer_tree_host_.reset(new MockLayerTreeHost(&fake_client_)); |
| 181 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); | 181 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); |
| 182 layer_tree_host_->SetViewportSize(gfx::Size(10, 10)); | 182 layer_tree_host_->SetViewportSize(gfx::Size(10, 10)); |
| 183 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 183 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
| 184 } | 184 } |
| 185 | 185 |
| 186 virtual void TearDown() { | 186 void TearDown() override { |
| 187 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); | 187 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); |
| 188 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); | 188 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); |
| 189 | 189 |
| 190 layer_tree_host_->SetRootLayer(nullptr); | 190 layer_tree_host_->SetRootLayer(nullptr); |
| 191 layer_tree_host_ = nullptr; | 191 layer_tree_host_ = nullptr; |
| 192 } | 192 } |
| 193 | 193 |
| 194 scoped_ptr<MockLayerTreeHost> layer_tree_host_; | 194 scoped_ptr<MockLayerTreeHost> layer_tree_host_; |
| 195 FakeImplProxy proxy_; | 195 FakeImplProxy proxy_; |
| 196 FakeLayerTreeHostClient fake_client_; | 196 FakeLayerTreeHostClient fake_client_; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 class TestMailboxHolder : public TextureLayer::TextureMailboxHolder { | 296 class TestMailboxHolder : public TextureLayer::TextureMailboxHolder { |
| 297 public: | 297 public: |
| 298 using TextureLayer::TextureMailboxHolder::Create; | 298 using TextureLayer::TextureMailboxHolder::Create; |
| 299 | 299 |
| 300 protected: | 300 protected: |
| 301 ~TestMailboxHolder() override {} | 301 ~TestMailboxHolder() override {} |
| 302 }; | 302 }; |
| 303 | 303 |
| 304 class TextureLayerWithMailboxTest : public TextureLayerTest { | 304 class TextureLayerWithMailboxTest : public TextureLayerTest { |
| 305 protected: | 305 protected: |
| 306 virtual void TearDown() { | 306 void TearDown() override { |
| 307 Mock::VerifyAndClearExpectations(&test_data_.mock_callback_); | 307 Mock::VerifyAndClearExpectations(&test_data_.mock_callback_); |
| 308 EXPECT_CALL(test_data_.mock_callback_, | 308 EXPECT_CALL(test_data_.mock_callback_, |
| 309 Release(test_data_.mailbox_name1_, | 309 Release(test_data_.mailbox_name1_, |
| 310 test_data_.sync_point1_, | 310 test_data_.sync_point1_, |
| 311 false)).Times(1); | 311 false)).Times(1); |
| 312 TextureLayerTest::TearDown(); | 312 TextureLayerTest::TearDown(); |
| 313 } | 313 } |
| 314 }; | 314 }; |
| 315 | 315 |
| 316 TEST_F(TextureLayerWithMailboxTest, ReplaceMailboxOnMainThreadBeforeCommit) { | 316 TEST_F(TextureLayerWithMailboxTest, ReplaceMailboxOnMainThreadBeforeCommit) { |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 | 922 |
| 923 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 923 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
| 924 TextureLayerMailboxIsActivatedDuringCommit); | 924 TextureLayerMailboxIsActivatedDuringCommit); |
| 925 | 925 |
| 926 class TextureLayerImplWithMailboxTest : public TextureLayerTest { | 926 class TextureLayerImplWithMailboxTest : public TextureLayerTest { |
| 927 protected: | 927 protected: |
| 928 TextureLayerImplWithMailboxTest() | 928 TextureLayerImplWithMailboxTest() |
| 929 : fake_client_( | 929 : fake_client_( |
| 930 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)) {} | 930 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)) {} |
| 931 | 931 |
| 932 virtual void SetUp() { | 932 void SetUp() override { |
| 933 TextureLayerTest::SetUp(); | 933 TextureLayerTest::SetUp(); |
| 934 layer_tree_host_.reset(new MockLayerTreeHost(&fake_client_)); | 934 layer_tree_host_.reset(new MockLayerTreeHost(&fake_client_)); |
| 935 EXPECT_TRUE(host_impl_.InitializeRenderer(FakeOutputSurface::Create3d())); | 935 EXPECT_TRUE(host_impl_.InitializeRenderer(FakeOutputSurface::Create3d())); |
| 936 } | 936 } |
| 937 | 937 |
| 938 bool WillDraw(TextureLayerImpl* layer, DrawMode mode) { | 938 bool WillDraw(TextureLayerImpl* layer, DrawMode mode) { |
| 939 bool will_draw = layer->WillDraw( | 939 bool will_draw = layer->WillDraw( |
| 940 mode, host_impl_.active_tree()->resource_provider()); | 940 mode, host_impl_.active_tree()->resource_provider()); |
| 941 if (will_draw) | 941 if (will_draw) |
| 942 layer->DidDraw(host_impl_.active_tree()->resource_provider()); | 942 layer->DidDraw(host_impl_.active_tree()->resource_provider()); |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1558 int callback_count_; | 1558 int callback_count_; |
| 1559 scoped_refptr<Layer> root_; | 1559 scoped_refptr<Layer> root_; |
| 1560 scoped_refptr<TextureLayer> layer_; | 1560 scoped_refptr<TextureLayer> layer_; |
| 1561 }; | 1561 }; |
| 1562 | 1562 |
| 1563 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1563 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
| 1564 TextureLayerWithMailboxImplThreadDeleted); | 1564 TextureLayerWithMailboxImplThreadDeleted); |
| 1565 | 1565 |
| 1566 } // namespace | 1566 } // namespace |
| 1567 } // namespace cc | 1567 } // namespace cc |
| OLD | NEW |