Roll src/third_party/skia 591a2ca:b3fe1b8
[chromium-blink-merge.git] / ui / compositor / test / draw_waiter_for_test.cc
blob92f6698bf3dfa0ed9e5ebd465a39b8ad1aea7028
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::WaitForCompositingStarted(Compositor* compositor) {
13 DrawWaiterForTest waiter(WAIT_FOR_COMPOSITING_STARTED);
14 waiter.WaitImpl(compositor);
17 void DrawWaiterForTest::WaitForCompositingEnded(Compositor* compositor) {
18 DrawWaiterForTest waiter(WAIT_FOR_COMPOSITING_ENDED);
19 waiter.WaitImpl(compositor);
22 // static
23 void DrawWaiterForTest::WaitForCommit(Compositor* compositor) {
24 DrawWaiterForTest waiter(WAIT_FOR_COMMIT);
25 waiter.WaitImpl(compositor);
28 DrawWaiterForTest::DrawWaiterForTest(WaitEvent wait_event)
29 : wait_event_(wait_event) {
32 DrawWaiterForTest::~DrawWaiterForTest() {}
34 void DrawWaiterForTest::WaitImpl(Compositor* compositor) {
35 compositor->AddObserver(this);
36 wait_run_loop_.reset(new base::RunLoop());
37 wait_run_loop_->Run();
38 compositor->RemoveObserver(this);
41 void DrawWaiterForTest::OnCompositingDidCommit(Compositor* compositor) {
42 if (wait_event_ == WAIT_FOR_COMMIT)
43 wait_run_loop_->Quit();
46 void DrawWaiterForTest::OnCompositingStarted(Compositor* compositor,
47 base::TimeTicks start_time) {
48 if (wait_event_ == WAIT_FOR_COMPOSITING_STARTED)
49 wait_run_loop_->Quit();
52 void DrawWaiterForTest::OnCompositingEnded(Compositor* compositor) {
53 if (wait_event_ == WAIT_FOR_COMPOSITING_ENDED)
54 wait_run_loop_->Quit();
57 void DrawWaiterForTest::OnCompositingAborted(Compositor* compositor) {
60 void DrawWaiterForTest::OnCompositingLockStateChanged(Compositor* compositor) {}
62 void DrawWaiterForTest::OnCompositingShuttingDown(Compositor* compositor) {}
64 } // namespace ui