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 "ash/mus/non_client_frame_controller.h" | 5 #include "ash/mus/non_client_frame_controller.h" |
6 | 6 |
7 #include "ash/ash_layout_constants.h" | 7 #include "ash/ash_layout_constants.h" |
8 #include "ash/mus/top_level_window_factory.h" | 8 #include "ash/mus/top_level_window_factory.h" |
9 #include "ash/mus/window_manager_application.h" | 9 #include "ash/mus/window_manager_application.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 const int tile_height = tile_size.height(); | 113 const int tile_height = tile_size.height(); |
114 const int tile_x = tile_width; | 114 const int tile_x = tile_width; |
115 const int tile_y = tile_height; | 115 const int tile_y = tile_height; |
116 | 116 |
117 const gfx::Rect kTileBounds(gfx::Point(tile_x, tile_y), tile_size); | 117 const gfx::Rect kTileBounds(gfx::Point(tile_x, tile_y), tile_size); |
118 ui::Compositor* compositor = widget->GetCompositor(); | 118 ui::Compositor* compositor = widget->GetCompositor(); |
119 | 119 |
120 // Without the window visible, there should be a tile for the wallpaper at | 120 // Without the window visible, there should be a tile for the wallpaper at |
121 // (tile_x, tile_y) of size |tile_size|. | 121 // (tile_x, tile_y) of size |tile_size|. |
122 compositor->ScheduleDraw(); | 122 compositor->ScheduleDraw(); |
123 ui::DrawWaiterForTest::WaitForCompositingStarted(compositor); | 123 ui::DrawWaiterForTest::WaitForCompositingEnded(compositor); |
124 { | 124 { |
125 const cc::CompositorFrame& frame = GetLastCompositorFrame(); | 125 const cc::CompositorFrame& frame = GetLastCompositorFrame(); |
126 ASSERT_EQ(1u, frame.render_pass_list.size()); | 126 ASSERT_EQ(1u, frame.render_pass_list.size()); |
127 EXPECT_TRUE(FindColorQuad(frame, kTileBounds, SK_ColorBLACK)); | 127 EXPECT_TRUE(FindColorQuad(frame, kTileBounds, SK_ColorBLACK)); |
128 } | 128 } |
129 | 129 |
130 // Show |widget|, and position it so that it covers that wallpaper tile. | 130 // Show |widget|, and position it so that it covers that wallpaper tile. |
131 const gfx::Rect widget_bound(tile_x - 10, tile_y - 10, tile_width + 20, | 131 const gfx::Rect widget_bound(tile_x - 10, tile_y - 10, tile_width + 20, |
132 tile_height + 20); | 132 tile_height + 20); |
133 widget->SetBounds(widget_bound); | 133 widget->SetBounds(widget_bound); |
134 widget->Show(); | 134 widget->Show(); |
135 compositor->ScheduleDraw(); | 135 compositor->ScheduleDraw(); |
136 ui::DrawWaiterForTest::WaitForCompositingStarted(compositor); | 136 ui::DrawWaiterForTest::WaitForCompositingEnded(compositor); |
137 { | 137 { |
138 // This time, that tile for the wallpaper will not be drawn. | 138 // This time, that tile for the wallpaper will not be drawn. |
139 const cc::CompositorFrame& frame = GetLastCompositorFrame(); | 139 const cc::CompositorFrame& frame = GetLastCompositorFrame(); |
140 ASSERT_EQ(1u, frame.render_pass_list.size()); | 140 ASSERT_EQ(1u, frame.render_pass_list.size()); |
141 EXPECT_FALSE(FindColorQuad(frame, kTileBounds, SK_ColorBLACK)); | 141 EXPECT_FALSE(FindColorQuad(frame, kTileBounds, SK_ColorBLACK)); |
142 | 142 |
143 // Instead, there will be some solid-color quads for the widget. | 143 // Instead, there will be some solid-color quads for the widget. |
144 const gfx::Rect top_left(widget_bound.origin(), tile_size); | 144 const gfx::Rect top_left(widget_bound.origin(), tile_size); |
145 const gfx::Rect top_right( | 145 const gfx::Rect top_right( |
146 top_left.top_right(), | 146 top_left.top_right(), |
(...skipping 11 matching lines...) Expand all Loading... |
158 | 158 |
159 // And there will be a content quad for the window caption. | 159 // And there will be a content quad for the window caption. |
160 gfx::Rect caption_bound(widget_bound); | 160 gfx::Rect caption_bound(widget_bound); |
161 caption_bound.set_height(caption_height); | 161 caption_bound.set_height(caption_height); |
162 EXPECT_TRUE(FindTiledContentQuad(frame, caption_bound)); | 162 EXPECT_TRUE(FindTiledContentQuad(frame, caption_bound)); |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 } // namespace mus | 166 } // namespace mus |
167 } // namespace ash | 167 } // namespace ash |
OLD | NEW |