| 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 "ash/test/ash_test_base.h" | 5 #include "ash/test/ash_test_base.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "ui/aura/env.h" | 23 #include "ui/aura/env.h" |
| 24 #include "ui/aura/root_window.h" | 24 #include "ui/aura/root_window.h" |
| 25 #include "ui/aura/test/event_generator.h" | 25 #include "ui/aura/test/event_generator.h" |
| 26 #include "ui/aura/test/test_window_delegate.h" | 26 #include "ui/aura/test/test_window_delegate.h" |
| 27 #include "ui/aura/window_delegate.h" | 27 #include "ui/aura/window_delegate.h" |
| 28 #include "ui/base/ime/text_input_test_support.h" | 28 #include "ui/base/ime/text_input_test_support.h" |
| 29 #include "ui/compositor/layer_animator.h" | 29 #include "ui/compositor/layer_animator.h" |
| 30 #include "ui/gfx/display.h" | 30 #include "ui/gfx/display.h" |
| 31 #include "ui/gfx/screen.h" | 31 #include "ui/gfx/screen.h" |
| 32 | 32 |
| 33 #if defined(ENABLE_MESSAGE_CENTER) |
| 34 #include "ui/message_center/message_center.h" |
| 35 #endif |
| 36 |
| 33 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
| 34 #include "ash/test/test_metro_viewer_process_host.h" | 38 #include "ash/test/test_metro_viewer_process_host.h" |
| 35 #include "base/test/test_process_killer_win.h" | 39 #include "base/test/test_process_killer_win.h" |
| 36 #include "base/win/windows_version.h" | 40 #include "base/win/windows_version.h" |
| 37 #include "ui/aura/remote_root_window_host_win.h" | 41 #include "ui/aura/remote_root_window_host_win.h" |
| 38 #include "ui/aura/root_window_host_win.h" | 42 #include "ui/aura/root_window_host_win.h" |
| 39 #include "win8/test/test_registrar_constants.h" | 43 #include "win8/test/test_registrar_constants.h" |
| 40 #endif | 44 #endif |
| 41 | 45 |
| 42 namespace ash { | 46 namespace ash { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 switches::kAshHostWindowBounds, "1+1-800x600"); | 93 switches::kAshHostWindowBounds, "1+1-800x600"); |
| 90 #if defined(OS_WIN) | 94 #if defined(OS_WIN) |
| 91 aura::test::SetUsePopupAsRootWindowForTest(true); | 95 aura::test::SetUsePopupAsRootWindowForTest(true); |
| 92 #endif | 96 #endif |
| 93 // Disable animations during tests. | 97 // Disable animations during tests. |
| 94 ui::LayerAnimator::set_disable_animations_for_test(true); | 98 ui::LayerAnimator::set_disable_animations_for_test(true); |
| 95 ui::TextInputTestSupport::Initialize(); | 99 ui::TextInputTestSupport::Initialize(); |
| 96 | 100 |
| 97 // Creates Shell and hook with Desktop. | 101 // Creates Shell and hook with Desktop. |
| 98 test_shell_delegate_ = new TestShellDelegate; | 102 test_shell_delegate_ = new TestShellDelegate; |
| 103 |
| 104 #if defined(ENABLE_MESSAGE_CENTER) |
| 105 // Creates MessageCenter since g_browser_process is not created in AshTestBase |
| 106 // tests. |
| 107 message_center::MessageCenter::Initialize(); |
| 108 #endif |
| 99 ash::Shell::CreateInstance(test_shell_delegate_); | 109 ash::Shell::CreateInstance(test_shell_delegate_); |
| 100 Shell::GetPrimaryRootWindow()->Show(); | 110 Shell::GetPrimaryRootWindow()->Show(); |
| 101 Shell::GetPrimaryRootWindow()->ShowRootWindow(); | 111 Shell::GetPrimaryRootWindow()->ShowRootWindow(); |
| 102 // Move the mouse cursor to far away so that native events doesn't | 112 // Move the mouse cursor to far away so that native events doesn't |
| 103 // interfere test expectations. | 113 // interfere test expectations. |
| 104 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); | 114 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); |
| 105 Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); | 115 Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); |
| 106 | 116 |
| 107 #if defined(OS_WIN) | 117 #if defined(OS_WIN) |
| 108 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { | 118 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 123 | 133 |
| 124 #if defined(OS_WIN) | 134 #if defined(OS_WIN) |
| 125 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { | 135 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
| 126 // Check that our viewer connection is still established. | 136 // Check that our viewer connection is still established. |
| 127 ASSERT_FALSE(metro_viewer_host_->closed_unexpectedly()); | 137 ASSERT_FALSE(metro_viewer_host_->closed_unexpectedly()); |
| 128 } | 138 } |
| 129 #endif | 139 #endif |
| 130 | 140 |
| 131 // Tear down the shell. | 141 // Tear down the shell. |
| 132 Shell::DeleteInstance(); | 142 Shell::DeleteInstance(); |
| 143 |
| 144 #if defined(ENABLE_MESSAGE_CENTER) |
| 145 // Remove global message center state. |
| 146 message_center::MessageCenter::Shutdown(); |
| 147 #endif |
| 148 |
| 133 aura::Env::DeleteInstance(); | 149 aura::Env::DeleteInstance(); |
| 134 ui::TextInputTestSupport::Shutdown(); | 150 ui::TextInputTestSupport::Shutdown(); |
| 135 | 151 |
| 136 #if defined(OS_WIN) | 152 #if defined(OS_WIN) |
| 137 aura::test::SetUsePopupAsRootWindowForTest(false); | 153 aura::test::SetUsePopupAsRootWindowForTest(false); |
| 138 // Kill the viewer process if we spun one up. | 154 // Kill the viewer process if we spun one up. |
| 139 metro_viewer_host_.reset(); | 155 metro_viewer_host_.reset(); |
| 140 | 156 |
| 141 // Clean up any dangling viewer processes as the metro APIs sometimes leave | 157 // Clean up any dangling viewer processes as the metro APIs sometimes leave |
| 142 // zombies behind. A default browser process in metro will have the | 158 // zombies behind. A default browser process in metro will have the |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 void AshTestBase::SetUserLoggedIn(bool user_logged_in) { | 265 void AshTestBase::SetUserLoggedIn(bool user_logged_in) { |
| 250 test_shell_delegate_->SetUserLoggedIn(user_logged_in); | 266 test_shell_delegate_->SetUserLoggedIn(user_logged_in); |
| 251 } | 267 } |
| 252 | 268 |
| 253 void AshTestBase::SetCanLockScreen(bool can_lock_screen) { | 269 void AshTestBase::SetCanLockScreen(bool can_lock_screen) { |
| 254 test_shell_delegate_->SetCanLockScreen(can_lock_screen); | 270 test_shell_delegate_->SetCanLockScreen(can_lock_screen); |
| 255 } | 271 } |
| 256 | 272 |
| 257 } // namespace test | 273 } // namespace test |
| 258 } // namespace ash | 274 } // namespace ash |
| OLD | NEW |