| 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/test/test_message_loop.h" | 9 #include "base/test/test_message_loop.h" |
| 10 #include "cc/quads/render_pass.h" | 10 #include "cc/quads/render_pass.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 79 } |
| 80 | 80 |
| 81 void FrameGeneratorTest::TearDown() { | 81 void FrameGeneratorTest::TearDown() { |
| 82 frame_generator_.reset(); | 82 frame_generator_.reset(); |
| 83 frame_generator_delegate_.reset(); | 83 frame_generator_delegate_.reset(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 // Tests correctness of the SharedQuadStateList generated by | 86 // Tests correctness of the SharedQuadStateList generated by |
| 87 // FrameGenerator::DrawWindowTree(). | 87 // FrameGenerator::DrawWindowTree(). |
| 88 TEST_F(FrameGeneratorTest, DrawWindowTree) { | 88 TEST_F(FrameGeneratorTest, DrawWindowTree) { |
| 89 ServerWindow child_window(test_window_delegate(), WindowId()); | 89 ServerWindow child_window(test_window_delegate(), WindowId(1, 1)); |
| 90 root_window()->Add(&child_window); | 90 root_window()->Add(&child_window); |
| 91 InitWindow(&child_window); | 91 InitWindow(&child_window); |
| 92 const float root_opacity = .5f; | 92 const float root_opacity = .5f; |
| 93 const float child_opacity = .4f; | 93 const float child_opacity = .4f; |
| 94 root_window()->SetOpacity(root_opacity); | 94 root_window()->SetOpacity(root_opacity); |
| 95 child_window.SetOpacity(child_opacity); | 95 child_window.SetOpacity(child_opacity); |
| 96 | 96 |
| 97 std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create(); | 97 std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create(); |
| 98 DrawWindowTree(render_pass.get()); | 98 DrawWindowTree(render_pass.get()); |
| 99 cc::SharedQuadStateList* quad_state_list = | 99 cc::SharedQuadStateList* quad_state_list = |
| (...skipping 21 matching lines...) Expand all Loading... |
| 121 EXPECT_EQ(3u, quad_state_list->size()); | 121 EXPECT_EQ(3u, quad_state_list->size()); |
| 122 auto it = quad_state_list->begin(); | 122 auto it = quad_state_list->begin(); |
| 123 EXPECT_EQ(child_opacity * root_opacity, (*it)->opacity); | 123 EXPECT_EQ(child_opacity * root_opacity, (*it)->opacity); |
| 124 EXPECT_EQ(child_opacity * root_opacity, (*++it)->opacity); | 124 EXPECT_EQ(child_opacity * root_opacity, (*++it)->opacity); |
| 125 EXPECT_EQ(root_opacity, (*++it)->opacity); | 125 EXPECT_EQ(root_opacity, (*++it)->opacity); |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace test | 128 } // namespace test |
| 129 } // namespace ws | 129 } // namespace ws |
| 130 } // namespace ui | 130 } // namespace ui |
| OLD | NEW |