| 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" |
| 27 #include "ui/wm/core/wm_state.h" | 28 #include "ui/wm/core/wm_state.h" |
| 28 | 29 |
| 29 #if defined(USE_ASH) | 30 #if defined(USE_ASH) |
| 30 #include "ash/shell.h" | 31 #include "ash/shell.h" |
| 31 #include "ash/test/test_session_state_delegate.h" | 32 #include "ash/test/test_session_state_delegate.h" |
| 32 #include "ash/test/test_shell_delegate.h" | 33 #include "ash/test/test_shell_delegate.h" |
| 33 #endif | 34 #endif |
| 34 | 35 |
| 35 #if defined(OS_CHROMEOS) | 36 #if defined(OS_CHROMEOS) |
| 36 #include "chromeos/audio/cras_audio_handler.h" | 37 #include "chromeos/audio/cras_audio_handler.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 context = ash::Shell::GetPrimaryRootWindow(); | 134 context = ash::Shell::GetPrimaryRootWindow(); |
| 134 context->GetHost()->Show(); | 135 context->GetHost()->Show(); |
| 135 #endif // !OS_WIN | 136 #endif // !OS_WIN |
| 136 aura::Env::CreateInstance(); | 137 aura::Env::CreateInstance(); |
| 137 #elif defined(USE_AURA) | 138 #elif defined(USE_AURA) |
| 138 // Instead of using the ash shell, use an AuraTestHelper to create and manage | 139 // Instead of using the ash shell, use an AuraTestHelper to create and manage |
| 139 // the test screen. | 140 // the test screen. |
| 140 aura_test_helper_.reset( | 141 aura_test_helper_.reset( |
| 141 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); | 142 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); |
| 142 aura_test_helper_->SetUp(); | 143 aura_test_helper_->SetUp(); |
| 144 new wm::DefaultActivationClient(aura_test_helper_->root_window()); |
| 143 context = aura_test_helper_->root_window(); | 145 context = aura_test_helper_->root_window(); |
| 144 #endif // !USE_ASH && USE_AURA | 146 #endif // !USE_ASH && USE_AURA |
| 145 | 147 |
| 146 window_ = views::Widget::CreateWindowWithContext(this, context); | 148 window_ = views::Widget::CreateWindowWithContext(this, context); |
| 147 } | 149 } |
| 148 | 150 |
| 149 void ViewEventTestBase::TearDown() { | 151 void ViewEventTestBase::TearDown() { |
| 150 if (window_) { | 152 if (window_) { |
| 151 window_->Close(); | 153 window_->Close(); |
| 152 content::RunAllPendingInMessageLoop(); | 154 content::RunAllPendingInMessageLoop(); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 dnd_thread_.reset(NULL); | 244 dnd_thread_.reset(NULL); |
| 243 } | 245 } |
| 244 | 246 |
| 245 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { | 247 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { |
| 246 StopBackgroundThread(); | 248 StopBackgroundThread(); |
| 247 | 249 |
| 248 task.Run(); | 250 task.Run(); |
| 249 if (HasFatalFailure()) | 251 if (HasFatalFailure()) |
| 250 Done(); | 252 Done(); |
| 251 } | 253 } |
| OLD | NEW |