| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/ui/ws/frame_generator.h" | 5 #include "services/ui/ws/frame_generator.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/test/test_message_loop.h" | 10 #include "base/test/test_message_loop.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 // Typical id for the display root ServerWindow. | 26 // Typical id for the display root ServerWindow. |
| 27 constexpr WindowId kRootDisplayId(0, 2); | 27 constexpr WindowId kRootDisplayId(0, 2); |
| 28 const base::UnguessableToken kArbitraryToken = base::UnguessableToken::Create(); | 28 const base::UnguessableToken kArbitraryToken = base::UnguessableToken::Create(); |
| 29 | 29 |
| 30 // Makes the window visible and creates the default surface for it. | 30 // Makes the window visible and creates the default surface for it. |
| 31 void InitWindow(ServerWindow* window) { | 31 void InitWindow(ServerWindow* window) { |
| 32 window->SetVisible(true); | 32 window->SetVisible(true); |
| 33 ServerWindowCompositorFrameSinkManager* compositor_frame_sink_manager = | 33 ServerWindowCompositorFrameSinkManager* compositor_frame_sink_manager = |
| 34 window->GetOrCreateCompositorFrameSinkManager(); | 34 window->GetOrCreateCompositorFrameSinkManager(); |
| 35 compositor_frame_sink_manager->SetLatestSurfaceInfo( | 35 compositor_frame_sink_manager->SetLatestSurfaceInfo(cc::SurfaceInfo( |
| 36 mojom::CompositorFrameSinkType::DEFAULT, | 36 cc::SurfaceId(cc::FrameSinkId(WindowIdToTransportId(window->id()), 0), |
| 37 cc::SurfaceInfo( | 37 cc::LocalFrameId(1u, kArbitraryToken)), |
| 38 cc::SurfaceId( | 38 1.0f, gfx::Size(100, 100))); |
| 39 cc::FrameSinkId(WindowIdToTransportId(window->id()), | |
| 40 static_cast<uint32_t>( | |
| 41 mojom::CompositorFrameSinkType::DEFAULT)), | |
| 42 cc::LocalFrameId(1u, kArbitraryToken)), | |
| 43 1.0f, gfx::Size(100, 100))); | |
| 44 } | 39 } |
| 45 | 40 |
| 46 } // namespace | 41 } // namespace |
| 47 | 42 |
| 48 class FrameGeneratorTest : public testing::Test { | 43 class FrameGeneratorTest : public testing::Test { |
| 49 public: | 44 public: |
| 50 FrameGeneratorTest() | 45 FrameGeneratorTest() |
| 51 : root_window_(base::MakeUnique<ServerWindow>(&window_delegate_, | 46 : root_window_(base::MakeUnique<ServerWindow>(&window_delegate_, |
| 52 kRootDisplayId)) {} | 47 kRootDisplayId)) {} |
| 53 ~FrameGeneratorTest() override {} | 48 ~FrameGeneratorTest() override {} |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 107 |
| 113 EXPECT_EQ(1u, quad_state_list->size()); | 108 EXPECT_EQ(1u, quad_state_list->size()); |
| 114 cc::SharedQuadState* root_sqs = quad_state_list->back(); | 109 cc::SharedQuadState* root_sqs = quad_state_list->back(); |
| 115 // Opacity should always be 1. | 110 // Opacity should always be 1. |
| 116 EXPECT_EQ(1.0f, root_sqs->opacity); | 111 EXPECT_EQ(1.0f, root_sqs->opacity); |
| 117 } | 112 } |
| 118 | 113 |
| 119 } // namespace test | 114 } // namespace test |
| 120 } // namespace ws | 115 } // namespace ws |
| 121 } // namespace ui | 116 } // namespace ui |
| OLD | NEW |