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

Side by Side Diff: base/trace_event/process_memory_maps_dump_provider_unittest.cc

Issue 1273413002: [tracing] Mechanical rename of LevelOfDetail enum to enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/trace_event/process_memory_maps_dump_provider.h" 5 #include "base/trace_event/process_memory_maps_dump_provider.h"
6 6
7 #include <fstream> 7 #include <fstream>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "base/trace_event/process_memory_dump.h" 10 #include "base/trace_event/process_memory_dump.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 "KernelPageSize: 4 kB\n" 103 "KernelPageSize: 4 kB\n"
104 "MMUPageSize: 4 kB\n" 104 "MMUPageSize: 4 kB\n"
105 "Locked: 0 kB\n" 105 "Locked: 0 kB\n"
106 "VmFlags: rd wr mr mw me ac sd\n"; 106 "VmFlags: rd wr mr mw me ac sd\n";
107 } // namespace 107 } // namespace
108 108
109 TEST(ProcessMemoryMapsDumpProviderTest, ParseProcSmaps) { 109 TEST(ProcessMemoryMapsDumpProviderTest, ParseProcSmaps) {
110 const uint32 kProtR = ProcessMemoryMaps::VMRegion::kProtectionFlagsRead; 110 const uint32 kProtR = ProcessMemoryMaps::VMRegion::kProtectionFlagsRead;
111 const uint32 kProtW = ProcessMemoryMaps::VMRegion::kProtectionFlagsWrite; 111 const uint32 kProtW = ProcessMemoryMaps::VMRegion::kProtectionFlagsWrite;
112 const uint32 kProtX = ProcessMemoryMaps::VMRegion::kProtectionFlagsExec; 112 const uint32 kProtX = ProcessMemoryMaps::VMRegion::kProtectionFlagsExec;
113 const MemoryDumpArgs dump_args = {MemoryDumpArgs::LEVEL_OF_DETAIL_HIGH}; 113 const MemoryDumpArgs dump_args = {MemoryDumpArgs::LevelOfDetail::HIGH};
114 114
115 auto pmmdp = ProcessMemoryMapsDumpProvider::GetInstance(); 115 auto pmmdp = ProcessMemoryMapsDumpProvider::GetInstance();
116 116
117 // Emulate a non-existent /proc/self/smaps. 117 // Emulate a non-existent /proc/self/smaps.
118 ProcessMemoryDump pmd_invalid(nullptr /* session_state */); 118 ProcessMemoryDump pmd_invalid(nullptr /* session_state */);
119 std::ifstream non_existent_file("/tmp/does-not-exist"); 119 std::ifstream non_existent_file("/tmp/does-not-exist");
120 ProcessMemoryMapsDumpProvider::proc_smaps_for_testing = &non_existent_file; 120 ProcessMemoryMapsDumpProvider::proc_smaps_for_testing = &non_existent_file;
121 CHECK_EQ(false, non_existent_file.good()); 121 CHECK_EQ(false, non_existent_file.good());
122 pmmdp->OnMemoryDump(dump_args, &pmd_invalid); 122 pmmdp->OnMemoryDump(dump_args, &pmd_invalid);
123 ASSERT_FALSE(pmd_invalid.has_process_mmaps()); 123 ASSERT_FALSE(pmd_invalid.has_process_mmaps());
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 EXPECT_EQ(16 * 1024UL, regions_2[0].byte_stats_shared_clean_resident); 176 EXPECT_EQ(16 * 1024UL, regions_2[0].byte_stats_shared_clean_resident);
177 EXPECT_EQ(12 * 1024UL, regions_2[0].byte_stats_shared_dirty_resident); 177 EXPECT_EQ(12 * 1024UL, regions_2[0].byte_stats_shared_dirty_resident);
178 EXPECT_EQ(8 * 1024UL, regions_2[0].byte_stats_private_clean_resident); 178 EXPECT_EQ(8 * 1024UL, regions_2[0].byte_stats_private_clean_resident);
179 EXPECT_EQ(4 * 1024UL, regions_2[0].byte_stats_private_dirty_resident); 179 EXPECT_EQ(4 * 1024UL, regions_2[0].byte_stats_private_dirty_resident);
180 EXPECT_EQ(0 * 1024UL, regions_2[0].byte_stats_swapped); 180 EXPECT_EQ(0 * 1024UL, regions_2[0].byte_stats_swapped);
181 } 181 }
182 #endif // defined(OS_LINUX) || defined(OS_ANDROID) 182 #endif // defined(OS_LINUX) || defined(OS_ANDROID)
183 183
184 } // namespace trace_event 184 } // namespace trace_event
185 } // namespace base 185 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698