| 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/macros.h" | 7 #include "base/macros.h" |
| 8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
| 9 #include "cc/surfaces/compositor_frame_sink_support_client.h" | 9 #include "cc/surfaces/compositor_frame_sink_support_client.h" |
| 10 #include "cc/surfaces/frame_sink_id.h" | 10 #include "cc/surfaces/frame_sink_id.h" |
| 11 #include "cc/surfaces/surface_id.h" | 11 #include "cc/surfaces/surface_id.h" |
| 12 #include "cc/surfaces/surface_manager.h" | 12 #include "cc/surfaces/surface_manager.h" |
| 13 #include "cc/test/begin_frame_args_test.h" | 13 #include "cc/test/begin_frame_args_test.h" |
| 14 #include "cc/test/compositor_frame_helpers.h" |
| 14 #include "cc/test/fake_external_begin_frame_source.h" | 15 #include "cc/test/fake_external_begin_frame_source.h" |
| 15 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 18 |
| 18 using testing::UnorderedElementsAre; | 19 using testing::UnorderedElementsAre; |
| 19 using testing::IsEmpty; | 20 using testing::IsEmpty; |
| 20 using testing::SizeIs; | 21 using testing::SizeIs; |
| 21 using testing::Invoke; | 22 using testing::Invoke; |
| 22 using testing::_; | 23 using testing::_; |
| 23 using testing::Eq; | 24 using testing::Eq; |
| 24 | 25 |
| 25 namespace cc { | 26 namespace cc { |
| 26 namespace test { | |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 constexpr FrameSinkId kDisplayFrameSink(2, 0); | 29 constexpr FrameSinkId kDisplayFrameSink(2, 0); |
| 30 constexpr FrameSinkId kParentFrameSink(3, 0); | 30 constexpr FrameSinkId kParentFrameSink(3, 0); |
| 31 constexpr FrameSinkId kChildFrameSink1(65563, 0); | 31 constexpr FrameSinkId kChildFrameSink1(65563, 0); |
| 32 constexpr FrameSinkId kChildFrameSink2(65564, 0); | 32 constexpr FrameSinkId kChildFrameSink2(65564, 0); |
| 33 constexpr FrameSinkId kArbitraryFrameSink(1337, 7331); | 33 constexpr FrameSinkId kArbitraryFrameSink(1337, 7331); |
| 34 | 34 |
| 35 class MockCompositorFrameSinkSupportClient | 35 class MockCompositorFrameSinkSupportClient |
| 36 : public CompositorFrameSinkSupportClient { | 36 : public CompositorFrameSinkSupportClient { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 SurfaceId MakeSurfaceId(const FrameSinkId& frame_sink_id, uint32_t local_id) { | 72 SurfaceId MakeSurfaceId(const FrameSinkId& frame_sink_id, uint32_t local_id) { |
| 73 return SurfaceId( | 73 return SurfaceId( |
| 74 frame_sink_id, | 74 frame_sink_id, |
| 75 LocalSurfaceId(local_id, base::UnguessableToken::Deserialize(0, 1u))); | 75 LocalSurfaceId(local_id, base::UnguessableToken::Deserialize(0, 1u))); |
| 76 } | 76 } |
| 77 | 77 |
| 78 CompositorFrame MakeCompositorFrame(std::vector<SurfaceId> embedded_surfaces, | 78 CompositorFrame MakeCompositorFrame(std::vector<SurfaceId> embedded_surfaces, |
| 79 std::vector<SurfaceId> referenced_surfaces, | 79 std::vector<SurfaceId> referenced_surfaces, |
| 80 TransferableResourceArray resource_list) { | 80 TransferableResourceArray resource_list) { |
| 81 CompositorFrame compositor_frame; | 81 CompositorFrame compositor_frame = test::MakeCompositorFrame(); |
| 82 compositor_frame.metadata.begin_frame_ack = BeginFrameAck(0, 1, 1, true); | 82 compositor_frame.metadata.begin_frame_ack = BeginFrameAck(0, 1, 1, true); |
| 83 compositor_frame.metadata.embedded_surfaces = std::move(embedded_surfaces); | 83 compositor_frame.metadata.embedded_surfaces = std::move(embedded_surfaces); |
| 84 compositor_frame.metadata.referenced_surfaces = | 84 compositor_frame.metadata.referenced_surfaces = |
| 85 std::move(referenced_surfaces); | 85 std::move(referenced_surfaces); |
| 86 compositor_frame.resource_list = std::move(resource_list); | 86 compositor_frame.resource_list = std::move(resource_list); |
| 87 return compositor_frame; | 87 return compositor_frame; |
| 88 } | 88 } |
| 89 | 89 |
| 90 CompositorFrame MakeCompositorFrame() { | 90 CompositorFrame MakeCompositorFrame() { |
| 91 return MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(), | 91 return MakeCompositorFrame(empty_surface_ids(), empty_surface_ids(), |
| (...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 | 1314 |
| 1315 // A late arriving CompositorFrame should activate immediately without | 1315 // A late arriving CompositorFrame should activate immediately without |
| 1316 // scheduling a deadline and without waiting for dependencies to resolve. | 1316 // scheduling a deadline and without waiting for dependencies to resolve. |
| 1317 parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(), | 1317 parent_support().SubmitCompositorFrame(parent_id1.local_surface_id(), |
| 1318 MakeCompositorFrame({child_id1})); | 1318 MakeCompositorFrame({child_id1})); |
| 1319 EXPECT_FALSE(dependency_tracker().has_deadline()); | 1319 EXPECT_FALSE(dependency_tracker().has_deadline()); |
| 1320 EXPECT_FALSE(parent_surface()->HasPendingFrame()); | 1320 EXPECT_FALSE(parent_surface()->HasPendingFrame()); |
| 1321 EXPECT_TRUE(parent_surface()->HasActiveFrame()); | 1321 EXPECT_TRUE(parent_surface()->HasActiveFrame()); |
| 1322 } | 1322 } |
| 1323 | 1323 |
| 1324 } // namespace test | |
| 1325 } // namespace cc | 1324 } // namespace cc |
| OLD | NEW |