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/test/ash_test_helper.h" | 14 #include "ash/test/ash_test_helper.h" |
15 #include "ash/test/display_manager_test_api.h" | 15 #include "ash/test/display_manager_test_api.h" |
16 #include "ash/test/test_session_state_delegate.h" | 16 #include "ash/test/test_session_state_delegate.h" |
17 #include "ash/test/test_shell_delegate.h" | 17 #include "ash/test/test_shell_delegate.h" |
18 #include "ash/wm/coordinate_conversion.h" | 18 #include "ash/wm/coordinate_conversion.h" |
19 #include "base/command_line.h" | 19 #include "base/command_line.h" |
20 #include "content/public/test/web_contents_tester.h" | 20 #include "content/public/test/web_contents_tester.h" |
21 #include "ui/aura/client/aura_constants.h" | 21 #include "ui/aura/client/aura_constants.h" |
22 #include "ui/aura/client/screen_position_client.h" | 22 #include "ui/aura/client/screen_position_client.h" |
| 23 #include "ui/aura/client/window_tree_client.h" |
23 #include "ui/aura/root_window.h" | 24 #include "ui/aura/root_window.h" |
24 #include "ui/aura/test/event_generator.h" | 25 #include "ui/aura/test/event_generator.h" |
25 #include "ui/aura/test/test_window_delegate.h" | 26 #include "ui/aura/test/test_window_delegate.h" |
26 #include "ui/aura/window.h" | 27 #include "ui/aura/window.h" |
27 #include "ui/aura/window_delegate.h" | 28 #include "ui/aura/window_delegate.h" |
28 #include "ui/base/ime/input_method_initializer.h" | 29 #include "ui/base/ime/input_method_initializer.h" |
29 #include "ui/gfx/display.h" | 30 #include "ui/gfx/display.h" |
30 #include "ui/gfx/point.h" | 31 #include "ui/gfx/point.h" |
31 #include "ui/gfx/screen.h" | 32 #include "ui/gfx/screen.h" |
32 | 33 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 aura::client::WindowType type, | 243 aura::client::WindowType type, |
243 int id, | 244 int id, |
244 const gfx::Rect& bounds) { | 245 const gfx::Rect& bounds) { |
245 aura::Window* window = new aura::Window(delegate); | 246 aura::Window* window = new aura::Window(delegate); |
246 window->set_id(id); | 247 window->set_id(id); |
247 window->SetType(type); | 248 window->SetType(type); |
248 window->Init(ui::LAYER_TEXTURED); | 249 window->Init(ui::LAYER_TEXTURED); |
249 window->Show(); | 250 window->Show(); |
250 | 251 |
251 if (bounds.IsEmpty()) { | 252 if (bounds.IsEmpty()) { |
252 SetDefaultParentByPrimaryRootWindow(window); | 253 ParentWindowInPrimaryRootWindow(window); |
253 } else { | 254 } else { |
254 gfx::Display display = | 255 gfx::Display display = |
255 Shell::GetScreen()->GetDisplayMatching(bounds); | 256 Shell::GetScreen()->GetDisplayMatching(bounds); |
256 aura::RootWindow* root = ash::Shell::GetInstance()->display_controller()-> | 257 aura::RootWindow* root = ash::Shell::GetInstance()->display_controller()-> |
257 GetRootWindowForDisplayId(display.id()); | 258 GetRootWindowForDisplayId(display.id()); |
258 gfx::Point origin = bounds.origin(); | 259 gfx::Point origin = bounds.origin(); |
259 wm::ConvertPointFromScreen(root, &origin); | 260 wm::ConvertPointFromScreen(root, &origin); |
260 window->SetBounds(gfx::Rect(origin, bounds.size())); | 261 window->SetBounds(gfx::Rect(origin, bounds.size())); |
261 window->SetDefaultParentByRootWindow(root, bounds); | 262 aura::client::ParentWindowWithContext(window, root, bounds); |
262 } | 263 } |
263 window->SetProperty(aura::client::kCanMaximizeKey, true); | 264 window->SetProperty(aura::client::kCanMaximizeKey, true); |
264 return window; | 265 return window; |
265 } | 266 } |
266 | 267 |
267 void AshTestBase::SetDefaultParentByPrimaryRootWindow(aura::Window* window) { | 268 void AshTestBase::ParentWindowInPrimaryRootWindow(aura::Window* window) { |
268 window->SetDefaultParentByRootWindow( | 269 aura::client::ParentWindowWithContext( |
269 Shell::GetPrimaryRootWindow(), gfx::Rect()); | 270 window, Shell::GetPrimaryRootWindow(), gfx::Rect()); |
270 } | 271 } |
271 | 272 |
272 void AshTestBase::RunAllPendingInMessageLoop() { | 273 void AshTestBase::RunAllPendingInMessageLoop() { |
273 ash_test_helper_->RunAllPendingInMessageLoop(); | 274 ash_test_helper_->RunAllPendingInMessageLoop(); |
274 } | 275 } |
275 | 276 |
276 TestScreenshotDelegate* AshTestBase::GetScreenshotDelegate() { | 277 TestScreenshotDelegate* AshTestBase::GetScreenshotDelegate() { |
277 return ash_test_helper_->test_screenshot_delegate(); | 278 return ash_test_helper_->test_screenshot_delegate(); |
278 } | 279 } |
279 | 280 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 | 321 |
321 void AshTestBase::UnblockUserSession() { | 322 void AshTestBase::UnblockUserSession() { |
322 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); | 323 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); |
323 SetSessionStarted(true); | 324 SetSessionStarted(true); |
324 SetUserAddingScreenRunning(false); | 325 SetUserAddingScreenRunning(false); |
325 } | 326 } |
326 | 327 |
327 | 328 |
328 } // namespace test | 329 } // namespace test |
329 } // namespace ash | 330 } // namespace ash |
OLD | NEW |