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

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

Issue 2449853004: Getting rid of DelegatedFrameData (Closed)
Patch Set: nit Created 4 years, 1 month 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_hittest.cc ('k') | cc/surfaces/surfaces_pixeltest.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "cc/output/compositor_frame.h" 7 #include "cc/output/compositor_frame.h"
8 #include "cc/surfaces/surface.h" 8 #include "cc/surfaces/surface.h"
9 #include "cc/surfaces/surface_factory.h" 9 #include "cc/surfaces/surface_factory.h"
10 #include "cc/surfaces/surface_factory_client.h" 10 #include "cc/surfaces/surface_factory_client.h"
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 } 391 }
392 392
393 TEST(SurfaceHittestTest, Hittest_RenderPassDrawQuad) { 393 TEST(SurfaceHittestTest, Hittest_RenderPassDrawQuad) {
394 SurfaceManager manager; 394 SurfaceManager manager;
395 EmptySurfaceFactoryClient client; 395 EmptySurfaceFactoryClient client;
396 FrameSinkId root_frame_sink_id(kArbitraryFrameSinkId); 396 FrameSinkId root_frame_sink_id(kArbitraryFrameSinkId);
397 SurfaceFactory factory(root_frame_sink_id, &manager, &client); 397 SurfaceFactory factory(root_frame_sink_id, &manager, &client);
398 398
399 // Create a CompostiorFrame with two RenderPasses. 399 // Create a CompostiorFrame with two RenderPasses.
400 gfx::Rect root_rect(300, 300); 400 gfx::Rect root_rect(300, 300);
401 RenderPassList render_pass_list; 401 CompositorFrame root_frame;
402 RenderPassList& render_pass_list = root_frame.render_pass_list;
402 403
403 // Create a child RenderPass. 404 // Create a child RenderPass.
404 RenderPassId child_render_pass_id(1, 3); 405 RenderPassId child_render_pass_id(1, 3);
405 gfx::Transform transform_to_root_target(1.0f, 0.0f, 0.0f, 50.0f, 406 gfx::Transform transform_to_root_target(1.0f, 0.0f, 0.0f, 50.0f,
406 0.0f, 1.0f, 0.0f, 50.0f, 407 0.0f, 1.0f, 0.0f, 50.0f,
407 0.0f, 0.0f, 1.0f, 0.0f, 408 0.0f, 0.0f, 1.0f, 0.0f,
408 0.0f, 0.0f, 0.0f, 1.0f); 409 0.0f, 0.0f, 0.0f, 1.0f);
409 CreateRenderPass(child_render_pass_id, 410 CreateRenderPass(child_render_pass_id,
410 gfx::Rect(100, 100), 411 gfx::Rect(100, 100),
411 transform_to_root_target, 412 transform_to_root_target,
412 &render_pass_list); 413 &render_pass_list);
413 414
414 // Create the root RenderPass. 415 // Create the root RenderPass.
415 RenderPassId root_render_pass_id(1, 2); 416 RenderPassId root_render_pass_id(1, 2);
416 CreateRenderPass(root_render_pass_id, root_rect, gfx::Transform(), 417 CreateRenderPass(root_render_pass_id, root_rect, gfx::Transform(),
417 &render_pass_list); 418 &render_pass_list);
418 419
419 RenderPass* root_pass = nullptr; 420 RenderPass* root_pass = nullptr;
420 CompositorFrame root_frame = 421 root_pass = root_frame.render_pass_list.back().get();
421 CreateCompositorFrameWithRenderPassList(&render_pass_list);
422 root_pass = root_frame.delegated_frame_data->render_pass_list.back().get();
423 422
424 // Create a RenderPassDrawQuad. 423 // Create a RenderPassDrawQuad.
425 gfx::Rect render_pass_quad_rect(100, 100); 424 gfx::Rect render_pass_quad_rect(100, 100);
426 CreateRenderPassDrawQuad(root_pass, 425 CreateRenderPassDrawQuad(root_pass,
427 transform_to_root_target, 426 transform_to_root_target,
428 root_rect, 427 root_rect,
429 render_pass_quad_rect, 428 render_pass_quad_rect,
430 child_render_pass_id); 429 child_render_pass_id);
431 430
432 // Add a solid quad in the child render pass. 431 // Add a solid quad in the child render pass.
433 RenderPass* child_render_pass = 432 RenderPass* child_render_pass = root_frame.render_pass_list.front().get();
434 root_frame.delegated_frame_data->render_pass_list.front().get();
435 gfx::Rect child_solid_quad_rect(100, 100); 433 gfx::Rect child_solid_quad_rect(100, 100);
436 CreateSolidColorDrawQuad(child_render_pass, 434 CreateSolidColorDrawQuad(child_render_pass,
437 gfx::Transform(), 435 gfx::Transform(),
438 gfx::Rect(100, 100), 436 gfx::Rect(100, 100),
439 child_solid_quad_rect); 437 child_solid_quad_rect);
440 438
441 // Submit the root frame. 439 // Submit the root frame.
442 SurfaceIdAllocator root_allocator; 440 SurfaceIdAllocator root_allocator;
443 LocalFrameId root_local_frame_id = root_allocator.GenerateId(); 441 LocalFrameId root_local_frame_id = root_allocator.GenerateId();
444 SurfaceId root_surface_id(root_frame_sink_id, root_local_frame_id); 442 SurfaceId root_surface_id(root_frame_sink_id, root_local_frame_id);
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 625
628 // Verify that insets have affected hit targeting. 626 // Verify that insets have affected hit targeting.
629 EXPECT_EQ(0, accept_delegate.reject_target_overrides()); 627 EXPECT_EQ(0, accept_delegate.reject_target_overrides());
630 EXPECT_EQ(2, accept_delegate.accept_target_overrides()); 628 EXPECT_EQ(2, accept_delegate.accept_target_overrides());
631 629
632 root_factory.Destroy(root_local_frame_id); 630 root_factory.Destroy(root_local_frame_id);
633 child_factory.Destroy(child_local_frame_id); 631 child_factory.Destroy(child_local_frame_id);
634 } 632 }
635 633
636 } // namespace cc 634 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface_hittest.cc ('k') | cc/surfaces/surfaces_pixeltest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698