Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: ash/test/ash_test_base.cc

Issue 584213002: Only do aggressive metro viewer termination in tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 #if defined(OS_WIN) 141 #if defined(OS_WIN)
142 if (!command_line->HasSwitch(ash::switches::kForceAshToDesktop)) { 142 if (!command_line->HasSwitch(ash::switches::kForceAshToDesktop)) {
143 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { 143 if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
144 ipc_thread_.reset(new base::Thread("test_metro_viewer_ipc_thread")); 144 ipc_thread_.reset(new base::Thread("test_metro_viewer_ipc_thread"));
145 base::Thread::Options options; 145 base::Thread::Options options;
146 options.message_loop_type = base::MessageLoop::TYPE_IO; 146 options.message_loop_type = base::MessageLoop::TYPE_IO;
147 ipc_thread_->StartWithOptions(options); 147 ipc_thread_->StartWithOptions(options);
148 metro_viewer_host_.reset( 148 metro_viewer_host_.reset(
149 new TestMetroViewerProcessHost(ipc_thread_->message_loop_proxy())); 149 new TestMetroViewerProcessHost(ipc_thread_->message_loop_proxy()));
150 CHECK(metro_viewer_host_->LaunchViewerAndWaitForConnection( 150 CHECK(metro_viewer_host_->LaunchViewerAndWaitForConnectionForTests(
151 win8::test::kDefaultTestAppUserModelId)); 151 win8::test::kDefaultTestAppUserModelId));
152 aura::RemoteWindowTreeHostWin* window_tree_host = 152 aura::RemoteWindowTreeHostWin* window_tree_host =
153 aura::RemoteWindowTreeHostWin::Instance(); 153 aura::RemoteWindowTreeHostWin::Instance();
154 CHECK(window_tree_host != NULL); 154 CHECK(window_tree_host != NULL);
155 } 155 }
156 ash::WindowPositioner::SetMaximizeFirstWindow(true); 156 ash::WindowPositioner::SetMaximizeFirstWindow(true);
157 } 157 }
158 #endif 158 #endif
159 } 159 }
160 160
(...skipping 14 matching lines...) Expand all
175 ash_test_helper_->TearDown(); 175 ash_test_helper_->TearDown();
176 #if defined(OS_WIN) 176 #if defined(OS_WIN)
177 ui::test::SetUsePopupAsRootWindowForTest(false); 177 ui::test::SetUsePopupAsRootWindowForTest(false);
178 // Kill the viewer process if we spun one up. 178 // Kill the viewer process if we spun one up.
179 metro_viewer_host_.reset(); 179 metro_viewer_host_.reset();
180 180
181 // Clean up any dangling viewer processes as the metro APIs sometimes leave 181 // Clean up any dangling viewer processes as the metro APIs sometimes leave
182 // zombies behind. A default browser process in metro will have the 182 // zombies behind. A default browser process in metro will have the
183 // following command line arg so use that to avoid killing all processes named 183 // following command line arg so use that to avoid killing all processes named
184 // win8::test::kDefaultTestExePath. 184 // win8::test::kDefaultTestExePath.
185 const wchar_t kViewerProcessArgument[] = L"DefaultBrowserServer"; 185 const wchar_t kViewerProcessArgument[] = L"DefaultBrowserServer";
ananta 2014/09/19 19:55:16 I think we can get rid of the code below which kil
Shrikant Kelkar 2014/09/19 20:03:12 I feel it's better to call kill/terminate from tes
186 base::KillAllNamedProcessesWithArgument(win8::test::kDefaultTestExePath, 186 base::KillAllNamedProcessesWithArgument(win8::test::kDefaultTestExePath,
187 kViewerProcessArgument); 187 kViewerProcessArgument);
Shrikant Kelkar 2014/09/19 19:42:28 We already have some cleanup logic here, wondering
scottmg 2014/09/19 19:44:15 Hmm, good point. Yes, we probably could just move
Shrikant Kelkar 2014/09/19 19:49:08 KillAll with DefaultBrowserServer should terminate
188 #endif 188 #endif
189 189
190 event_generator_.reset(); 190 event_generator_.reset();
191 // Some tests set an internal display id, 191 // Some tests set an internal display id,
192 // reset it here, so other tests will continue in a clean environment. 192 // reset it here, so other tests will continue in a clean environment.
193 gfx::Display::SetInternalDisplayId(gfx::Display::kInvalidDisplayID); 193 gfx::Display::SetInternalDisplayId(gfx::Display::kInvalidDisplayID);
194 } 194 }
195 195
196 ui::test::EventGenerator& AshTestBase::GetEventGenerator() { 196 ui::test::EventGenerator& AshTestBase::GetEventGenerator() {
197 if (!event_generator_) { 197 if (!event_generator_) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 336
337 void AshTestBase::UnblockUserSession() { 337 void AshTestBase::UnblockUserSession() {
338 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); 338 Shell::GetInstance()->session_state_delegate()->UnlockScreen();
339 SetSessionStarted(true); 339 SetSessionStarted(true);
340 SetUserAddingScreenRunning(false); 340 SetUserAddingScreenRunning(false);
341 } 341 }
342 342
343 343
344 } // namespace test 344 } // namespace test
345 } // namespace ash 345 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | win8/metro_driver/chrome_app_view_ash.cc » ('j') | win8/viewer/metro_viewer_process_host.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698