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" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "ash/test/test_shell_delegate.h" | 25 #include "ash/test/test_shell_delegate.h" |
26 #endif | 26 #endif |
27 | 27 |
28 #if defined(USE_AURA) | 28 #if defined(USE_AURA) |
29 #include "ui/aura/client/event_client.h" | 29 #include "ui/aura/client/event_client.h" |
30 #include "ui/aura/env.h" | 30 #include "ui/aura/env.h" |
31 #include "ui/aura/test/aura_test_helper.h" | 31 #include "ui/aura/test/aura_test_helper.h" |
32 #include "ui/aura/window_event_dispatcher.h" | 32 #include "ui/aura/window_event_dispatcher.h" |
33 #include "ui/aura/window_tree_host.h" | 33 #include "ui/aura/window_tree_host.h" |
34 #include "ui/compositor/test/context_factories_for_test.h" | 34 #include "ui/compositor/test/context_factories_for_test.h" |
| 35 #include "ui/wm/core/default_activation_client.h" |
35 #include "ui/wm/core/wm_state.h" | 36 #include "ui/wm/core/wm_state.h" |
36 #endif | 37 #endif |
37 | 38 |
38 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
39 #include "chromeos/audio/cras_audio_handler.h" | 40 #include "chromeos/audio/cras_audio_handler.h" |
40 #include "chromeos/dbus/dbus_thread_manager.h" | 41 #include "chromeos/dbus/dbus_thread_manager.h" |
41 #include "chromeos/network/network_handler.h" | 42 #include "chromeos/network/network_handler.h" |
42 #else // !defined(OS_CHROMEOS) | 43 #else // !defined(OS_CHROMEOS) |
43 #include "ui/views/widget/desktop_aura/desktop_screen.h" | 44 #include "ui/views/widget/desktop_aura/desktop_screen.h" |
44 #endif | 45 #endif |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 context = ash::Shell::GetPrimaryRootWindow(); | 141 context = ash::Shell::GetPrimaryRootWindow(); |
141 context->GetHost()->Show(); | 142 context->GetHost()->Show(); |
142 #endif // !OS_WIN | 143 #endif // !OS_WIN |
143 aura::Env::CreateInstance(); | 144 aura::Env::CreateInstance(); |
144 #elif defined(USE_AURA) | 145 #elif defined(USE_AURA) |
145 // Instead of using the ash shell, use an AuraTestHelper to create and manage | 146 // Instead of using the ash shell, use an AuraTestHelper to create and manage |
146 // the test screen. | 147 // the test screen. |
147 aura_test_helper_.reset( | 148 aura_test_helper_.reset( |
148 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); | 149 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); |
149 aura_test_helper_->SetUp(); | 150 aura_test_helper_->SetUp(); |
| 151 new wm::DefaultActivationClient(aura_test_helper_->root_window()); |
150 context = aura_test_helper_->root_window(); | 152 context = aura_test_helper_->root_window(); |
151 #endif // !USE_ASH && USE_AURA | 153 #endif // !USE_ASH && USE_AURA |
152 | 154 |
153 window_ = views::Widget::CreateWindowWithContext(this, context); | 155 window_ = views::Widget::CreateWindowWithContext(this, context); |
154 } | 156 } |
155 | 157 |
156 void ViewEventTestBase::TearDown() { | 158 void ViewEventTestBase::TearDown() { |
157 if (window_) { | 159 if (window_) { |
158 window_->Close(); | 160 window_->Close(); |
159 content::RunAllPendingInMessageLoop(); | 161 content::RunAllPendingInMessageLoop(); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 dnd_thread_.reset(NULL); | 255 dnd_thread_.reset(NULL); |
254 } | 256 } |
255 | 257 |
256 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { | 258 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { |
257 StopBackgroundThread(); | 259 StopBackgroundThread(); |
258 | 260 |
259 task.Run(); | 261 task.Run(); |
260 if (HasFatalFailure()) | 262 if (HasFatalFailure()) |
261 Done(); | 263 Done(); |
262 } | 264 } |
OLD | NEW |