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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 namespace { | 48 namespace { |
49 | 49 |
50 class AshEventGeneratorDelegate : public aura::test::EventGeneratorDelegate { | 50 class AshEventGeneratorDelegate : public aura::test::EventGeneratorDelegate { |
51 public: | 51 public: |
52 AshEventGeneratorDelegate() {} | 52 AshEventGeneratorDelegate() {} |
53 virtual ~AshEventGeneratorDelegate() {} | 53 virtual ~AshEventGeneratorDelegate() {} |
54 | 54 |
55 // aura::test::EventGeneratorDelegate overrides: | 55 // aura::test::EventGeneratorDelegate overrides: |
56 virtual aura::RootWindow* GetRootWindowAt( | 56 virtual aura::RootWindow* GetRootWindowAt( |
57 const gfx::Point& point_in_screen) const OVERRIDE { | 57 const gfx::Point& point_in_screen) const OVERRIDE { |
58 gfx::Screen* screen = Shell::GetInstance()->screen(); | 58 gfx::Screen* screen = Shell::GetScreen(); |
59 gfx::Display display = screen->GetDisplayNearestPoint(point_in_screen); | 59 gfx::Display display = screen->GetDisplayNearestPoint(point_in_screen); |
60 return Shell::GetInstance()->display_controller()-> | 60 return Shell::GetInstance()->display_controller()-> |
61 GetRootWindowForDisplayId(display.id()); | 61 GetRootWindowForDisplayId(display.id()); |
62 } | 62 } |
63 | 63 |
64 virtual aura::client::ScreenPositionClient* GetScreenPositionClient( | 64 virtual aura::client::ScreenPositionClient* GetScreenPositionClient( |
65 const aura::Window* window) const OVERRIDE { | 65 const aura::Window* window) const OVERRIDE { |
66 return aura::client::GetScreenPositionClient(window->GetRootWindow()); | 66 return aura::client::GetScreenPositionClient(window->GetRootWindow()); |
67 } | 67 } |
68 | 68 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 // Creates Shell and hook with Desktop. | 101 // Creates Shell and hook with Desktop. |
102 test_shell_delegate_ = new TestShellDelegate; | 102 test_shell_delegate_ = new TestShellDelegate; |
103 | 103 |
104 #if defined(ENABLE_MESSAGE_CENTER) | 104 #if defined(ENABLE_MESSAGE_CENTER) |
105 // Creates MessageCenter since g_browser_process is not created in AshTestBase | 105 // Creates MessageCenter since g_browser_process is not created in AshTestBase |
106 // tests. | 106 // tests. |
107 message_center::MessageCenter::Initialize(); | 107 message_center::MessageCenter::Initialize(); |
108 #endif | 108 #endif |
109 ash::Shell::CreateInstance(test_shell_delegate_); | 109 ash::Shell::CreateInstance(test_shell_delegate_); |
| 110 Shell* shell = Shell::GetInstance(); |
| 111 test::DisplayManagerTestApi(shell->display_manager()). |
| 112 DisableChangeDisplayUponHostResize(); |
| 113 |
110 Shell::GetPrimaryRootWindow()->Show(); | 114 Shell::GetPrimaryRootWindow()->Show(); |
111 Shell::GetPrimaryRootWindow()->ShowRootWindow(); | 115 Shell::GetPrimaryRootWindow()->ShowRootWindow(); |
112 // Move the mouse cursor to far away so that native events doesn't | 116 // Move the mouse cursor to far away so that native events doesn't |
113 // interfere test expectations. | 117 // interfere test expectations. |
114 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); | 118 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); |
115 Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); | 119 shell->cursor_manager()->EnableMouseEvents(); |
116 | 120 |
117 #if defined(OS_WIN) | 121 #if defined(OS_WIN) |
118 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { | 122 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
119 metro_viewer_host_.reset(new TestMetroViewerProcessHost("viewer")); | 123 metro_viewer_host_.reset(new TestMetroViewerProcessHost("viewer")); |
120 ASSERT_TRUE( | 124 ASSERT_TRUE( |
121 metro_viewer_host_->LaunchViewerAndWaitForConnection( | 125 metro_viewer_host_->LaunchViewerAndWaitForConnection( |
122 win8::test::kDefaultTestAppUserModelId)); | 126 win8::test::kDefaultTestAppUserModelId)); |
123 aura::RemoteRootWindowHostWin* root_window_host = | 127 aura::RemoteRootWindowHostWin* root_window_host = |
124 aura::RemoteRootWindowHostWin::Instance(); | 128 aura::RemoteRootWindowHostWin::Instance(); |
125 ASSERT_TRUE(root_window_host != NULL); | 129 ASSERT_TRUE(root_window_host != NULL); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 void AshTestBase::SetUserLoggedIn(bool user_logged_in) { | 269 void AshTestBase::SetUserLoggedIn(bool user_logged_in) { |
266 test_shell_delegate_->SetUserLoggedIn(user_logged_in); | 270 test_shell_delegate_->SetUserLoggedIn(user_logged_in); |
267 } | 271 } |
268 | 272 |
269 void AshTestBase::SetCanLockScreen(bool can_lock_screen) { | 273 void AshTestBase::SetCanLockScreen(bool can_lock_screen) { |
270 test_shell_delegate_->SetCanLockScreen(can_lock_screen); | 274 test_shell_delegate_->SetCanLockScreen(can_lock_screen); |
271 } | 275 } |
272 | 276 |
273 } // namespace test | 277 } // namespace test |
274 } // namespace ash | 278 } // namespace ash |
OLD | NEW |