| 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" | |
| 20 #include "ui/compositor/layer_animator.h" | 19 #include "ui/compositor/layer_animator.h" |
| 21 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 20 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| 22 #include "ui/gfx/screen.h" | 21 #include "ui/gfx/screen.h" |
| 23 | 22 |
| 24 #if defined(USE_X11) | 23 #if defined(USE_X11) |
| 25 #include "ui/aura/root_window_host_x11.h" | 24 #include "ui/aura/root_window_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 #if defined(USE_OZONE) | 28 #if defined(USE_OZONE) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 53 | 52 |
| 54 AuraTestHelper::~AuraTestHelper() { | 53 AuraTestHelper::~AuraTestHelper() { |
| 55 CHECK(setup_called_) | 54 CHECK(setup_called_) |
| 56 << "AuraTestHelper::SetUp() never called."; | 55 << "AuraTestHelper::SetUp() never called."; |
| 57 CHECK(teardown_called_) | 56 CHECK(teardown_called_) |
| 58 << "AuraTestHelper::TearDown() never called."; | 57 << "AuraTestHelper::TearDown() never called."; |
| 59 } | 58 } |
| 60 | 59 |
| 61 void AuraTestHelper::SetUp() { | 60 void AuraTestHelper::SetUp() { |
| 62 setup_called_ = true; | 61 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 | |
| 68 Env::GetInstance(); | 62 Env::GetInstance(); |
| 69 test_screen_.reset(TestScreen::Create()); | 63 test_screen_.reset(TestScreen::Create()); |
| 70 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); | 64 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); |
| 71 root_window_.reset(test_screen_->CreateRootWindowForPrimaryDisplay()); | 65 root_window_.reset(test_screen_->CreateRootWindowForPrimaryDisplay()); |
| 72 | 66 |
| 73 focus_client_.reset(new FocusManager); | 67 focus_client_.reset(new FocusManager); |
| 74 client::SetFocusClient(root_window_.get(), focus_client_.get()); | 68 client::SetFocusClient(root_window_.get(), focus_client_.get()); |
| 75 stacking_client_.reset(new TestStackingClient(root_window_.get())); | 69 stacking_client_.reset(new TestStackingClient(root_window_.get())); |
| 76 test_activation_client_.reset( | 70 test_activation_client_.reset( |
| 77 new test::TestActivationClient(root_window_.get())); | 71 new test::TestActivationClient(root_window_.get())); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 108 #if !defined(OS_MACOSX) | 102 #if !defined(OS_MACOSX) |
| 109 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them | 103 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them |
| 110 // use run_loop.QuitClosure(). | 104 // use run_loop.QuitClosure(). |
| 111 base::RunLoop run_loop(Env::GetInstance()->GetDispatcher()); | 105 base::RunLoop run_loop(Env::GetInstance()->GetDispatcher()); |
| 112 run_loop.RunUntilIdle(); | 106 run_loop.RunUntilIdle(); |
| 113 #endif | 107 #endif |
| 114 } | 108 } |
| 115 | 109 |
| 116 } // namespace test | 110 } // namespace test |
| 117 } // namespace aura | 111 } // namespace aura |
| OLD | NEW |