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

Side by Side Diff: cc/trees/layer_tree_host_unittest_copyrequest.cc

Issue 2140383005: cc: Decouple LayerTreeTests from FakeOutputSurface expectations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@novirtualswapbuffers
Patch Set: layertreetest-outputsurface: more-more-more-android Created 4 years, 5 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/trees/layer_tree_host_unittest_context.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); 119 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread());
120 EXPECT_TRUE(result->HasBitmap()); 120 EXPECT_TRUE(result->HasBitmap());
121 std::unique_ptr<SkBitmap> bitmap = result->TakeBitmap(); 121 std::unique_ptr<SkBitmap> bitmap = result->TakeBitmap();
122 EXPECT_EQ(result->size().ToString(), 122 EXPECT_EQ(result->size().ToString(),
123 gfx::Size(bitmap->width(), bitmap->height()).ToString()); 123 gfx::Size(bitmap->width(), bitmap->height()).ToString());
124 callbacks_[id] = result->size(); 124 callbacks_[id] = result->size();
125 } 125 }
126 126
127 void AfterTest() override { EXPECT_EQ(4u, callbacks_.size()); } 127 void AfterTest() override { EXPECT_EQ(4u, callbacks_.size()); }
128 128
129 std::unique_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { 129 std::unique_ptr<OutputSurface> CreateOutputSurface() override {
130 if (!use_gl_renderer_) { 130 if (!use_gl_renderer_) {
131 return FakeOutputSurface::CreateSoftware( 131 return FakeOutputSurface::CreateSoftware(
132 base::WrapUnique(new SoftwareOutputDevice)); 132 base::WrapUnique(new SoftwareOutputDevice));
133 } 133 }
134 std::unique_ptr<FakeOutputSurface> output_surface = 134 std::unique_ptr<FakeOutputSurface> output_surface =
135 FakeOutputSurface::Create3d(); 135 FakeOutputSurface::Create3d();
136 TestContextSupport* context_support = static_cast<TestContextSupport*>( 136 TestContextSupport* context_support = static_cast<TestContextSupport*>(
137 output_surface->context_provider()->ContextSupport()); 137 output_surface->context_provider()->ContextSupport());
138 context_support->set_out_of_order_callbacks(out_of_order_callbacks_); 138 context_support->set_out_of_order_callbacks(out_of_order_callbacks_);
139 return output_surface; 139 return std::move(output_surface);
140 } 140 }
141 141
142 bool use_gl_renderer_; 142 bool use_gl_renderer_;
143 bool out_of_order_callbacks_ = false; 143 bool out_of_order_callbacks_ = false;
144 std::map<size_t, gfx::Size> callbacks_; 144 std::map<size_t, gfx::Size> callbacks_;
145 FakeContentLayerClient client_; 145 FakeContentLayerClient client_;
146 scoped_refptr<FakePictureLayer> root; 146 scoped_refptr<FakePictureLayer> root;
147 scoped_refptr<FakePictureLayer> child; 147 scoped_refptr<FakePictureLayer> child;
148 scoped_refptr<FakePictureLayer> grand_child; 148 scoped_refptr<FakePictureLayer> grand_child;
149 }; 149 };
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 scoped_refptr<FakePictureLayer> root_; 701 scoped_refptr<FakePictureLayer> root_;
702 scoped_refptr<FakePictureLayer> copy_layer_; 702 scoped_refptr<FakePictureLayer> copy_layer_;
703 }; 703 };
704 704
705 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 705 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
706 LayerTreeHostTestAsyncTwoReadbacksWithoutDraw); 706 LayerTreeHostTestAsyncTwoReadbacksWithoutDraw);
707 707
708 class LayerTreeHostCopyRequestTestLostOutputSurface 708 class LayerTreeHostCopyRequestTestLostOutputSurface
709 : public LayerTreeHostCopyRequestTest { 709 : public LayerTreeHostCopyRequestTest {
710 protected: 710 protected:
711 std::unique_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { 711 std::unique_ptr<OutputSurface> CreateOutputSurface() override {
712 if (!first_context_provider_) { 712 if (!first_context_provider_) {
713 first_context_provider_ = TestContextProvider::Create(); 713 first_context_provider_ = TestContextProvider::Create();
714 return FakeOutputSurface::Create3d(first_context_provider_); 714 return FakeOutputSurface::Create3d(first_context_provider_);
715 } 715 }
716 716
717 EXPECT_FALSE(second_context_provider_); 717 EXPECT_FALSE(second_context_provider_);
718 second_context_provider_ = TestContextProvider::Create(); 718 second_context_provider_ = TestContextProvider::Create();
719 return FakeOutputSurface::Create3d(second_context_provider_); 719 return FakeOutputSurface::Create3d(second_context_provider_);
720 } 720 }
721 721
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 scoped_refptr<FakePictureLayer> copy_layer_; 837 scoped_refptr<FakePictureLayer> copy_layer_;
838 std::unique_ptr<CopyOutputResult> result_; 838 std::unique_ptr<CopyOutputResult> result_;
839 }; 839 };
840 840
841 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 841 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
842 LayerTreeHostCopyRequestTestLostOutputSurface); 842 LayerTreeHostCopyRequestTestLostOutputSurface);
843 843
844 class LayerTreeHostCopyRequestTestCountTextures 844 class LayerTreeHostCopyRequestTestCountTextures
845 : public LayerTreeHostCopyRequestTest { 845 : public LayerTreeHostCopyRequestTest {
846 protected: 846 protected:
847 std::unique_ptr<FakeOutputSurface> CreateFakeOutputSurface() override { 847 std::unique_ptr<OutputSurface> CreateOutputSurface() override {
848 context_provider_ = TestContextProvider::Create(); 848 context_provider_ = TestContextProvider::Create();
849 return FakeOutputSurface::Create3d(context_provider_); 849 return FakeOutputSurface::Create3d(context_provider_);
850 } 850 }
851 851
852 void SetupTree() override { 852 void SetupTree() override {
853 client_.set_fill_with_nonsolid_color(true); 853 client_.set_fill_with_nonsolid_color(true);
854 854
855 root_ = FakePictureLayer::Create(&client_); 855 root_ = FakePictureLayer::Create(&client_);
856 root_->SetBounds(gfx::Size(20, 20)); 856 root_->SetBounds(gfx::Size(20, 20));
857 857
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 int num_draws_; 1268 int num_draws_;
1269 bool copy_happened_; 1269 bool copy_happened_;
1270 bool draw_happened_; 1270 bool draw_happened_;
1271 }; 1271 };
1272 1272
1273 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 1273 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
1274 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest); 1274 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest);
1275 1275
1276 } // namespace 1276 } // namespace
1277 } // namespace cc 1277 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_context.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698