Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: cc/layers/texture_layer_unittest.cc

Issue 1336733002: Re-land: cc: Implement shared worker contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: shutdown fix Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 class TextureLayerImplWithMailboxTest : public TextureLayerTest { 877 class TextureLayerImplWithMailboxTest : public TextureLayerTest {
876 protected: 878 protected:
877 TextureLayerImplWithMailboxTest() 879 TextureLayerImplWithMailboxTest()
878 : fake_client_( 880 : fake_client_(
879 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)) {} 881 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)) {}
880 882
881 void SetUp() override { 883 void SetUp() override {
882 TextureLayerTest::SetUp(); 884 TextureLayerTest::SetUp();
883 layer_tree_host_ = 885 layer_tree_host_ =
884 MockLayerTreeHost::Create(&fake_client_, &task_graph_runner_); 886 MockLayerTreeHost::Create(&fake_client_, &task_graph_runner_);
885 EXPECT_TRUE(host_impl_.InitializeRenderer(FakeOutputSurface::Create3d())); 887 EXPECT_TRUE(host_impl_.InitializeRenderer(output_surface_.get()));
886 } 888 }
887 889
888 bool WillDraw(TextureLayerImpl* layer, DrawMode mode) { 890 bool WillDraw(TextureLayerImpl* layer, DrawMode mode) {
889 bool will_draw = layer->WillDraw( 891 bool will_draw = layer->WillDraw(
890 mode, host_impl_.active_tree()->resource_provider()); 892 mode, host_impl_.active_tree()->resource_provider());
891 if (will_draw) 893 if (will_draw)
892 layer->DidDraw(host_impl_.active_tree()->resource_provider()); 894 layer->DidDraw(host_impl_.active_tree()->resource_provider());
893 return will_draw; 895 return will_draw;
894 } 896 }
895 897
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 int callback_count_; 1507 int callback_count_;
1506 scoped_refptr<Layer> root_; 1508 scoped_refptr<Layer> root_;
1507 scoped_refptr<TextureLayer> layer_; 1509 scoped_refptr<TextureLayer> layer_;
1508 }; 1510 };
1509 1511
1510 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 1512 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
1511 TextureLayerWithMailboxImplThreadDeleted); 1513 TextureLayerWithMailboxImplThreadDeleted);
1512 1514
1513 } // namespace 1515 } // namespace
1514 } // namespace cc 1516 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698