| 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 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 EXPECT_FALSE(dependency_tracker().has_deadline()); | 1203 EXPECT_FALSE(dependency_tracker().has_deadline()); |
| 1204 EXPECT_FALSE(display_surface()->HasPendingFrame()); | 1204 EXPECT_FALSE(display_surface()->HasPendingFrame()); |
| 1205 EXPECT_TRUE(display_surface()->HasActiveFrame()); | 1205 EXPECT_TRUE(display_surface()->HasActiveFrame()); |
| 1206 EXPECT_THAT(display_surface()->blocking_surfaces(), IsEmpty()); | 1206 EXPECT_THAT(display_surface()->blocking_surfaces(), IsEmpty()); |
| 1207 | 1207 |
| 1208 // Only a reference to |parent_id1| is added because |parent_id2| does not | 1208 // Only a reference to |parent_id1| is added because |parent_id2| does not |
| 1209 // exist. | 1209 // exist. |
| 1210 EXPECT_THAT(GetChildReferences(display_id), UnorderedElementsAre(parent_id1)); | 1210 EXPECT_THAT(GetChildReferences(display_id), UnorderedElementsAre(parent_id1)); |
| 1211 } | 1211 } |
| 1212 | 1212 |
| 1213 // This test verifies that a late arriving CompositorFrame activates immediately |
| 1214 // and does not trigger a new deadline. |
| 1215 TEST_F(CompositorFrameSinkSupportTest, LateArrivingDependency) { |
| 1216 const SurfaceId display_id = MakeSurfaceId(kDisplayFrameSink, 1); |
| 1217 const SurfaceId parent_id1 = MakeSurfaceId(kParentFrameSink, 1); |
| 1218 const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1); |
| 1219 |
| 1220 display_support().SubmitCompositorFrame(display_id.local_surface_id(), |
| 1221 MakeCompositorFrame({parent_id1})); |
| 1222 |
| 1223 EXPECT_TRUE(display_surface()->HasPendingFrame()); |
| 1224 EXPECT_FALSE(display_surface()->HasActiveFrame()); |
| 1225 EXPECT_TRUE(dependency_tracker().has_deadline()); |
| 1226 |
| 1227 // Advance BeginFrames to trigger a deadline. This activates the |
| 1228 // CompositorFrame submitted above. |
| 1229 BeginFrameArgs args = |
| 1230 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, 0, 1); |
| 1231 for (int i = 0; i < 3; ++i) { |
| 1232 begin_frame_source()->TestOnBeginFrame(args); |
| 1233 EXPECT_TRUE(dependency_tracker().has_deadline()); |
| 1234 } |
| 1235 begin_frame_source()->TestOnBeginFrame(args); |
| 1236 EXPECT_FALSE(dependency_tracker().has_deadline()); |
| 1237 EXPECT_FALSE(display_surface()->HasPendingFrame()); |
| 1238 EXPECT_TRUE(display_surface()->HasActiveFrame()); |
| 1239 |
| 1240 // A late arriving CompositorFrame should activate immediately without |
| 1241 // scheduling a deadline and without waiting for dependencies to resolve. |
| 1242 parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(), |
| 1243 MakeCompositorFrame({child_id1})); |
| 1244 EXPECT_FALSE(dependency_tracker().has_deadline()); |
| 1245 EXPECT_FALSE(parent_surface()->HasPendingFrame()); |
| 1246 EXPECT_TRUE(parent_surface()->HasActiveFrame()); |
| 1247 } |
| 1248 |
| 1213 } // namespace test | 1249 } // namespace test |
| 1214 } // namespace cc | 1250 } // namespace cc |
| OLD | NEW |