| 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 "chrome/test/base/view_event_test_base.h" | 5 #include "chrome/test/base/view_event_test_base.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "chrome/test/base/chrome_unit_test_suite.h" | 11 #include "chrome/test/base/chrome_unit_test_suite.h" |
| 12 #include "chrome/test/base/interactive_test_utils.h" | 12 #include "chrome/test/base/interactive_test_utils.h" |
| 13 #include "chrome/test/base/testing_browser_process.h" | 13 #include "chrome/test/base/testing_browser_process.h" |
| 14 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
| 15 #include "ui/aura/client/event_client.h" | 15 #include "ui/aura/client/event_client.h" |
| 16 #include "ui/aura/env.h" | 16 #include "ui/aura/env.h" |
| 17 #include "ui/aura/test/aura_test_helper.h" | 17 #include "ui/aura/test/aura_test_helper.h" |
| 18 #include "ui/aura/window_event_dispatcher.h" | 18 #include "ui/aura/window_event_dispatcher.h" |
| 19 #include "ui/aura/window_tree_host.h" | 19 #include "ui/aura/window_tree_host.h" |
| 20 #include "ui/base/ime/input_method_initializer.h" | 20 #include "ui/base/ime/input_method_initializer.h" |
| 21 #include "ui/base/test/ui_controls.h" | 21 #include "ui/base/test/ui_controls.h" |
| 22 #include "ui/compositor/test/context_factories_for_test.h" | 22 #include "ui/compositor/test/context_factories_for_test.h" |
| 23 #include "ui/compositor/test/context_factories_for_test.h" | 23 #include "ui/compositor/test/context_factories_for_test.h" |
| 24 #include "ui/message_center/message_center.h" | 24 #include "ui/message_center/message_center.h" |
| 25 #include "ui/views/view.h" | 25 #include "ui/views/view.h" |
| 26 #include "ui/views/widget/widget.h" | 26 #include "ui/views/widget/widget.h" |
| 27 #include "ui/wm/core/default_activation_client.h" | |
| 28 #include "ui/wm/core/wm_state.h" | 27 #include "ui/wm/core/wm_state.h" |
| 29 | 28 |
| 30 #if defined(USE_ASH) | 29 #if defined(USE_ASH) |
| 31 #include "ash/shell.h" | 30 #include "ash/shell.h" |
| 32 #include "ash/test/test_session_state_delegate.h" | 31 #include "ash/test/test_session_state_delegate.h" |
| 33 #include "ash/test/test_shell_delegate.h" | 32 #include "ash/test/test_shell_delegate.h" |
| 34 #endif | 33 #endif |
| 35 | 34 |
| 36 #if defined(OS_CHROMEOS) | 35 #if defined(OS_CHROMEOS) |
| 37 #include "chromeos/audio/cras_audio_handler.h" | 36 #include "chromeos/audio/cras_audio_handler.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 context = ash::Shell::GetPrimaryRootWindow(); | 133 context = ash::Shell::GetPrimaryRootWindow(); |
| 135 context->GetHost()->Show(); | 134 context->GetHost()->Show(); |
| 136 #endif // !OS_WIN | 135 #endif // !OS_WIN |
| 137 aura::Env::CreateInstance(); | 136 aura::Env::CreateInstance(); |
| 138 #elif defined(USE_AURA) | 137 #elif defined(USE_AURA) |
| 139 // Instead of using the ash shell, use an AuraTestHelper to create and manage | 138 // Instead of using the ash shell, use an AuraTestHelper to create and manage |
| 140 // the test screen. | 139 // the test screen. |
| 141 aura_test_helper_.reset( | 140 aura_test_helper_.reset( |
| 142 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); | 141 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); |
| 143 aura_test_helper_->SetUp(); | 142 aura_test_helper_->SetUp(); |
| 144 new wm::DefaultActivationClient(aura_test_helper_->root_window()); | |
| 145 context = aura_test_helper_->root_window(); | 143 context = aura_test_helper_->root_window(); |
| 146 #endif // !USE_ASH && USE_AURA | 144 #endif // !USE_ASH && USE_AURA |
| 147 | 145 |
| 148 window_ = views::Widget::CreateWindowWithContext(this, context); | 146 window_ = views::Widget::CreateWindowWithContext(this, context); |
| 149 } | 147 } |
| 150 | 148 |
| 151 void ViewEventTestBase::TearDown() { | 149 void ViewEventTestBase::TearDown() { |
| 152 if (window_) { | 150 if (window_) { |
| 153 window_->Close(); | 151 window_->Close(); |
| 154 content::RunAllPendingInMessageLoop(); | 152 content::RunAllPendingInMessageLoop(); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 dnd_thread_.reset(NULL); | 242 dnd_thread_.reset(NULL); |
| 245 } | 243 } |
| 246 | 244 |
| 247 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { | 245 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { |
| 248 StopBackgroundThread(); | 246 StopBackgroundThread(); |
| 249 | 247 |
| 250 task.Run(); | 248 task.Run(); |
| 251 if (HasFatalFailure()) | 249 if (HasFatalFailure()) |
| 252 Done(); | 250 Done(); |
| 253 } | 251 } |
| OLD | NEW |