Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: ash/mus/non_client_frame_controller_unittest.cc

Issue 2815073002: Revert of Remove CompositorObserver::OnCompositingEnded() (Closed)
Patch Set: Fix CompositorObservers test Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/renderer_host/browser_compositor_view_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/browser_compositor_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698