OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/aura/test/aura_test_helper.h" | 5 #include "ui/aura/test/aura_test_helper.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
10 #include "ui/aura/client/default_activation_client.h" | 10 #include "ui/aura/client/default_activation_client.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "ui/compositor/layer_animator.h" | 23 #include "ui/compositor/layer_animator.h" |
24 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 24 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
25 #include "ui/compositor/test/context_factories_for_test.h" | 25 #include "ui/compositor/test/context_factories_for_test.h" |
26 #include "ui/gfx/screen.h" | 26 #include "ui/gfx/screen.h" |
27 | 27 |
28 #if defined(USE_X11) | 28 #if defined(USE_X11) |
29 #include "ui/aura/root_window_host_x11.h" | 29 #include "ui/aura/root_window_host_x11.h" |
30 #include "ui/base/x/x11_util.h" | 30 #include "ui/base/x/x11_util.h" |
31 #endif | 31 #endif |
32 | 32 |
33 #if defined(USE_OZONE) | |
34 #include "ui/gfx/ozone/surface_factory_ozone.h" | |
35 #endif | |
36 | |
37 namespace aura { | 33 namespace aura { |
38 namespace test { | 34 namespace test { |
39 | 35 |
40 AuraTestHelper::AuraTestHelper(base::MessageLoopForUI* message_loop) | 36 AuraTestHelper::AuraTestHelper(base::MessageLoopForUI* message_loop) |
41 : setup_called_(false), | 37 : setup_called_(false), |
42 teardown_called_(false), | 38 teardown_called_(false), |
43 owns_root_window_(false) { | 39 owns_root_window_(false) { |
44 DCHECK(message_loop); | 40 DCHECK(message_loop); |
45 message_loop_ = message_loop; | 41 message_loop_ = message_loop; |
46 // Disable animations during tests. | 42 // Disable animations during tests. |
47 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( | 43 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( |
48 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); | 44 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); |
49 #if defined(USE_X11) | 45 #if defined(USE_X11) |
50 test::SetUseOverrideRedirectWindowByDefault(true); | 46 test::SetUseOverrideRedirectWindowByDefault(true); |
51 #endif | 47 #endif |
52 #if defined(USE_OZONE) | |
53 surface_factory_.reset(gfx::SurfaceFactoryOzone::CreateTestHelper()); | |
54 gfx::SurfaceFactoryOzone::SetInstance(surface_factory_.get()); | |
55 #endif | |
56 } | 48 } |
57 | 49 |
58 AuraTestHelper::~AuraTestHelper() { | 50 AuraTestHelper::~AuraTestHelper() { |
59 CHECK(setup_called_) | 51 CHECK(setup_called_) |
60 << "AuraTestHelper::SetUp() never called."; | 52 << "AuraTestHelper::SetUp() never called."; |
61 CHECK(teardown_called_) | 53 CHECK(teardown_called_) |
62 << "AuraTestHelper::TearDown() never called."; | 54 << "AuraTestHelper::TearDown() never called."; |
63 } | 55 } |
64 | 56 |
65 void AuraTestHelper::SetUp(bool allow_test_contexts) { | 57 void AuraTestHelper::SetUp(bool allow_test_contexts) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 114 |
123 void AuraTestHelper::RunAllPendingInMessageLoop() { | 115 void AuraTestHelper::RunAllPendingInMessageLoop() { |
124 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them | 116 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them |
125 // use run_loop.QuitClosure(). | 117 // use run_loop.QuitClosure(). |
126 base::RunLoop run_loop(Env::GetInstance()->GetDispatcher()); | 118 base::RunLoop run_loop(Env::GetInstance()->GetDispatcher()); |
127 run_loop.RunUntilIdle(); | 119 run_loop.RunUntilIdle(); |
128 } | 120 } |
129 | 121 |
130 } // namespace test | 122 } // namespace test |
131 } // namespace aura | 123 } // namespace aura |
OLD | NEW |