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

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

Issue 608503005: Revert of cc: Remove use of PassAs() and constructor-casting with scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « cc/layers/texture_layer_impl.cc ('k') | cc/layers/tiled_layer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); 178 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber());
179 layer_tree_host_->SetViewportSize(gfx::Size(10, 10)); 179 layer_tree_host_->SetViewportSize(gfx::Size(10, 10));
180 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); 180 Mock::VerifyAndClearExpectations(layer_tree_host_.get());
181 } 181 }
182 182
183 virtual void TearDown() { 183 virtual void TearDown() {
184 Mock::VerifyAndClearExpectations(layer_tree_host_.get()); 184 Mock::VerifyAndClearExpectations(layer_tree_host_.get());
185 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber()); 185 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(AnyNumber());
186 186
187 layer_tree_host_->SetRootLayer(NULL); 187 layer_tree_host_->SetRootLayer(NULL);
188 layer_tree_host_ = nullptr; 188 layer_tree_host_.reset();
189 } 189 }
190 190
191 scoped_ptr<MockLayerTreeHost> layer_tree_host_; 191 scoped_ptr<MockLayerTreeHost> layer_tree_host_;
192 FakeImplProxy proxy_; 192 FakeImplProxy proxy_;
193 FakeLayerTreeHostClient fake_client_; 193 FakeLayerTreeHostClient fake_client_;
194 TestSharedBitmapManager shared_bitmap_manager_; 194 TestSharedBitmapManager shared_bitmap_manager_;
195 FakeLayerTreeHostImpl host_impl_; 195 FakeLayerTreeHostImpl host_impl_;
196 }; 196 };
197 197
198 TEST_F(TextureLayerTest, CheckPropertyChangeCausesCorrectBehavior) { 198 TEST_F(TextureLayerTest, CheckPropertyChangeCausesCorrectBehavior) {
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&event))); 415 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&event)));
416 event.Wait(); 416 event.Wait();
417 } 417 }
418 418
419 void CreateMainRef() { 419 void CreateMainRef() {
420 main_ref_ = TestMailboxHolder::Create( 420 main_ref_ = TestMailboxHolder::Create(
421 test_data_.mailbox1_, 421 test_data_.mailbox1_,
422 SingleReleaseCallback::Create(test_data_.release_mailbox1_)).Pass(); 422 SingleReleaseCallback::Create(test_data_.release_mailbox1_)).Pass();
423 } 423 }
424 424
425 void ReleaseMainRef() { main_ref_ = nullptr; } 425 void ReleaseMainRef() {
426 main_ref_.reset();
427 }
426 428
427 void CreateImplRef(scoped_ptr<SingleReleaseCallbackImpl>* impl_ref) { 429 void CreateImplRef(scoped_ptr<SingleReleaseCallbackImpl>* impl_ref) {
428 *impl_ref = main_ref_->holder()->GetCallbackForImplThread(); 430 *impl_ref = main_ref_->holder()->GetCallbackForImplThread();
429 } 431 }
430 432
431 void CapturePostTasksAndWait(base::WaitableEvent* begin_capture, 433 void CapturePostTasksAndWait(base::WaitableEvent* begin_capture,
432 base::WaitableEvent* wait_for_capture, 434 base::WaitableEvent* wait_for_capture,
433 base::WaitableEvent* stop_capture) { 435 base::WaitableEvent* stop_capture) {
434 begin_capture->Wait(); 436 begin_capture->Wait();
435 BlockingTaskRunner::CapturePostTasks capture( 437 BlockingTaskRunner::CapturePostTasks capture(
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 925
924 class TextureLayerImplWithMailboxTest : public TextureLayerTest { 926 class TextureLayerImplWithMailboxTest : public TextureLayerTest {
925 protected: 927 protected:
926 TextureLayerImplWithMailboxTest() 928 TextureLayerImplWithMailboxTest()
927 : fake_client_( 929 : fake_client_(
928 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)) {} 930 FakeLayerTreeHostClient(FakeLayerTreeHostClient::DIRECT_3D)) {}
929 931
930 virtual void SetUp() { 932 virtual void SetUp() {
931 TextureLayerTest::SetUp(); 933 TextureLayerTest::SetUp();
932 layer_tree_host_.reset(new MockLayerTreeHost(&fake_client_)); 934 layer_tree_host_.reset(new MockLayerTreeHost(&fake_client_));
933 EXPECT_TRUE(host_impl_.InitializeRenderer(FakeOutputSurface::Create3d())); 935 EXPECT_TRUE(host_impl_.InitializeRenderer(
936 FakeOutputSurface::Create3d().PassAs<OutputSurface>()));
934 } 937 }
935 938
936 bool WillDraw(TextureLayerImpl* layer, DrawMode mode) { 939 bool WillDraw(TextureLayerImpl* layer, DrawMode mode) {
937 bool will_draw = layer->WillDraw( 940 bool will_draw = layer->WillDraw(
938 mode, host_impl_.active_tree()->resource_provider()); 941 mode, host_impl_.active_tree()->resource_provider());
939 if (will_draw) 942 if (will_draw)
940 layer->DidDraw(host_impl_.active_tree()->resource_provider()); 943 layer->DidDraw(host_impl_.active_tree()->resource_provider());
941 return will_draw; 944 return will_draw;
942 } 945 }
943 946
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 int callback_count_; 1578 int callback_count_;
1576 scoped_refptr<Layer> root_; 1579 scoped_refptr<Layer> root_;
1577 scoped_refptr<TextureLayer> layer_; 1580 scoped_refptr<TextureLayer> layer_;
1578 }; 1581 };
1579 1582
1580 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 1583 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
1581 TextureLayerWithMailboxImplThreadDeleted); 1584 TextureLayerWithMailboxImplThreadDeleted);
1582 1585
1583 } // namespace 1586 } // namespace
1584 } // namespace cc 1587 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/texture_layer_impl.cc ('k') | cc/layers/tiled_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698