blob: dd3f73ae88af972820692093a0a0364736fa8839 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/aura/test/aura_test_helper.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/gfx/compositor/layer_animator.h"
namespace aura {
namespace test {
AuraTestHelper::AuraTestHelper()
: setup_called_(false),
teardown_called_(false) {
// Disable animations during tests.
ui::LayerAnimator::set_disable_animations_for_test(true);
}
AuraTestHelper::~AuraTestHelper() {
CHECK(setup_called_)
<< "You have overridden SetUp but never called super class's SetUp";
CHECK(teardown_called_)
<< "You have overridden TearDown but never called super class's TearDown";
aura::Env::DeleteInstance();
}
void AuraTestHelper::InitRootWindow(RootWindow* root_window) {
root_window->Show();
// Ensure width != height so tests won't confuse them.
root_window->SetHostSize(gfx::Size(800, 600));
}
void AuraTestHelper::SetUp() {
setup_called_ = true;
}
void AuraTestHelper::TearDown() {
teardown_called_ = true;
}
void AuraTestHelper::RunAllPendingInMessageLoop(RootWindow* root_window) {
#if !defined(OS_MACOSX)
message_loop_.RunAllPendingWithDispatcher(
Env::GetInstance()->GetDispatcher());
#endif
}
} // namespace test
} // namespace aura
|