base: Change DCHECK_IS_ON to a macro DCHECK_IS_ON().
[chromium-blink-merge.git] / ui / compositor / test / draw_waiter_for_test.cc
blob7687d660830145c96f2a2d6a75af65448c4b3418
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/compositor/test/draw_waiter_for_test.h"
7 #include "ui/compositor/compositor.h"
9 namespace ui {
11 // static
12 void DrawWaiterForTest::Wait(Compositor* compositor) {
13 DrawWaiterForTest waiter;
14 waiter.wait_for_commit_ = false;
15 waiter.WaitImpl(compositor);
18 // static
19 void DrawWaiterForTest::WaitForCommit(Compositor* compositor) {
20 DrawWaiterForTest waiter;
21 waiter.wait_for_commit_ = true;
22 waiter.WaitImpl(compositor);
25 DrawWaiterForTest::DrawWaiterForTest() {
28 DrawWaiterForTest::~DrawWaiterForTest() {}
30 void DrawWaiterForTest::WaitImpl(Compositor* compositor) {
31 compositor->AddObserver(this);
32 wait_run_loop_.reset(new base::RunLoop());
33 wait_run_loop_->Run();
34 compositor->RemoveObserver(this);
37 void DrawWaiterForTest::OnCompositingDidCommit(Compositor* compositor) {
38 if (wait_for_commit_)
39 wait_run_loop_->Quit();
42 void DrawWaiterForTest::OnCompositingStarted(Compositor* compositor,
43 base::TimeTicks start_time) {
46 void DrawWaiterForTest::OnCompositingEnded(Compositor* compositor) {
47 if (!wait_for_commit_)
48 wait_run_loop_->Quit();
51 void DrawWaiterForTest::OnCompositingAborted(Compositor* compositor) {
54 void DrawWaiterForTest::OnCompositingLockStateChanged(Compositor* compositor) {}
56 } // namespace ui