OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "base/containers/flat_set.h" | 5 #include "base/containers/flat_set.h" |
6 #include "cc/surfaces/compositor_frame_sink_support.h" | 6 #include "cc/surfaces/compositor_frame_sink_support.h" |
7 #include "cc/surfaces/surface_id.h" | 7 #include "cc/surfaces/surface_id.h" |
8 #include "cc/surfaces/surface_manager.h" | 8 #include "cc/surfaces/surface_manager.h" |
9 #include "cc/surfaces/surface_observer.h" | 9 #include "cc/surfaces/surface_observer.h" |
10 #include "cc/test/begin_frame_args_test.h" | 10 #include "cc/test/begin_frame_args_test.h" |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 ui::LatencyInfo::LatencyComponent comp1; | 972 ui::LatencyInfo::LatencyComponent comp1; |
973 EXPECT_TRUE( | 973 EXPECT_TRUE( |
974 aggregated_latency_info.FindLatency(latency_type1, latency_id1, &comp1)); | 974 aggregated_latency_info.FindLatency(latency_type1, latency_id1, &comp1)); |
975 EXPECT_EQ(latency_sequence_number1, comp1.sequence_number); | 975 EXPECT_EQ(latency_sequence_number1, comp1.sequence_number); |
976 EXPECT_TRUE( | 976 EXPECT_TRUE( |
977 aggregated_latency_info.FindLatency(latency_type2, latency_id2, nullptr)); | 977 aggregated_latency_info.FindLatency(latency_type2, latency_id2, nullptr)); |
978 EXPECT_TRUE(aggregated_latency_info.FindLatency( | 978 EXPECT_TRUE(aggregated_latency_info.FindLatency( |
979 ui::DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT, nullptr)); | 979 ui::DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT, nullptr)); |
980 } | 980 } |
981 | 981 |
982 TEST_F(SurfaceSynchronizationTest, PassesOnBeginFrameAcks) { | 982 // TODO(eseckler): Add back tests for BeginFrameAck forwarding through |
983 const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); | 983 // CompositorFrameSinkSupport when we add plumbing of BeginFrameAcks through |
984 | 984 // SurfaceObservers. |
985 // Request BeginFrames. | |
986 display_support().SetNeedsBeginFrame(true); | |
987 | |
988 // Issue a BeginFrame. | |
989 BeginFrameArgs args = | |
990 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1); | |
991 begin_frame_source()->TestOnBeginFrame(args); | |
992 | |
993 // Check that the support forwards a DidNotProduceFrame ack to the | |
994 // BeginFrameSource. | |
995 BeginFrameAck ack(0, 1, 1, false); | |
996 display_support().DidNotProduceFrame(ack); | |
997 EXPECT_EQ(ack, begin_frame_source()->LastAckForObserver(&display_support())); | |
998 | |
999 // Issue another BeginFrame. | |
1000 args = CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 2); | |
1001 begin_frame_source()->TestOnBeginFrame(args); | |
1002 | |
1003 // Check that the support forwards the BeginFrameAck attached | |
1004 // to a CompositorFrame to the BeginFrameSource. | |
1005 BeginFrameAck ack2(0, 2, 2, true); | |
1006 CompositorFrame frame = MakeCompositorFrame(); | |
1007 frame.metadata.begin_frame_ack = ack2; | |
1008 display_support().SubmitCompositorFrame(display_id.local_surface_id(), | |
1009 std::move(frame)); | |
1010 EXPECT_EQ(ack2, begin_frame_source()->LastAckForObserver(&display_support())); | |
1011 } | |
1012 | 985 |
1013 // Checks that resources and ack are sent together if possible. | 986 // Checks that resources and ack are sent together if possible. |
1014 TEST_F(SurfaceSynchronizationTest, ReturnResourcesWithAck) { | 987 TEST_F(SurfaceSynchronizationTest, ReturnResourcesWithAck) { |
1015 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); | 988 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); |
1016 TransferableResource resource; | 989 TransferableResource resource; |
1017 resource.id = 1234; | 990 resource.id = 1234; |
1018 parent_support().SubmitCompositorFrame( | 991 parent_support().SubmitCompositorFrame( |
1019 parent_id.local_surface_id(), | 992 parent_id.local_surface_id(), |
1020 MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(), | 993 MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(), |
1021 {resource})); | 994 {resource})); |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 DidReceiveCompositorFrameAck(Eq(returned_resources2))); | 1358 DidReceiveCompositorFrameAck(Eq(returned_resources2))); |
1386 child_support1().SubmitCompositorFrame( | 1359 child_support1().SubmitCompositorFrame( |
1387 child_id1.local_surface_id(), | 1360 child_id1.local_surface_id(), |
1388 MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(), | 1361 MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(), |
1389 {resource2})); | 1362 {resource2})); |
1390 testing::Mock::VerifyAndClearExpectations(&support_client_); | 1363 testing::Mock::VerifyAndClearExpectations(&support_client_); |
1391 } | 1364 } |
1392 | 1365 |
1393 } // namespace test | 1366 } // namespace test |
1394 } // namespace cc | 1367 } // namespace cc |
OLD | NEW |