Index: base/process/process_metrics_unittest.cc |
diff --git a/base/process/process_metrics_unittest.cc b/base/process/process_metrics_unittest.cc |
index 31479cefff64f5b0dc17c960b317bae45bec3b0e..3a8515b0b735c5007625aa90fc5265efaa6b035d 100644 |
--- a/base/process/process_metrics_unittest.cc |
+++ b/base/process/process_metrics_unittest.cc |
@@ -268,6 +268,34 @@ TEST_F(SystemMetricsTest, ParseVmstat) { |
EXPECT_EQ(meminfo.pswpout, 901); |
EXPECT_EQ(meminfo.pgmajfault, 2023); |
} |
+ |
+TEST(ProcessMetricsTest, ParseProcStatusFile) { |
+ const char* kValindStatusContents = |
+ "Name: bash\n" |
+ "PPid: 3452\n" |
+ "TracerPid: 0\n" |
+ "Uid: 1000 1000 1000 1000\n" |
+ "Gid: 100 100 100 100\n" |
+ "FDSize: 256\n" |
+ "Groups: 16 33 100\n" |
+ "VmPeak: 9136 kB\n" |
+ "VmSize: 7896 kB\n" |
+ "VmHWM: 7572 kB\n" |
+ "VmLib: 1708 kB\n" |
+ "SigQ: 0/3067\n" |
+ "SigPnd: 0000000000000000\n" |
+ "ShdPnd: 0000000000000000\n" |
+ "CapBnd: ffffffffffffffff\n" |
+ "Seccomp: 0\n" |
+ "Cpus_allowed: 00000001\n" |
+ "nonvoluntary_ctxt_switches: 545\n"; |
+ |
+ size_t vm_size; |
+ bool res = |
+ ParseProcStatusAndGetField(kValindStatusContents, "VmSize", &vm_size); |
+ EXPECT_TRUE(res); |
+ EXPECT_EQ(7896 * 1024u, vm_size); |
+} |
#endif // defined(OS_LINUX) || defined(OS_ANDROID) |
#if defined(OS_WIN) || (defined(OS_MACOSX) && !defined(OS_IOS)) || \ |