| 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 "cc/surfaces/compositor_frame_sink_support.h" | 5 #include "cc/surfaces/compositor_frame_sink_support.h" |
| 6 | 6 |
| 7 #include "base/debug/stack_trace.h" | 7 #include "base/debug/stack_trace.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
| 10 #include "cc/surfaces/compositor_frame_sink_support_client.h" | 10 #include "cc/surfaces/compositor_frame_sink_support_client.h" |
| (...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 aggregated_latency_info.AddNewLatencyFrom(info_list[1]); | 951 aggregated_latency_info.AddNewLatencyFrom(info_list[1]); |
| 952 EXPECT_EQ(2u, aggregated_latency_info.latency_components().size()); | 952 EXPECT_EQ(2u, aggregated_latency_info.latency_components().size()); |
| 953 | 953 |
| 954 ui::LatencyInfo::LatencyComponent comp1; | 954 ui::LatencyInfo::LatencyComponent comp1; |
| 955 EXPECT_TRUE( | 955 EXPECT_TRUE( |
| 956 aggregated_latency_info.FindLatency(latency_type1, latency_id1, &comp1)); | 956 aggregated_latency_info.FindLatency(latency_type1, latency_id1, &comp1)); |
| 957 EXPECT_EQ(latency_sequence_number1, comp1.sequence_number); | 957 EXPECT_EQ(latency_sequence_number1, comp1.sequence_number); |
| 958 } | 958 } |
| 959 | 959 |
| 960 TEST_F(CompositorFrameSinkSupportTest, PassesOnBeginFrameAcks) { | 960 TEST_F(CompositorFrameSinkSupportTest, PassesOnBeginFrameAcks) { |
| 961 const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); |
| 962 |
| 961 // Request BeginFrames. | 963 // Request BeginFrames. |
| 962 display_support().SetNeedsBeginFrame(true); | 964 display_support().SetNeedsBeginFrame(true); |
| 963 | 965 |
| 964 // Issue a BeginFrame. | 966 // Issue a BeginFrame. |
| 965 BeginFrameArgs args = | 967 BeginFrameArgs args = |
| 966 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1); | 968 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1); |
| 967 begin_frame_source()->TestOnBeginFrame(args); | 969 begin_frame_source()->TestOnBeginFrame(args); |
| 968 | 970 |
| 969 // Check that the support forwards a BeginFrameDidNotSwap ack to the | 971 // Check that the support forwards a BeginFrameDidNotSwap ack to the |
| 970 // BeginFrameSource. | 972 // BeginFrameSource. |
| 971 BeginFrameAck ack(0, 1, 1, false); | 973 BeginFrameAck ack(0, 1, 1, false); |
| 972 display_support().BeginFrameDidNotSwap(ack); | 974 display_support().BeginFrameDidNotSwap(ack); |
| 973 EXPECT_EQ(ack, begin_frame_source()->LastAckForObserver(&display_support())); | 975 EXPECT_EQ(ack, begin_frame_source()->LastAckForObserver(&display_support())); |
| 974 | 976 |
| 975 // TODO(eseckler): Check that the support forwards the BeginFrameAck attached | 977 // Issue another BeginFrame. |
| 978 args = CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 2); |
| 979 begin_frame_source()->TestOnBeginFrame(args); |
| 980 |
| 981 // Check that the support forwards the BeginFrameAck attached |
| 976 // to a CompositorFrame to the BeginFrameSource. | 982 // to a CompositorFrame to the BeginFrameSource. |
| 983 BeginFrameAck ack2(0, 2, 2, true); |
| 984 CompositorFrame frame = MakeCompositorFrame(); |
| 985 frame.metadata.begin_frame_ack = ack2; |
| 986 display_support().SubmitCompositorFrame(display_id.local_surface_id(), |
| 987 std::move(frame)); |
| 988 EXPECT_EQ(ack2, begin_frame_source()->LastAckForObserver(&display_support())); |
| 977 } | 989 } |
| 978 | 990 |
| 979 // Checks whether the resources are returned before we send an ack. | 991 // Checks whether the resources are returned before we send an ack. |
| 980 TEST_F(CompositorFrameSinkSupportTest, ReturnResourcesBeforeAck) { | 992 TEST_F(CompositorFrameSinkSupportTest, ReturnResourcesBeforeAck) { |
| 981 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); | 993 const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1); |
| 982 TransferableResource resource; | 994 TransferableResource resource; |
| 983 resource.id = 1234; | 995 resource.id = 1234; |
| 984 parent_support().SubmitCompositorFrame( | 996 parent_support().SubmitCompositorFrame( |
| 985 parent_id.local_surface_id(), | 997 parent_id.local_surface_id(), |
| 986 MakeCompositorFrameWithResources(empty_surface_ids(), {resource})); | 998 MakeCompositorFrameWithResources(empty_surface_ids(), {resource})); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 // be used and destroyed() must return false. The surface must have a factory. | 1107 // be used and destroyed() must return false. The surface must have a factory. |
| 1096 child_support->SubmitCompositorFrame( | 1108 child_support->SubmitCompositorFrame( |
| 1097 child_id.local_surface_id(), MakeCompositorFrame(empty_surface_ids())); | 1109 child_id.local_surface_id(), MakeCompositorFrame(empty_surface_ids())); |
| 1098 EXPECT_EQ(surface, surface_manager().GetSurfaceForId(child_id)); | 1110 EXPECT_EQ(surface, surface_manager().GetSurfaceForId(child_id)); |
| 1099 EXPECT_TRUE(surface->factory()); | 1111 EXPECT_TRUE(surface->factory()); |
| 1100 EXPECT_FALSE(surface->destroyed()); | 1112 EXPECT_FALSE(surface->destroyed()); |
| 1101 } | 1113 } |
| 1102 | 1114 |
| 1103 } // namespace test | 1115 } // namespace test |
| 1104 } // namespace cc | 1116 } // namespace cc |
| OLD | NEW |