| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "athena/test/athena_test_helper.h" | 5 #include "athena/test/athena_test_helper.h" |
| 6 | 6 |
| 7 #include "athena/main/athena_launcher.h" | 7 #include "athena/main/athena_launcher.h" |
| 8 #include "athena/test/sample_activity_factory.h" | 8 #include "athena/test/sample_activity_factory.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "ui/aura/client/aura_constants.h" | 11 #include "ui/aura/client/aura_constants.h" |
| 12 #include "ui/aura/env.h" | 12 #include "ui/aura/env.h" |
| 13 #include "ui/aura/input_state_lookup.h" | 13 #include "ui/aura/input_state_lookup.h" |
| 14 #include "ui/aura/test/env_test_helper.h" | 14 #include "ui/aura/test/env_test_helper.h" |
| 15 #include "ui/aura/test/test_focus_client.h" | 15 #include "ui/aura/test/test_focus_client.h" |
| 16 #include "ui/aura/test/test_screen.h" | 16 #include "ui/aura/test/test_screen.h" |
| 17 #include "ui/aura/window_event_dispatcher.h" | 17 #include "ui/aura/window_event_dispatcher.h" |
| 18 #include "ui/base/ime/input_method_initializer.h" | 18 #include "ui/base/ime/input_method_initializer.h" |
| 19 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 19 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| 20 #include "ui/gfx/screen.h" | 20 #include "ui/gfx/screen.h" |
| 21 #include "ui/wm/core/default_activation_client.h" | 21 #include "ui/wm/core/default_activation_client.h" |
| 22 #include "ui/wm/core/input_method_event_filter.h" | 22 #include "ui/wm/core/input_method_event_filter.h" |
| 23 | 23 |
| 24 #if defined(USE_X11) | 24 #if defined(USE_X11) |
| 25 #include "ui/aura/window_tree_host_x11.h" | |
| 26 #include "ui/base/x/x11_util.h" | 25 #include "ui/base/x/x11_util.h" |
| 27 #endif | 26 #endif |
| 28 | 27 |
| 29 namespace athena { | 28 namespace athena { |
| 30 namespace test { | 29 namespace test { |
| 31 | 30 |
| 32 AthenaTestHelper::AthenaTestHelper(base::MessageLoopForUI* message_loop) | 31 AthenaTestHelper::AthenaTestHelper(base::MessageLoopForUI* message_loop) |
| 33 : setup_called_(false), teardown_called_(false) { | 32 : setup_called_(false), teardown_called_(false) { |
| 34 DCHECK(message_loop); | 33 DCHECK(message_loop); |
| 35 message_loop_ = message_loop; | 34 message_loop_ = message_loop; |
| 36 // Disable animations during tests. | 35 // Disable animations during tests. |
| 37 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( | 36 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( |
| 38 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); | 37 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); |
| 39 #if defined(USE_X11) | |
| 40 aura::test::SetUseOverrideRedirectWindowByDefault(true); | |
| 41 #endif | |
| 42 } | 38 } |
| 43 | 39 |
| 44 AthenaTestHelper::~AthenaTestHelper() { | 40 AthenaTestHelper::~AthenaTestHelper() { |
| 45 CHECK(setup_called_) << "AthenaTestHelper::SetUp() never called."; | 41 CHECK(setup_called_) << "AthenaTestHelper::SetUp() never called."; |
| 46 CHECK(teardown_called_) << "AthenaTestHelper::TearDown() never called."; | 42 CHECK(teardown_called_) << "AthenaTestHelper::TearDown() never called."; |
| 47 } | 43 } |
| 48 | 44 |
| 49 void AthenaTestHelper::SetUp(ui::ContextFactory* context_factory) { | 45 void AthenaTestHelper::SetUp(ui::ContextFactory* context_factory) { |
| 50 setup_called_ = true; | 46 setup_called_ = true; |
| 51 | 47 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 102 |
| 107 void AthenaTestHelper::RunAllPendingInMessageLoop() { | 103 void AthenaTestHelper::RunAllPendingInMessageLoop() { |
| 108 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them | 104 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them |
| 109 // use run_loop.QuitClosure(). | 105 // use run_loop.QuitClosure(). |
| 110 base::RunLoop run_loop; | 106 base::RunLoop run_loop; |
| 111 run_loop.RunUntilIdle(); | 107 run_loop.RunUntilIdle(); |
| 112 } | 108 } |
| 113 | 109 |
| 114 } // namespace test | 110 } // namespace test |
| 115 } // namespace athena | 111 } // namespace athena |
| OLD | NEW |