diff options
author | danakj <danakj@chromium.org> | 2015-03-09 15:27:25 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-09 22:28:34 +0000 |
commit | 94219a212c616eac1914ca851c55256c4bbd9e36 (patch) | |
tree | b9721bd6f2d10f117355fdfa1a0391262b745628 /base/process | |
parent | 6be122fb693fe8f2a5b150a12bddd5c85160b7a6 (diff) | |
download | chromium_src-94219a212c616eac1914ca851c55256c4bbd9e36.zip chromium_src-94219a212c616eac1914ca851c55256c4bbd9e36.tar.gz chromium_src-94219a212c616eac1914ca851c55256c4bbd9e36.tar.bz2 |
base: Use more specific CHECK macros for comparisons.
Prefer DCHECK_EQ(a, b) over DCHECK(a == b) when possible as this
provides more data on a failure. Similar for other operators such as
>=, <, !=, etc.
This also applies to CHECK, EXPECT, and ASSERT macros.
R=Nico
BUG=464816
Review URL: https://codereview.chromium.org/985723003
Cr-Commit-Position: refs/heads/master@{#319751}
Diffstat (limited to 'base/process')
-rw-r--r-- | base/process/kill_mac.cc | 4 | ||||
-rw-r--r-- | base/process/process_linux.cc | 2 | ||||
-rw-r--r-- | base/process/process_metrics_unittest.cc | 52 |
3 files changed, 29 insertions, 29 deletions
diff --git a/base/process/kill_mac.cc b/base/process/kill_mac.cc index 8c42400..a4e0a14 100644 --- a/base/process/kill_mac.cc +++ b/base/process/kill_mac.cc @@ -66,8 +66,8 @@ void BlockingReap(pid_t child) { // work in that case, but waitpid won't, and killing a non-child might not be // the best approach. void WaitForChildToDie(pid_t child, int timeout) { - DCHECK(child > 0); - DCHECK(timeout > 0); + DCHECK_GT(child, 0); + DCHECK_GT(timeout, 0); // DON'T ADD ANY EARLY RETURNS TO THIS FUNCTION without ensuring that // |child| has been reaped. Specifically, even if a kqueue, kevent, or other diff --git a/base/process/process_linux.cc b/base/process/process_linux.cc index 59ee288..88a310e 100644 --- a/base/process/process_linux.cc +++ b/base/process/process_linux.cc @@ -103,7 +103,7 @@ bool Process::IsProcessBackgrounded() const { &proc)) { std::vector<std::string> proc_parts; base::SplitString(proc, ':', &proc_parts); - DCHECK(proc_parts.size() == 3); + DCHECK_EQ(proc_parts.size(), 3u); bool ret = proc_parts[2] == std::string(kBackground); return ret; } else { diff --git a/base/process/process_metrics_unittest.cc b/base/process/process_metrics_unittest.cc index dbfaa1a..76767b0 100644 --- a/base/process/process_metrics_unittest.cc +++ b/base/process/process_metrics_unittest.cc @@ -143,29 +143,29 @@ TEST_F(SystemMetricsTest, ParseMeminfo) { "Hugepagesize: 4096 kB\n"; EXPECT_TRUE(ParseProcMeminfo(valid_input1, &meminfo)); - EXPECT_TRUE(meminfo.total == 3981504); - EXPECT_TRUE(meminfo.free == 140764); - EXPECT_TRUE(meminfo.buffers == 116480); - EXPECT_TRUE(meminfo.cached == 406160); - EXPECT_TRUE(meminfo.active_anon == 2972352); - EXPECT_TRUE(meminfo.active_file == 179688); - EXPECT_TRUE(meminfo.inactive_anon == 270108); - EXPECT_TRUE(meminfo.inactive_file == 202748); - EXPECT_TRUE(meminfo.swap_total == 5832280); - EXPECT_TRUE(meminfo.swap_free == 3672368); - EXPECT_TRUE(meminfo.dirty == 184); + EXPECT_EQ(meminfo.total, 3981504); + EXPECT_EQ(meminfo.free, 140764); + EXPECT_EQ(meminfo.buffers, 116480); + EXPECT_EQ(meminfo.cached, 406160); + EXPECT_EQ(meminfo.active_anon, 2972352); + EXPECT_EQ(meminfo.active_file, 179688); + EXPECT_EQ(meminfo.inactive_anon, 270108); + EXPECT_EQ(meminfo.inactive_file, 202748); + EXPECT_EQ(meminfo.swap_total, 5832280); + EXPECT_EQ(meminfo.swap_free, 3672368); + EXPECT_EQ(meminfo.dirty, 184); #if defined(OS_CHROMEOS) - EXPECT_TRUE(meminfo.shmem == 140204); - EXPECT_TRUE(meminfo.slab == 54212); + EXPECT_EQ(meminfo.shmem, 140204); + EXPECT_EQ(meminfo.slab, 54212); #endif EXPECT_TRUE(ParseProcMeminfo(valid_input2, &meminfo)); - EXPECT_TRUE(meminfo.total == 255908); - EXPECT_TRUE(meminfo.free == 69936); - EXPECT_TRUE(meminfo.buffers == 15812); - EXPECT_TRUE(meminfo.cached == 115124); - EXPECT_TRUE(meminfo.swap_total == 524280); - EXPECT_TRUE(meminfo.swap_free == 524200); - EXPECT_TRUE(meminfo.dirty == 4); + EXPECT_EQ(meminfo.total, 255908); + EXPECT_EQ(meminfo.free, 69936); + EXPECT_EQ(meminfo.buffers, 15812); + EXPECT_EQ(meminfo.cached, 115124); + EXPECT_EQ(meminfo.swap_total, 524280); + EXPECT_EQ(meminfo.swap_free, 524200); + EXPECT_EQ(meminfo.dirty, 4); } TEST_F(SystemMetricsTest, ParseVmstat) { @@ -260,13 +260,13 @@ TEST_F(SystemMetricsTest, ParseVmstat) { "pgrefill_high 0\n" "pgrefill_movable 0\n"; EXPECT_TRUE(ParseProcVmstat(valid_input1, &meminfo)); - EXPECT_TRUE(meminfo.pswpin == 179); - EXPECT_TRUE(meminfo.pswpout == 406); - EXPECT_TRUE(meminfo.pgmajfault == 487192); + EXPECT_EQ(meminfo.pswpin, 179); + EXPECT_EQ(meminfo.pswpout, 406); + EXPECT_EQ(meminfo.pgmajfault, 487192); EXPECT_TRUE(ParseProcVmstat(valid_input2, &meminfo)); - EXPECT_TRUE(meminfo.pswpin == 12); - EXPECT_TRUE(meminfo.pswpout == 901); - EXPECT_TRUE(meminfo.pgmajfault == 2023); + EXPECT_EQ(meminfo.pswpin, 12); + EXPECT_EQ(meminfo.pswpout, 901); + EXPECT_EQ(meminfo.pgmajfault, 2023); } #endif // defined(OS_LINUX) || defined(OS_ANDROID) |