Index: services/ui/ws/frame_generator_unittest.cc |
diff --git a/services/ui/ws/frame_generator_unittest.cc b/services/ui/ws/frame_generator_unittest.cc |
index 49c4a981cb4645f1e11662a936272e1e37e3e486..ea6017e66c573e6b9591e7eafdd9f4f2190129a2 100644 |
--- a/services/ui/ws/frame_generator_unittest.cc |
+++ b/services/ui/ws/frame_generator_unittest.cc |
@@ -52,8 +52,8 @@ class FrameGeneratorTest : public testing::Test { |
kRootDisplayId)) {} |
~FrameGeneratorTest() override {} |
- // Calls DrawWindowTree() on |frame_generator_| |
- void DrawWindowTree(cc::RenderPass* pass); |
+ // Calls DrawWindow() on |frame_generator_| |
+ void DrawWindow(cc::RenderPass* pass); |
ServerWindow* root_window() { return root_window_.get(); } |
@@ -75,14 +75,14 @@ class FrameGeneratorTest : public testing::Test { |
DISALLOW_COPY_AND_ASSIGN(FrameGeneratorTest); |
}; |
-void FrameGeneratorTest::DrawWindowTree(cc::RenderPass* pass) { |
- frame_generator_->DrawWindowTree(pass, root_window_.get(), gfx::Vector2d(), |
- 1.0f); |
+void FrameGeneratorTest::DrawWindow(cc::RenderPass* pass) { |
+ frame_generator_->DrawWindow(pass, root_window_.get()); |
} |
void FrameGeneratorTest::SetUp() { |
testing::Test::SetUp(); |
- frame_generator_delegate_ = base::MakeUnique<TestFrameGeneratorDelegate>(); |
+ frame_generator_delegate_ = |
+ base::MakeUnique<TestFrameGeneratorDelegate>(root_window_.get()); |
PlatformDisplayInitParams init_params; |
frame_generator_ = base::MakeUnique<FrameGenerator>( |
frame_generator_delegate_.get(), root_window_.get()); |
@@ -97,51 +97,23 @@ void FrameGeneratorTest::TearDown() { |
} |
// Tests correctness of the SharedQuadStateList generated by |
-// FrameGenerator::DrawWindowTree(). |
-TEST_F(FrameGeneratorTest, DrawWindowTree) { |
+// FrameGenerator::DrawWindow(). |
+TEST_F(FrameGeneratorTest, DrawWindow) { |
ServerWindow child_window(test_window_delegate(), WindowId(1, 1)); |
root_window()->Add(&child_window); |
InitWindow(&child_window); |
- const float root_opacity = .5f; |
const float child_opacity = .4f; |
- root_window()->SetOpacity(root_opacity); |
child_window.SetOpacity(child_opacity); |
std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create(); |
- DrawWindowTree(render_pass.get()); |
+ DrawWindow(render_pass.get()); |
cc::SharedQuadStateList* quad_state_list = |
&render_pass->shared_quad_state_list; |
- // Both child and root have a DEFAULT Surface and no underlay Surfaces, so |
- // there should be two SharedQuadStates in the list. |
- EXPECT_EQ(2u, quad_state_list->size()); |
+ EXPECT_EQ(1u, quad_state_list->size()); |
cc::SharedQuadState* root_sqs = quad_state_list->back(); |
- cc::SharedQuadState* child_sqs = quad_state_list->front(); |
- EXPECT_EQ(root_opacity, root_sqs->opacity); |
- // Child's SharedQuadState contains the effective opacity of the child layer, |
- // which should be a product of the child and the parent opacity. |
- EXPECT_EQ(child_opacity * root_opacity, child_sqs->opacity); |
- |
- // Pretend to create the UNDERLAY Surface for the child window, and confirm |
- // that this creates an extra SharedQuadState in the CompositorFrame. |
- child_window.GetOrCreateCompositorFrameSinkManager()->SetLatestSurfaceInfo( |
- mojom::CompositorFrameSinkType::UNDERLAY, |
- cc::SurfaceInfo( |
- cc::SurfaceId( |
- cc::FrameSinkId(WindowIdToTransportId(child_window.id()), |
- static_cast<uint32_t>( |
- mojom::CompositorFrameSinkType::UNDERLAY)), |
- cc::LocalFrameId(1u, kArbitraryToken)), |
- 1.0f, gfx::Size(100, 100))); |
- |
- render_pass = cc::RenderPass::Create(); |
- DrawWindowTree(render_pass.get()); |
- quad_state_list = &render_pass->shared_quad_state_list; |
- EXPECT_EQ(3u, quad_state_list->size()); |
- auto it = quad_state_list->begin(); |
- EXPECT_EQ(child_opacity * root_opacity, (*it)->opacity); |
- EXPECT_EQ(child_opacity * root_opacity, (*++it)->opacity); |
- EXPECT_EQ(root_opacity, (*++it)->opacity); |
+ // Opacity should always be 1. |
+ EXPECT_EQ(1.0f, root_sqs->opacity); |
} |
} // namespace test |