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

Side by Side Diff: ui/snapshot/snapshot_aura_unittest.cc

Issue 638653003: Make ui::Compositor use ui::Scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 10 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 | « ui/compositor/test/test_compositor_host_x11.cc ('k') | ui/views/examples/examples_main.cc » ('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 (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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/test/test_simple_task_runner.h" 8 #include "base/test/test_simple_task_runner.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/aura/test/aura_test_helper.h" 10 #include "ui/aura/test/aura_test_helper.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 testing::Test::TearDown(); 107 testing::Test::TearDown();
108 } 108 }
109 109
110 protected: 110 protected:
111 aura::Window* test_window() { return test_window_.get(); } 111 aura::Window* test_window() { return test_window_.get(); }
112 aura::Window* root_window() { return helper_->root_window(); } 112 aura::Window* root_window() { return helper_->root_window(); }
113 aura::TestScreen* test_screen() { return helper_->test_screen(); } 113 aura::TestScreen* test_screen() { return helper_->test_screen(); }
114 114
115 void WaitForDraw() { 115 void WaitForDraw() {
116 helper_->host()->compositor()->ScheduleDraw(); 116 helper_->host()->compositor()->ScheduleDraw();
117 ui::DrawWaiterForTest::Wait(helper_->host()->compositor()); 117 ui::DrawWaiterForTest::WaitForCompositingEnded(
118 helper_->host()->compositor());
118 } 119 }
119 120
120 void SetupTestWindow(const gfx::Rect& window_bounds) { 121 void SetupTestWindow(const gfx::Rect& window_bounds) {
121 delegate_.reset(new TestPaintingWindowDelegate(window_bounds.size())); 122 delegate_.reset(new TestPaintingWindowDelegate(window_bounds.size()));
122 test_window_.reset(aura::test::CreateTestWindowWithDelegate( 123 test_window_.reset(aura::test::CreateTestWindowWithDelegate(
123 delegate_.get(), 0, window_bounds, root_window())); 124 delegate_.get(), 0, window_bounds, root_window()));
124 } 125 }
125 126
126 gfx::Image GrabSnapshotForTestWindow() { 127 gfx::Image GrabSnapshotForTestWindow() {
127 gfx::Rect source_rect(test_window_->bounds().size()); 128 gfx::Rect source_rect(test_window_->bounds().size());
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 gfx::SizeF snapshot_size(test_bounds.size()); 284 gfx::SizeF snapshot_size(test_bounds.size());
284 snapshot_size.Scale(2.0f); 285 snapshot_size.Scale(2.0f);
285 286
286 gfx::Image snapshot = GrabSnapshotForTestWindow(); 287 gfx::Image snapshot = GrabSnapshotForTestWindow();
287 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(), 288 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(),
288 snapshot.Size().ToString()); 289 snapshot.Size().ToString());
289 EXPECT_EQ(0u, GetFailedPixelsCountWithScaleFactor(snapshot, 2)); 290 EXPECT_EQ(0u, GetFailedPixelsCountWithScaleFactor(snapshot, 2));
290 } 291 }
291 292
292 } // namespace ui 293 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/test/test_compositor_host_x11.cc ('k') | ui/views/examples/examples_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698