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" |
11 #include "ash/display/display_controller.h" | 11 #include "ash/display/display_controller.h" |
12 #include "ash/screen_ash.h" | 12 #include "ash/screen_ash.h" |
13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
14 #include "ash/shell/toplevel_window.h" | 14 #include "ash/shell/toplevel_window.h" |
15 #include "ash/test/ash_test_helper.h" | 15 #include "ash/test/ash_test_helper.h" |
16 #include "ash/test/display_manager_test_api.h" | 16 #include "ash/test/display_manager_test_api.h" |
17 #include "ash/test/test_session_state_delegate.h" | 17 #include "ash/test/test_session_state_delegate.h" |
18 #include "ash/test/test_shell_delegate.h" | 18 #include "ash/test/test_shell_delegate.h" |
19 #include "ash/wm/coordinate_conversion.h" | 19 #include "ash/wm/coordinate_conversion.h" |
| 20 #include "ash/wm/window_positioner.h" |
20 #include "base/command_line.h" | 21 #include "base/command_line.h" |
21 #include "content/public/test/web_contents_tester.h" | 22 #include "content/public/test/web_contents_tester.h" |
22 #include "ui/aura/client/aura_constants.h" | 23 #include "ui/aura/client/aura_constants.h" |
23 #include "ui/aura/client/screen_position_client.h" | 24 #include "ui/aura/client/screen_position_client.h" |
24 #include "ui/aura/client/window_tree_client.h" | 25 #include "ui/aura/client/window_tree_client.h" |
25 #include "ui/aura/root_window.h" | 26 #include "ui/aura/root_window.h" |
26 #include "ui/aura/test/event_generator.h" | 27 #include "ui/aura/test/event_generator.h" |
27 #include "ui/aura/test/test_window_delegate.h" | 28 #include "ui/aura/test/test_window_delegate.h" |
28 #include "ui/aura/window.h" | 29 #include "ui/aura/window.h" |
29 #include "ui/aura/window_delegate.h" | 30 #include "ui/aura/window_delegate.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 ash_test_helper_->SetUp(start_session_); | 122 ash_test_helper_->SetUp(start_session_); |
122 | 123 |
123 Shell::GetPrimaryRootWindow()->Show(); | 124 Shell::GetPrimaryRootWindow()->Show(); |
124 Shell::GetPrimaryRootWindow()->GetDispatcher()->ShowRootWindow(); | 125 Shell::GetPrimaryRootWindow()->GetDispatcher()->ShowRootWindow(); |
125 // Move the mouse cursor to far away so that native events doesn't | 126 // Move the mouse cursor to far away so that native events doesn't |
126 // interfere test expectations. | 127 // interfere test expectations. |
127 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); | 128 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); |
128 ash::Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); | 129 ash::Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); |
129 | 130 |
130 #if defined(OS_WIN) | 131 #if defined(OS_WIN) |
131 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && | 132 if (!command_line->HasSwitch(ash::switches::kForceAshToDesktop)) { |
132 !command_line->HasSwitch(ash::switches::kForceAshToDesktop)) { | 133 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
133 ipc_thread_.reset(new base::Thread("test_metro_viewer_ipc_thread")); | 134 ipc_thread_.reset(new base::Thread("test_metro_viewer_ipc_thread")); |
134 base::Thread::Options options; | 135 base::Thread::Options options; |
135 options.message_loop_type = base::MessageLoop::TYPE_IO; | 136 options.message_loop_type = base::MessageLoop::TYPE_IO; |
136 ipc_thread_->StartWithOptions(options); | 137 ipc_thread_->StartWithOptions(options); |
137 | 138 metro_viewer_host_.reset( |
138 metro_viewer_host_.reset( | 139 new TestMetroViewerProcessHost(ipc_thread_->message_loop_proxy())); |
139 new TestMetroViewerProcessHost(ipc_thread_->message_loop_proxy())); | 140 CHECK(metro_viewer_host_->LaunchViewerAndWaitForConnection( |
140 CHECK(metro_viewer_host_->LaunchViewerAndWaitForConnection( | 141 win8::test::kDefaultTestAppUserModelId, |
141 win8::test::kDefaultTestAppUserModelId)); | 142 L"test_open")); |
142 aura::RemoteRootWindowHostWin* root_window_host = | 143 aura::RemoteRootWindowHostWin* root_window_host = |
143 aura::RemoteRootWindowHostWin::Instance(); | 144 aura::RemoteRootWindowHostWin::Instance(); |
144 CHECK(root_window_host != NULL); | 145 CHECK(root_window_host != NULL); |
| 146 } |
| 147 ash::WindowPositioner::SetMaximizeFirstWindow(true); |
145 } | 148 } |
146 #endif | 149 #endif |
147 } | 150 } |
148 | 151 |
149 void AshTestBase::TearDown() { | 152 void AshTestBase::TearDown() { |
150 teardown_called_ = true; | 153 teardown_called_ = true; |
151 // Flush the message loop to finish pending release tasks. | 154 // Flush the message loop to finish pending release tasks. |
152 RunAllPendingInMessageLoop(); | 155 RunAllPendingInMessageLoop(); |
153 | 156 |
154 #if defined(OS_WIN) | 157 #if defined(OS_WIN) |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 335 |
333 void AshTestBase::UnblockUserSession() { | 336 void AshTestBase::UnblockUserSession() { |
334 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); | 337 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); |
335 SetSessionStarted(true); | 338 SetSessionStarted(true); |
336 SetUserAddingScreenRunning(false); | 339 SetUserAddingScreenRunning(false); |
337 } | 340 } |
338 | 341 |
339 | 342 |
340 } // namespace test | 343 } // namespace test |
341 } // namespace ash | 344 } // namespace ash |
OLD | NEW |