OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/snapshot/snapshot.h" | 5 #include "ui/snapshot/snapshot.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 testing::Test::TearDown(); | 119 testing::Test::TearDown(); |
120 } | 120 } |
121 | 121 |
122 protected: | 122 protected: |
123 aura::Window* test_window() { return test_window_.get(); } | 123 aura::Window* test_window() { return test_window_.get(); } |
124 aura::Window* root_window() { return helper_->root_window(); } | 124 aura::Window* root_window() { return helper_->root_window(); } |
125 aura::TestScreen* test_screen() { return helper_->test_screen(); } | 125 aura::TestScreen* test_screen() { return helper_->test_screen(); } |
126 | 126 |
127 void WaitForDraw() { | 127 void WaitForDraw() { |
128 helper_->host()->compositor()->ScheduleDraw(); | 128 helper_->host()->compositor()->ScheduleDraw(); |
129 ui::DrawWaiterForTest::WaitForCompositingStarted( | 129 ui::DrawWaiterForTest::WaitForCompositingEnded( |
130 helper_->host()->compositor()); | 130 helper_->host()->compositor()); |
131 } | 131 } |
132 | 132 |
133 void SetupTestWindow(const gfx::Rect& window_bounds) { | 133 void SetupTestWindow(const gfx::Rect& window_bounds) { |
134 delegate_.reset(new TestPaintingWindowDelegate(window_bounds.size())); | 134 delegate_.reset(new TestPaintingWindowDelegate(window_bounds.size())); |
135 test_window_.reset(aura::test::CreateTestWindowWithDelegate( | 135 test_window_.reset(aura::test::CreateTestWindowWithDelegate( |
136 delegate_.get(), 0, window_bounds, root_window())); | 136 delegate_.get(), 0, window_bounds, root_window())); |
137 } | 137 } |
138 | 138 |
139 gfx::Image GrabSnapshotForTestWindow() { | 139 gfx::Image GrabSnapshotForTestWindow() { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 gfx::SizeF snapshot_size(test_bounds.size()); | 286 gfx::SizeF snapshot_size(test_bounds.size()); |
287 snapshot_size.Scale(2.0f / kUIScale); | 287 snapshot_size.Scale(2.0f / kUIScale); |
288 | 288 |
289 gfx::Image snapshot = GrabSnapshotForTestWindow(); | 289 gfx::Image snapshot = GrabSnapshotForTestWindow(); |
290 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(), | 290 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(), |
291 snapshot.Size().ToString()); | 291 snapshot.Size().ToString()); |
292 EXPECT_EQ(0u, GetFailedPixelsCountWithScaleFactor(snapshot, 2 / kUIScale)); | 292 EXPECT_EQ(0u, GetFailedPixelsCountWithScaleFactor(snapshot, 2 / kUIScale)); |
293 } | 293 } |
294 | 294 |
295 } // namespace ui | 295 } // namespace ui |
OLD | NEW |