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

Side by Side Diff: cc/surfaces/surfaces_pixeltest.cc

Issue 1673783004: Hook up BeginFrameSource to SurfaceFactoryClient via SurfaceManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Register id namespace on Android Created 4 years, 9 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/surfaces/surface_unittest.cc ('k') | cc/test/surface_hittest_test_helpers.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/output/compositor_frame.h" 5 #include "cc/output/compositor_frame.h"
6 #include "cc/quads/render_pass.h" 6 #include "cc/quads/render_pass.h"
7 #include "cc/quads/solid_color_draw_quad.h" 7 #include "cc/quads/solid_color_draw_quad.h"
8 #include "cc/quads/surface_draw_quad.h" 8 #include "cc/quads/surface_draw_quad.h"
9 #include "cc/surfaces/surface.h" 9 #include "cc/surfaces/surface.h"
10 #include "cc/surfaces/surface_aggregator.h" 10 #include "cc/surfaces/surface_aggregator.h"
11 #include "cc/surfaces/surface_factory.h" 11 #include "cc/surfaces/surface_factory.h"
12 #include "cc/surfaces/surface_factory_client.h" 12 #include "cc/surfaces/surface_factory_client.h"
13 #include "cc/surfaces/surface_id_allocator.h" 13 #include "cc/surfaces/surface_id_allocator.h"
14 #include "cc/surfaces/surface_manager.h" 14 #include "cc/surfaces/surface_manager.h"
15 #include "cc/test/pixel_comparator.h" 15 #include "cc/test/pixel_comparator.h"
16 #include "cc/test/pixel_test.h" 16 #include "cc/test/pixel_test.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 #if !defined(OS_ANDROID) 19 #if !defined(OS_ANDROID)
20 20
21 namespace cc { 21 namespace cc {
22 namespace { 22 namespace {
23 23
24 class EmptySurfaceFactoryClient : public SurfaceFactoryClient { 24 class EmptySurfaceFactoryClient : public SurfaceFactoryClient {
25 public: 25 public:
26 void ReturnResources(const ReturnedResourceArray& resources) override {} 26 void ReturnResources(const ReturnedResourceArray& resources) override {}
27 void SetBeginFrameSource(SurfaceId surface_id, 27 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override {}
28 BeginFrameSource* begin_frame_source) override {}
29 };
30
31 class EmptySurfaceAggregatorClient : public SurfaceAggregatorClient {
32 public:
33 void AddSurface(Surface* surface) override {}
34 void RemoveSurface(Surface* surface) override {}
35 }; 28 };
36 29
37 class SurfacesPixelTest : public RendererPixelTest<GLRenderer> { 30 class SurfacesPixelTest : public RendererPixelTest<GLRenderer> {
38 public: 31 public:
39 SurfacesPixelTest() : allocator_(1u), factory_(&manager_, &client_) {} 32 SurfacesPixelTest() : allocator_(1u), factory_(&manager_, &client_) {}
40 33
41 protected: 34 protected:
42 SurfaceManager manager_; 35 SurfaceManager manager_;
43 SurfaceIdAllocator allocator_; 36 SurfaceIdAllocator allocator_;
44 EmptySurfaceFactoryClient client_; 37 EmptySurfaceFactoryClient client_;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 delegated_frame_data->render_pass_list.push_back(std::move(pass)); 77 delegated_frame_data->render_pass_list.push_back(std::move(pass));
85 78
86 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); 79 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame);
87 root_frame->delegated_frame_data = std::move(delegated_frame_data); 80 root_frame->delegated_frame_data = std::move(delegated_frame_data);
88 81
89 SurfaceId root_surface_id = allocator_.GenerateId(); 82 SurfaceId root_surface_id = allocator_.GenerateId();
90 factory_.Create(root_surface_id); 83 factory_.Create(root_surface_id);
91 factory_.SubmitCompositorFrame(root_surface_id, std::move(root_frame), 84 factory_.SubmitCompositorFrame(root_surface_id, std::move(root_frame),
92 SurfaceFactory::DrawCallback()); 85 SurfaceFactory::DrawCallback());
93 86
94 EmptySurfaceAggregatorClient surface_aggregator_client; 87 SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true);
95 SurfaceAggregator aggregator(&surface_aggregator_client, &manager_,
96 resource_provider_.get(), true);
97 scoped_ptr<CompositorFrame> aggregated_frame = 88 scoped_ptr<CompositorFrame> aggregated_frame =
98 aggregator.Aggregate(root_surface_id); 89 aggregator.Aggregate(root_surface_id);
99 factory_.Destroy(root_surface_id); 90 factory_.Destroy(root_surface_id);
100 91
101 bool discard_alpha = false; 92 bool discard_alpha = false;
102 ExactPixelComparator pixel_comparator(discard_alpha); 93 ExactPixelComparator pixel_comparator(discard_alpha);
103 RenderPassList* pass_list = 94 RenderPassList* pass_list =
104 &aggregated_frame->delegated_frame_data->render_pass_list; 95 &aggregated_frame->delegated_frame_data->render_pass_list;
105 EXPECT_TRUE(RunPixelTest(pass_list, 96 EXPECT_TRUE(RunPixelTest(pass_list,
106 base::FilePath(FILE_PATH_LITERAL("green.png")), 97 base::FilePath(FILE_PATH_LITERAL("green.png")),
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); 161 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData);
171 delegated_frame_data->render_pass_list.push_back(std::move(pass)); 162 delegated_frame_data->render_pass_list.push_back(std::move(pass));
172 163
173 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); 164 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame);
174 child_frame->delegated_frame_data = std::move(delegated_frame_data); 165 child_frame->delegated_frame_data = std::move(delegated_frame_data);
175 166
176 factory_.SubmitCompositorFrame(child_surface_id, std::move(child_frame), 167 factory_.SubmitCompositorFrame(child_surface_id, std::move(child_frame),
177 SurfaceFactory::DrawCallback()); 168 SurfaceFactory::DrawCallback());
178 } 169 }
179 170
180 EmptySurfaceAggregatorClient surface_aggregator_client; 171 SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true);
181 SurfaceAggregator aggregator(&surface_aggregator_client, &manager_,
182 resource_provider_.get(), true);
183 scoped_ptr<CompositorFrame> aggregated_frame = 172 scoped_ptr<CompositorFrame> aggregated_frame =
184 aggregator.Aggregate(root_surface_id); 173 aggregator.Aggregate(root_surface_id);
185 174
186 bool discard_alpha = false; 175 bool discard_alpha = false;
187 ExactPixelComparator pixel_comparator(discard_alpha); 176 ExactPixelComparator pixel_comparator(discard_alpha);
188 RenderPassList* pass_list = 177 RenderPassList* pass_list =
189 &aggregated_frame->delegated_frame_data->render_pass_list; 178 &aggregated_frame->delegated_frame_data->render_pass_list;
190 EXPECT_TRUE(RunPixelTest(pass_list, 179 EXPECT_TRUE(RunPixelTest(pass_list,
191 base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")), 180 base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")),
192 pixel_comparator)); 181 pixel_comparator));
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); 304 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData);
316 delegated_frame_data->render_pass_list.push_back(std::move(pass)); 305 delegated_frame_data->render_pass_list.push_back(std::move(pass));
317 306
318 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); 307 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame);
319 child_frame->delegated_frame_data = std::move(delegated_frame_data); 308 child_frame->delegated_frame_data = std::move(delegated_frame_data);
320 309
321 factory_.SubmitCompositorFrame(right_child_id, std::move(child_frame), 310 factory_.SubmitCompositorFrame(right_child_id, std::move(child_frame),
322 SurfaceFactory::DrawCallback()); 311 SurfaceFactory::DrawCallback());
323 } 312 }
324 313
325 EmptySurfaceAggregatorClient surface_aggregator_client; 314 SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true);
326 SurfaceAggregator aggregator(&surface_aggregator_client, &manager_,
327 resource_provider_.get(), true);
328 scoped_ptr<CompositorFrame> aggregated_frame = 315 scoped_ptr<CompositorFrame> aggregated_frame =
329 aggregator.Aggregate(root_surface_id); 316 aggregator.Aggregate(root_surface_id);
330 317
331 bool discard_alpha = false; 318 bool discard_alpha = false;
332 ExactPixelComparator pixel_comparator(discard_alpha); 319 ExactPixelComparator pixel_comparator(discard_alpha);
333 RenderPassList* pass_list = 320 RenderPassList* pass_list =
334 &aggregated_frame->delegated_frame_data->render_pass_list; 321 &aggregated_frame->delegated_frame_data->render_pass_list;
335 EXPECT_TRUE(RunPixelTest( 322 EXPECT_TRUE(RunPixelTest(
336 pass_list, 323 pass_list,
337 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), 324 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")),
338 pixel_comparator)); 325 pixel_comparator));
339 326
340 factory_.Destroy(root_surface_id); 327 factory_.Destroy(root_surface_id);
341 factory_.Destroy(left_child_id); 328 factory_.Destroy(left_child_id);
342 factory_.Destroy(right_child_id); 329 factory_.Destroy(right_child_id);
343 } 330 }
344 331
345 } // namespace 332 } // namespace
346 } // namespace cc 333 } // namespace cc
347 334
348 #endif // !defined(OS_ANDROID) 335 #endif // !defined(OS_ANDROID)
OLDNEW
« no previous file with comments | « cc/surfaces/surface_unittest.cc ('k') | cc/test/surface_hittest_test_helpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698