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

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

Issue 2835393003: Reject frames with invalid BeginFrameAck in CompositorFrameSinkSupport (Closed)
Patch Set: Fixed header Created 3 years, 7 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
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/compositor_frame_sink_support.h" 8 #include "cc/surfaces/compositor_frame_sink_support.h"
9 #include "cc/surfaces/local_surface_id_allocator.h" 9 #include "cc/surfaces/local_surface_id_allocator.h"
10 #include "cc/surfaces/surface.h" 10 #include "cc/surfaces/surface.h"
11 #include "cc/surfaces/surface_hittest.h" 11 #include "cc/surfaces/surface_hittest.h"
12 #include "cc/surfaces/surface_manager.h" 12 #include "cc/surfaces/surface_manager.h"
13 #include "cc/test/compositor_frame_helpers.h"
13 #include "cc/test/surface_hittest_test_helpers.h" 14 #include "cc/test/surface_hittest_test_helpers.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 #include "third_party/skia/include/core/SkColor.h" 16 #include "third_party/skia/include/core/SkColor.h"
16 #include "ui/gfx/geometry/size.h" 17 #include "ui/gfx/geometry/size.h"
17 18
18 namespace cc { 19 namespace cc {
19 20
20 namespace { 21 namespace {
21 22
22 constexpr FrameSinkId kArbitraryFrameSinkId(1, 1); 23 constexpr FrameSinkId kArbitraryFrameSinkId(1, 1);
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 TEST(SurfaceHittestTest, Hittest_RenderPassDrawQuad) { 399 TEST(SurfaceHittestTest, Hittest_RenderPassDrawQuad) {
399 SurfaceManager manager; 400 SurfaceManager manager;
400 FrameSinkId root_frame_sink_id(kArbitraryFrameSinkId); 401 FrameSinkId root_frame_sink_id(kArbitraryFrameSinkId);
401 std::unique_ptr<CompositorFrameSinkSupport> support = 402 std::unique_ptr<CompositorFrameSinkSupport> support =
402 CompositorFrameSinkSupport::Create( 403 CompositorFrameSinkSupport::Create(
403 nullptr, &manager, root_frame_sink_id, kIsRoot, 404 nullptr, &manager, root_frame_sink_id, kIsRoot,
404 kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints); 405 kHandlesFrameSinkIdInvalidation, kNeedsSyncPoints);
405 406
406 // Create a CompostiorFrame with two RenderPasses. 407 // Create a CompostiorFrame with two RenderPasses.
407 gfx::Rect root_rect(300, 300); 408 gfx::Rect root_rect(300, 300);
408 CompositorFrame root_frame; 409 CompositorFrame root_frame = test::MakeCompositorFrame();
409 RenderPassList& render_pass_list = root_frame.render_pass_list; 410 RenderPassList& render_pass_list = root_frame.render_pass_list;
410 411
411 // Create a child RenderPass. 412 // Create a child RenderPass.
412 int child_render_pass_id = 3; 413 int child_render_pass_id = 3;
413 gfx::Transform transform_to_root_target(1.0f, 0.0f, 0.0f, 50.0f, 414 gfx::Transform transform_to_root_target(1.0f, 0.0f, 0.0f, 50.0f,
414 0.0f, 1.0f, 0.0f, 50.0f, 415 0.0f, 1.0f, 0.0f, 50.0f,
415 0.0f, 0.0f, 1.0f, 0.0f, 416 0.0f, 0.0f, 1.0f, 0.0f,
416 0.0f, 0.0f, 0.0f, 1.0f); 417 0.0f, 0.0f, 0.0f, 1.0f);
417 CreateRenderPass(child_render_pass_id, 418 CreateRenderPass(child_render_pass_id,
418 gfx::Rect(100, 100), 419 gfx::Rect(100, 100),
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 632
632 // Verify that insets have affected hit targeting. 633 // Verify that insets have affected hit targeting.
633 EXPECT_EQ(0, accept_delegate.reject_target_overrides()); 634 EXPECT_EQ(0, accept_delegate.reject_target_overrides());
634 EXPECT_EQ(2, accept_delegate.accept_target_overrides()); 635 EXPECT_EQ(2, accept_delegate.accept_target_overrides());
635 636
636 root_support->EvictFrame(); 637 root_support->EvictFrame();
637 child_support->EvictFrame(); 638 child_support->EvictFrame();
638 } 639 }
639 640
640 } // namespace cc 641 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698