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 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
967 | 967 |
968 ui::LatencyInfo::LatencyComponent comp1; | 968 ui::LatencyInfo::LatencyComponent comp1; |
969 EXPECT_TRUE( | 969 EXPECT_TRUE( |
970 aggregated_latency_info.FindLatency(latency_type1, latency_id1, &comp1)); | 970 aggregated_latency_info.FindLatency(latency_type1, latency_id1, &comp1)); |
971 EXPECT_EQ(latency_sequence_number1, comp1.sequence_number); | 971 EXPECT_EQ(latency_sequence_number1, comp1.sequence_number); |
972 EXPECT_TRUE( | 972 EXPECT_TRUE( |
973 aggregated_latency_info.FindLatency(latency_type2, latency_id2, nullptr)); | 973 aggregated_latency_info.FindLatency(latency_type2, latency_id2, nullptr)); |
974 EXPECT_TRUE(aggregated_latency_info.FindLatency( | 974 EXPECT_TRUE(aggregated_latency_info.FindLatency( |
975 ui::DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT, nullptr)); | 975 ui::DISPLAY_COMPOSITOR_RECEIVED_FRAME_COMPONENT, nullptr)); |
976 } | 976 } |
977 | 977 |
sunnyps
2017/05/24 02:38:26
nit: Can you add a TODO here so that we don't forg
Eric Seckler
2017/05/24 09:00:41
Done.
| |
978 TEST_F(SurfaceSynchronizationTest, PassesOnBeginFrameAcks) { | |
979 const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); | |
980 | |
981 // Request BeginFrames. | |
982 display_support().SetNeedsBeginFrame(true); | |
983 | |
984 // Issue a BeginFrame. | |
985 BeginFrameArgs args = | |
986 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1); | |
987 begin_frame_source()->TestOnBeginFrame(args); | |
988 | |
989 // Check that the support forwards a DidNotProduceFrame ack to the | |
990 // BeginFrameSource. | |
991 BeginFrameAck ack(0, 1, 1, false); | |
992 display_support().DidNotProduceFrame(ack); | |
993 EXPECT_EQ(ack, begin_frame_source()->LastAckForObserver(&display_support())); | |
994 | |
995 // Issue another BeginFrame. | |
996 args = CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 2); | |
997 begin_frame_source()->TestOnBeginFrame(args); | |
998 | |
999 // Check that the support forwards the BeginFrameAck attached | |
1000 // to a CompositorFrame to the BeginFrameSource. | |
1001 BeginFrameAck ack2(0, 2, 2, true); | |
1002 CompositorFrame frame = MakeCompositorFrame(); | |
1003 frame.metadata.begin_frame_ack = ack2; | |
1004 display_support().SubmitCompositorFrame(display_id.local_surface_id(), | |
1005 std::move(frame)); | |
1006 EXPECT_EQ(ack2, begin_frame_source()->LastAckForObserver(&display_support())); | |
1007 } | |
1008 | |
1009 // Checks that resources and ack are sent together if possible. | 978 // Checks that resources and ack are sent together if possible. |
1010 TEST_F(SurfaceSynchronizationTest, ReturnResourcesWithAck) { | 979 TEST_F(SurfaceSynchronizationTest, ReturnResourcesWithAck) { |
1011 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); | 980 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); |
1012 TransferableResource resource; | 981 TransferableResource resource; |
1013 resource.id = 1234; | 982 resource.id = 1234; |
1014 parent_support().SubmitCompositorFrame( | 983 parent_support().SubmitCompositorFrame( |
1015 parent_id.local_surface_id(), | 984 parent_id.local_surface_id(), |
1016 MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(), | 985 MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(), |
1017 {resource})); | 986 {resource})); |
1018 ReturnedResourceArray returned_resources; | 987 ReturnedResourceArray returned_resources; |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1381 DidReceiveCompositorFrameAck(Eq(returned_resources2))); | 1350 DidReceiveCompositorFrameAck(Eq(returned_resources2))); |
1382 child_support1().SubmitCompositorFrame( | 1351 child_support1().SubmitCompositorFrame( |
1383 child_id1.local_surface_id(), | 1352 child_id1.local_surface_id(), |
1384 MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(), | 1353 MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(), |
1385 {resource2})); | 1354 {resource2})); |
1386 testing::Mock::VerifyAndClearExpectations(&support_client_); | 1355 testing::Mock::VerifyAndClearExpectations(&support_client_); |
1387 } | 1356 } |
1388 | 1357 |
1389 } // namespace test | 1358 } // namespace test |
1390 } // namespace cc | 1359 } // namespace cc |
OLD | NEW |