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

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

Issue 860453002: Move OpenProcessHandleWithAccess to Process::OpenWithAccess. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ServiceProcessControlBrowserTest.Setup again Created 5 years, 11 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
« no previous file with comments | « no previous file | base/process/process.h » ('j') | chrome/browser/chrome_process_finder_win.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/test_metro_viewer_process_host.h" 5 #include "ash/test/test_metro_viewer_process_host.h"
6 6
7 #include <windef.h> 7 #include <windef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/process/process.h"
10 #include "ui/aura/remote_window_tree_host_win.h" 11 #include "ui/aura/remote_window_tree_host_win.h"
11 #include "ui/gfx/win/dpi.h" 12 #include "ui/gfx/win/dpi.h"
12 13
13 namespace ash { 14 namespace ash {
14 namespace test { 15 namespace test {
15 16
16 TestMetroViewerProcessHost::TestMetroViewerProcessHost( 17 TestMetroViewerProcessHost::TestMetroViewerProcessHost(
17 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) 18 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner)
18 : MetroViewerProcessHost(ipc_task_runner), closed_unexpectedly_(false) { 19 : MetroViewerProcessHost(ipc_task_runner), closed_unexpectedly_(false) {
19 } 20 }
20 21
21 TestMetroViewerProcessHost::~TestMetroViewerProcessHost() { 22 TestMetroViewerProcessHost::~TestMetroViewerProcessHost() {
22 } 23 }
23 24
24 void TestMetroViewerProcessHost::TerminateViewer() { 25 void TestMetroViewerProcessHost::TerminateViewer() {
25 base::ProcessId viewer_process_id = GetViewerProcessId(); 26 base::ProcessId viewer_process_id = GetViewerProcessId();
26 if (viewer_process_id != base::kNullProcessId) { 27 if (viewer_process_id != base::kNullProcessId) {
27 base::ProcessHandle viewer_process = NULL; 28 base::Process viewer_process = base::Process::OpenWithAccess(
28 base::OpenProcessHandleWithAccess(
29 viewer_process_id, 29 viewer_process_id,
30 PROCESS_QUERY_INFORMATION | SYNCHRONIZE | PROCESS_TERMINATE, 30 PROCESS_QUERY_INFORMATION | SYNCHRONIZE | PROCESS_TERMINATE);
31 &viewer_process); 31 if (viewer_process.IsValid()) {
32 if (viewer_process) { 32 viewer_process.Terminate(0);
33 ::TerminateProcess(viewer_process, 0); 33 int exit_code;
34 ::WaitForSingleObject(viewer_process, INFINITE); 34 viewer_process.WaitForExit(&exit_code);
35 ::CloseHandle(viewer_process);
36 } 35 }
37 } 36 }
38 } 37 }
39 38
40 void TestMetroViewerProcessHost::OnChannelError() { 39 void TestMetroViewerProcessHost::OnChannelError() {
41 closed_unexpectedly_ = true; 40 closed_unexpectedly_ = true;
42 aura::RemoteWindowTreeHostWin::Instance()->Disconnected(); 41 aura::RemoteWindowTreeHostWin::Instance()->Disconnected();
43 } 42 }
44 43
45 void TestMetroViewerProcessHost::OnSetTargetSurface( 44 void TestMetroViewerProcessHost::OnSetTargetSurface(
(...skipping 12 matching lines...) Expand all
58 void TestMetroViewerProcessHost::OnHandleSearchRequest( 57 void TestMetroViewerProcessHost::OnHandleSearchRequest(
59 const base::string16& search_string) { 58 const base::string16& search_string) {
60 } 59 }
61 60
62 void TestMetroViewerProcessHost::OnWindowSizeChanged(uint32 width, 61 void TestMetroViewerProcessHost::OnWindowSizeChanged(uint32 width,
63 uint32 height) { 62 uint32 height) {
64 } 63 }
65 64
66 } // namespace test 65 } // namespace test
67 } // namespace ash 66 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | base/process/process.h » ('j') | chrome/browser/chrome_process_finder_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698