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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 << "You have overridden SetUp but never called AshTestBase::SetUp"; | 96 << "You have overridden SetUp but never called AshTestBase::SetUp"; |
97 CHECK(teardown_called_) | 97 CHECK(teardown_called_) |
98 << "You have overridden TearDown but never called AshTestBase::TearDown"; | 98 << "You have overridden TearDown but never called AshTestBase::TearDown"; |
99 } | 99 } |
100 | 100 |
101 void AshTestBase::SetUp() { | 101 void AshTestBase::SetUp() { |
102 setup_called_ = true; | 102 setup_called_ = true; |
103 // TODO(jamescook): Can we do this without changing command line? | 103 // TODO(jamescook): Can we do this without changing command line? |
104 // Use the origin (1,1) so that it doesn't over | 104 // Use the origin (1,1) so that it doesn't over |
105 // lap with the native mouse cursor. | 105 // lap with the native mouse cursor. |
106 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 106 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
107 switches::kAshHostWindowBounds, "1+1-800x600"); | 107 if (!command_line->HasSwitch(switches::kAshHostWindowBounds)) { |
| 108 command_line->AppendSwitchASCII( |
| 109 switches::kAshHostWindowBounds, "1+1-800x600"); |
| 110 } |
108 #if defined(OS_WIN) | 111 #if defined(OS_WIN) |
109 aura::test::SetUsePopupAsRootWindowForTest(true); | 112 aura::test::SetUsePopupAsRootWindowForTest(true); |
110 #endif | 113 #endif |
111 ash_test_helper_->SetUp(start_session_); | 114 ash_test_helper_->SetUp(start_session_); |
112 | 115 |
113 Shell::GetPrimaryRootWindow()->Show(); | 116 Shell::GetPrimaryRootWindow()->Show(); |
114 Shell::GetPrimaryRootWindow()->ShowRootWindow(); | 117 Shell::GetPrimaryRootWindow()->ShowRootWindow(); |
115 // Move the mouse cursor to far away so that native events doesn't | 118 // Move the mouse cursor to far away so that native events doesn't |
116 // interfere test expectations. | 119 // interfere test expectations. |
117 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); | 120 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); |
118 ash::Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); | 121 ash::Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); |
119 | 122 |
120 #if defined(OS_WIN) | 123 #if defined(OS_WIN) |
121 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && | 124 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && |
122 !CommandLine::ForCurrentProcess()->HasSwitch( | 125 !command_line->HasSwitch(ash::switches::kForceAshToDesktop)) { |
123 ash::switches::kForceAshToDesktop)) { | |
124 ipc_thread_.reset(new base::Thread("test_metro_viewer_ipc_thread")); | 126 ipc_thread_.reset(new base::Thread("test_metro_viewer_ipc_thread")); |
125 base::Thread::Options options; | 127 base::Thread::Options options; |
126 options.message_loop_type = base::MessageLoop::TYPE_IO; | 128 options.message_loop_type = base::MessageLoop::TYPE_IO; |
127 ipc_thread_->StartWithOptions(options); | 129 ipc_thread_->StartWithOptions(options); |
128 | 130 |
129 metro_viewer_host_.reset( | 131 metro_viewer_host_.reset( |
130 new TestMetroViewerProcessHost(ipc_thread_->message_loop_proxy())); | 132 new TestMetroViewerProcessHost(ipc_thread_->message_loop_proxy())); |
131 CHECK(metro_viewer_host_->LaunchViewerAndWaitForConnection( | 133 CHECK(metro_viewer_host_->LaunchViewerAndWaitForConnection( |
132 win8::test::kDefaultTestAppUserModelId)); | 134 win8::test::kDefaultTestAppUserModelId)); |
133 aura::RemoteRootWindowHostWin* root_window_host = | 135 aura::RemoteRootWindowHostWin* root_window_host = |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 316 |
315 void AshTestBase::UnblockUserSession() { | 317 void AshTestBase::UnblockUserSession() { |
316 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); | 318 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); |
317 SetSessionStarted(true); | 319 SetSessionStarted(true); |
318 SetUserAddingScreenRunning(false); | 320 SetUserAddingScreenRunning(false); |
319 } | 321 } |
320 | 322 |
321 | 323 |
322 } // namespace test | 324 } // namespace test |
323 } // namespace ash | 325 } // namespace ash |
OLD | NEW |