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

Side by Side Diff: chrome/browser/process_info_snapshot_mac_unittest.cc

Issue 864163003: Rename base::Process::pid() to Pid() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 "chrome/browser/process_info_snapshot.h" 5 #include "chrome/browser/process_info_snapshot.h"
6 6
7 #include <sys/types.h> // For |uid_t| (and |pid_t|). 7 #include <sys/types.h> // For |uid_t| (and |pid_t|).
8 #include <unistd.h> // For |getpid()|, |getuid()|, etc. 8 #include <unistd.h> // For |getpid()|, |getuid()|, etc.
9 9
10 #include <vector> 10 #include <vector>
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 base::Process process = base::LaunchProcess(argv, options); 125 base::Process process = base::LaunchProcess(argv, options);
126 ASSERT_TRUE(process.IsValid()); 126 ASSERT_TRUE(process.IsValid());
127 PCHECK(IGNORE_EINTR(close(fds[1])) == 0); 127 PCHECK(IGNORE_EINTR(close(fds[1])) == 0);
128 128
129 // Wait until there's some output form top. This is an easy way to tell that 129 // Wait until there's some output form top. This is an easy way to tell that
130 // the exec() call is done and top is actually running. 130 // the exec() call is done and top is actually running.
131 char buf[1]; 131 char buf[1];
132 PCHECK(HANDLE_EINTR(read(fds[0], buf, 1)) == 1); 132 PCHECK(HANDLE_EINTR(read(fds[0], buf, 1)) == 1);
133 133
134 std::vector<base::ProcessId> pid_list; 134 std::vector<base::ProcessId> pid_list;
135 pid_list.push_back(process.pid()); 135 pid_list.push_back(process.Pid());
136 ProcessInfoSnapshot snapshot; 136 ProcessInfoSnapshot snapshot;
137 ASSERT_TRUE(snapshot.Sample(pid_list)); 137 ASSERT_TRUE(snapshot.Sample(pid_list));
138 138
139 ProcessInfoSnapshot::ProcInfoEntry proc_info; 139 ProcessInfoSnapshot::ProcInfoEntry proc_info;
140 ASSERT_TRUE(snapshot.GetProcInfo(process.pid(), &proc_info)); 140 ASSERT_TRUE(snapshot.GetProcInfo(process.Pid(), &proc_info));
141 // Effective user ID should be 0 (root). 141 // Effective user ID should be 0 (root).
142 EXPECT_EQ(proc_info.euid, 0u); 142 EXPECT_EQ(proc_info.euid, 0u);
143 // Real user ID should match the calling process's user id. 143 // Real user ID should match the calling process's user id.
144 EXPECT_EQ(proc_info.uid, geteuid()); 144 EXPECT_EQ(proc_info.uid, geteuid());
145 145
146 ASSERT_TRUE(base::KillProcess(process.Handle(), 0, true)); 146 ASSERT_TRUE(base::KillProcess(process.Handle(), 0, true));
147 PCHECK(IGNORE_EINTR(close(fds[0])) == 0); 147 PCHECK(IGNORE_EINTR(close(fds[0])) == 0);
148 } 148 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698