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

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

Issue 1304063014: cc: Plumbing for BeginFrameSource based on Surfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix webview Created 5 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/surfaces/surface_unittest.cc ('k') | components/mus/surfaces/top_level_display_client.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,
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 {}
27 }; 35 };
28 36
29 class SurfacesPixelTest : public RendererPixelTest<GLRenderer> { 37 class SurfacesPixelTest : public RendererPixelTest<GLRenderer> {
30 public: 38 public:
31 SurfacesPixelTest() : allocator_(1u), factory_(&manager_, &client_) {} 39 SurfacesPixelTest() : allocator_(1u), factory_(&manager_, &client_) {}
32 40
33 protected: 41 protected:
34 SurfaceManager manager_; 42 SurfaceManager manager_;
35 SurfaceIdAllocator allocator_; 43 SurfaceIdAllocator allocator_;
36 EmptySurfaceFactoryClient client_; 44 EmptySurfaceFactoryClient client_;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 delegated_frame_data->render_pass_list.push_back(pass.Pass()); 84 delegated_frame_data->render_pass_list.push_back(pass.Pass());
77 85
78 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame); 86 scoped_ptr<CompositorFrame> root_frame(new CompositorFrame);
79 root_frame->delegated_frame_data = delegated_frame_data.Pass(); 87 root_frame->delegated_frame_data = delegated_frame_data.Pass();
80 88
81 SurfaceId root_surface_id = allocator_.GenerateId(); 89 SurfaceId root_surface_id = allocator_.GenerateId();
82 factory_.Create(root_surface_id); 90 factory_.Create(root_surface_id);
83 factory_.SubmitCompositorFrame(root_surface_id, root_frame.Pass(), 91 factory_.SubmitCompositorFrame(root_surface_id, root_frame.Pass(),
84 SurfaceFactory::DrawCallback()); 92 SurfaceFactory::DrawCallback());
85 93
86 SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true); 94 EmptySurfaceAggregatorClient surface_aggregator_client;
95 SurfaceAggregator aggregator(&surface_aggregator_client, &manager_,
96 resource_provider_.get(), true);
87 scoped_ptr<CompositorFrame> aggregated_frame = 97 scoped_ptr<CompositorFrame> aggregated_frame =
88 aggregator.Aggregate(root_surface_id); 98 aggregator.Aggregate(root_surface_id);
89 factory_.Destroy(root_surface_id); 99 factory_.Destroy(root_surface_id);
90 100
91 bool discard_alpha = false; 101 bool discard_alpha = false;
92 ExactPixelComparator pixel_comparator(discard_alpha); 102 ExactPixelComparator pixel_comparator(discard_alpha);
93 RenderPassList* pass_list = 103 RenderPassList* pass_list =
94 &aggregated_frame->delegated_frame_data->render_pass_list; 104 &aggregated_frame->delegated_frame_data->render_pass_list;
95 EXPECT_TRUE(RunPixelTest(pass_list, 105 EXPECT_TRUE(RunPixelTest(pass_list,
96 base::FilePath(FILE_PATH_LITERAL("green.png")), 106 base::FilePath(FILE_PATH_LITERAL("green.png")),
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); 170 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData);
161 delegated_frame_data->render_pass_list.push_back(pass.Pass()); 171 delegated_frame_data->render_pass_list.push_back(pass.Pass());
162 172
163 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); 173 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame);
164 child_frame->delegated_frame_data = delegated_frame_data.Pass(); 174 child_frame->delegated_frame_data = delegated_frame_data.Pass();
165 175
166 factory_.SubmitCompositorFrame(child_surface_id, child_frame.Pass(), 176 factory_.SubmitCompositorFrame(child_surface_id, child_frame.Pass(),
167 SurfaceFactory::DrawCallback()); 177 SurfaceFactory::DrawCallback());
168 } 178 }
169 179
170 SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true); 180 EmptySurfaceAggregatorClient surface_aggregator_client;
181 SurfaceAggregator aggregator(&surface_aggregator_client, &manager_,
182 resource_provider_.get(), true);
171 scoped_ptr<CompositorFrame> aggregated_frame = 183 scoped_ptr<CompositorFrame> aggregated_frame =
172 aggregator.Aggregate(root_surface_id); 184 aggregator.Aggregate(root_surface_id);
173 185
174 bool discard_alpha = false; 186 bool discard_alpha = false;
175 ExactPixelComparator pixel_comparator(discard_alpha); 187 ExactPixelComparator pixel_comparator(discard_alpha);
176 RenderPassList* pass_list = 188 RenderPassList* pass_list =
177 &aggregated_frame->delegated_frame_data->render_pass_list; 189 &aggregated_frame->delegated_frame_data->render_pass_list;
178 EXPECT_TRUE(RunPixelTest(pass_list, 190 EXPECT_TRUE(RunPixelTest(pass_list,
179 base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")), 191 base::FilePath(FILE_PATH_LITERAL("blue_yellow.png")),
180 pixel_comparator)); 192 pixel_comparator));
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); 315 scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData);
304 delegated_frame_data->render_pass_list.push_back(pass.Pass()); 316 delegated_frame_data->render_pass_list.push_back(pass.Pass());
305 317
306 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame); 318 scoped_ptr<CompositorFrame> child_frame(new CompositorFrame);
307 child_frame->delegated_frame_data = delegated_frame_data.Pass(); 319 child_frame->delegated_frame_data = delegated_frame_data.Pass();
308 320
309 factory_.SubmitCompositorFrame(right_child_id, child_frame.Pass(), 321 factory_.SubmitCompositorFrame(right_child_id, child_frame.Pass(),
310 SurfaceFactory::DrawCallback()); 322 SurfaceFactory::DrawCallback());
311 } 323 }
312 324
313 SurfaceAggregator aggregator(&manager_, resource_provider_.get(), true); 325 EmptySurfaceAggregatorClient surface_aggregator_client;
326 SurfaceAggregator aggregator(&surface_aggregator_client, &manager_,
327 resource_provider_.get(), true);
314 scoped_ptr<CompositorFrame> aggregated_frame = 328 scoped_ptr<CompositorFrame> aggregated_frame =
315 aggregator.Aggregate(root_surface_id); 329 aggregator.Aggregate(root_surface_id);
316 330
317 bool discard_alpha = false; 331 bool discard_alpha = false;
318 ExactPixelComparator pixel_comparator(discard_alpha); 332 ExactPixelComparator pixel_comparator(discard_alpha);
319 RenderPassList* pass_list = 333 RenderPassList* pass_list =
320 &aggregated_frame->delegated_frame_data->render_pass_list; 334 &aggregated_frame->delegated_frame_data->render_pass_list;
321 EXPECT_TRUE(RunPixelTest( 335 EXPECT_TRUE(RunPixelTest(
322 pass_list, 336 pass_list,
323 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), 337 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")),
324 pixel_comparator)); 338 pixel_comparator));
325 339
326 factory_.Destroy(root_surface_id); 340 factory_.Destroy(root_surface_id);
327 factory_.Destroy(left_child_id); 341 factory_.Destroy(left_child_id);
328 factory_.Destroy(right_child_id); 342 factory_.Destroy(right_child_id);
329 } 343 }
330 344
331 } // namespace 345 } // namespace
332 } // namespace cc 346 } // namespace cc
333 347
334 #endif // !defined(OS_ANDROID) 348 #endif // !defined(OS_ANDROID)
OLDNEW
« no previous file with comments | « cc/surfaces/surface_unittest.cc ('k') | components/mus/surfaces/top_level_display_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698