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

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

Issue 12314043: Make Ash unittests clean up zombie viewer processes between test runs. These zombie viewer proce… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/base.gyp » ('j') | base/test/test_process_util_win.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 14 matching lines...) Expand all
25 #include "ui/aura/test/event_generator.h" 25 #include "ui/aura/test/event_generator.h"
26 #include "ui/aura/test/test_window_delegate.h" 26 #include "ui/aura/test/test_window_delegate.h"
27 #include "ui/aura/window_delegate.h" 27 #include "ui/aura/window_delegate.h"
28 #include "ui/base/ime/text_input_test_support.h" 28 #include "ui/base/ime/text_input_test_support.h"
29 #include "ui/compositor/layer_animator.h" 29 #include "ui/compositor/layer_animator.h"
30 #include "ui/gfx/display.h" 30 #include "ui/gfx/display.h"
31 #include "ui/gfx/screen.h" 31 #include "ui/gfx/screen.h"
32 32
33 #if defined(OS_WIN) 33 #if defined(OS_WIN)
34 #include "ash/test/test_metro_viewer_process_host.h" 34 #include "ash/test/test_metro_viewer_process_host.h"
35 #include "base/test/test_process_util_win.h"
35 #include "base/win/windows_version.h" 36 #include "base/win/windows_version.h"
36 #include "ui/aura/remote_root_window_host_win.h" 37 #include "ui/aura/remote_root_window_host_win.h"
37 #include "ui/aura/root_window_host_win.h" 38 #include "ui/aura/root_window_host_win.h"
38 #include "win8/test/test_registrar_constants.h" 39 #include "win8/test/test_registrar_constants.h"
39 #endif 40 #endif
40 41
41 namespace ash { 42 namespace ash {
42 namespace test { 43 namespace test {
43 namespace { 44 namespace {
44 45
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { 125 if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
125 // Check that our viewer connection is still established. 126 // Check that our viewer connection is still established.
126 ASSERT_FALSE(metro_viewer_host_->closed_unexpectedly()); 127 ASSERT_FALSE(metro_viewer_host_->closed_unexpectedly());
127 } 128 }
128 #endif 129 #endif
129 130
130 // Tear down the shell. 131 // Tear down the shell.
131 Shell::DeleteInstance(); 132 Shell::DeleteInstance();
132 aura::Env::DeleteInstance(); 133 aura::Env::DeleteInstance();
133 ui::TextInputTestSupport::Shutdown(); 134 ui::TextInputTestSupport::Shutdown();
135
134 #if defined(OS_WIN) 136 #if defined(OS_WIN)
135 aura::test::SetUsePopupAsRootWindowForTest(false); 137 aura::test::SetUsePopupAsRootWindowForTest(false);
136 // Kill the viewer process if we spun one up. 138 // Kill the viewer process if we spun one up.
137 metro_viewer_host_.reset(); 139 metro_viewer_host_.reset();
140
141 // Clean up any dangling viewer processes as the metro APIs sometimes leave
142 // zombies behind. A default browser process in metro will have the
143 // following command line arg so use that to avoid killing all processes named
144 // win8::test::kDefaultTestExePath.
145 const wchar_t kViewerProcessArgument[] = L"DefaultBrowserServer";
146 KillAllNamedProcessesWithArgument(win8::test::kDefaultTestExePath,
147 kViewerProcessArgument);
138 #endif 148 #endif
149
139 event_generator_.reset(); 150 event_generator_.reset();
140 // Some tests set an internal display id, 151 // Some tests set an internal display id,
141 // reset it here, so other tests will continue in a clean environment. 152 // reset it here, so other tests will continue in a clean environment.
142 gfx::Display::SetInternalDisplayId(gfx::Display::kInvalidDisplayID); 153 gfx::Display::SetInternalDisplayId(gfx::Display::kInvalidDisplayID);
143 } 154 }
144 155
145 aura::test::EventGenerator& AshTestBase::GetEventGenerator() { 156 aura::test::EventGenerator& AshTestBase::GetEventGenerator() {
146 if (!event_generator_.get()) { 157 if (!event_generator_.get()) {
147 event_generator_.reset( 158 event_generator_.reset(
148 new aura::test::EventGenerator(new AshEventGeneratorDelegate())); 159 new aura::test::EventGenerator(new AshEventGeneratorDelegate()));
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 void AshTestBase::SetUserLoggedIn(bool user_logged_in) { 259 void AshTestBase::SetUserLoggedIn(bool user_logged_in) {
249 test_shell_delegate_->SetUserLoggedIn(user_logged_in); 260 test_shell_delegate_->SetUserLoggedIn(user_logged_in);
250 } 261 }
251 262
252 void AshTestBase::SetCanLockScreen(bool can_lock_screen) { 263 void AshTestBase::SetCanLockScreen(bool can_lock_screen) {
253 test_shell_delegate_->SetCanLockScreen(can_lock_screen); 264 test_shell_delegate_->SetCanLockScreen(can_lock_screen);
254 } 265 }
255 266
256 } // namespace test 267 } // namespace test
257 } // namespace ash 268 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | base/base.gyp » ('j') | base/test/test_process_util_win.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698