| 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_capture_client.h" | 10 #include "ui/aura/client/default_capture_client.h" |
| 11 #include "ui/aura/client/focus_client.h" | 11 #include "ui/aura/client/focus_client.h" |
| 12 #include "ui/aura/env.h" | 12 #include "ui/aura/env.h" |
| 13 #include "ui/aura/focus_manager.h" | 13 #include "ui/aura/focus_manager.h" |
| 14 #include "ui/aura/root_window.h" | 14 #include "ui/aura/root_window.h" |
| 15 #include "ui/aura/test/test_activation_client.h" | 15 #include "ui/aura/test/test_activation_client.h" |
| 16 #include "ui/aura/test/test_screen.h" | 16 #include "ui/aura/test/test_screen.h" |
| 17 #include "ui/aura/test/test_stacking_client.h" | 17 #include "ui/aura/test/test_stacking_client.h" |
| 18 #include "ui/base/ime/dummy_input_method.h" | 18 #include "ui/base/ime/dummy_input_method.h" |
| 19 #include "ui/compositor/compositor.h" |
| 19 #include "ui/compositor/layer_animator.h" | 20 #include "ui/compositor/layer_animator.h" |
| 20 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 21 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| 21 #include "ui/gfx/screen.h" | 22 #include "ui/gfx/screen.h" |
| 22 | 23 |
| 23 #if defined(USE_X11) | 24 #if defined(USE_X11) |
| 24 #include "ui/aura/root_window_host_x11.h" | 25 #include "ui/aura/root_window_host_x11.h" |
| 25 #include "ui/base/x/x11_util.h" | 26 #include "ui/base/x/x11_util.h" |
| 26 #endif | 27 #endif |
| 27 | 28 |
| 28 #if defined(USE_OZONE) | 29 #if defined(USE_OZONE) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 52 | 53 |
| 53 AuraTestHelper::~AuraTestHelper() { | 54 AuraTestHelper::~AuraTestHelper() { |
| 54 CHECK(setup_called_) | 55 CHECK(setup_called_) |
| 55 << "AuraTestHelper::SetUp() never called."; | 56 << "AuraTestHelper::SetUp() never called."; |
| 56 CHECK(teardown_called_) | 57 CHECK(teardown_called_) |
| 57 << "AuraTestHelper::TearDown() never called."; | 58 << "AuraTestHelper::TearDown() never called."; |
| 58 } | 59 } |
| 59 | 60 |
| 60 void AuraTestHelper::SetUp() { | 61 void AuraTestHelper::SetUp() { |
| 61 setup_called_ = true; | 62 setup_called_ = true; |
| 63 |
| 64 // The ContextFactory must exist before any Compositors are created. |
| 65 bool allow_test_contexts = true; |
| 66 ui::Compositor::InitializeContextFactoryForTests(allow_test_contexts); |
| 67 |
| 62 Env::GetInstance(); | 68 Env::GetInstance(); |
| 63 test_screen_.reset(TestScreen::Create()); | 69 test_screen_.reset(TestScreen::Create()); |
| 64 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); | 70 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); |
| 65 root_window_.reset(test_screen_->CreateRootWindowForPrimaryDisplay()); | 71 root_window_.reset(test_screen_->CreateRootWindowForPrimaryDisplay()); |
| 66 | 72 |
| 67 focus_client_.reset(new FocusManager); | 73 focus_client_.reset(new FocusManager); |
| 68 client::SetFocusClient(root_window_.get(), focus_client_.get()); | 74 client::SetFocusClient(root_window_.get(), focus_client_.get()); |
| 69 stacking_client_.reset(new TestStackingClient(root_window_.get())); | 75 stacking_client_.reset(new TestStackingClient(root_window_.get())); |
| 70 test_activation_client_.reset( | 76 test_activation_client_.reset( |
| 71 new test::TestActivationClient(root_window_.get())); | 77 new test::TestActivationClient(root_window_.get())); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 102 #if !defined(OS_MACOSX) | 108 #if !defined(OS_MACOSX) |
| 103 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them | 109 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them |
| 104 // use run_loop.QuitClosure(). | 110 // use run_loop.QuitClosure(). |
| 105 base::RunLoop run_loop(Env::GetInstance()->GetDispatcher()); | 111 base::RunLoop run_loop(Env::GetInstance()->GetDispatcher()); |
| 106 run_loop.RunUntilIdle(); | 112 run_loop.RunUntilIdle(); |
| 107 #endif | 113 #endif |
| 108 } | 114 } |
| 109 | 115 |
| 110 } // namespace test | 116 } // namespace test |
| 111 } // namespace aura | 117 } // namespace aura |
| OLD | NEW |