| OLD | NEW |
| 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 "base/debug/proc_maps_linux.h" | 5 #include "base/debug/proc_maps_linux.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 9 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 MappedMemoryRegion::READ | MappedMemoryRegion::PRIVATE}, | 160 MappedMemoryRegion::READ | MappedMemoryRegion::PRIVATE}, |
| 161 {"00400000-0040b000 -w-p 00000000 fc:00 794418 /bin/cat\n", | 161 {"00400000-0040b000 -w-p 00000000 fc:00 794418 /bin/cat\n", |
| 162 MappedMemoryRegion::WRITE | MappedMemoryRegion::PRIVATE}, | 162 MappedMemoryRegion::WRITE | MappedMemoryRegion::PRIVATE}, |
| 163 {"00400000-0040b000 --xp 00000000 fc:00 794418 /bin/cat\n", | 163 {"00400000-0040b000 --xp 00000000 fc:00 794418 /bin/cat\n", |
| 164 MappedMemoryRegion::EXECUTE | MappedMemoryRegion::PRIVATE}, | 164 MappedMemoryRegion::EXECUTE | MappedMemoryRegion::PRIVATE}, |
| 165 {"00400000-0040b000 rwxp 00000000 fc:00 794418 /bin/cat\n", | 165 {"00400000-0040b000 rwxp 00000000 fc:00 794418 /bin/cat\n", |
| 166 MappedMemoryRegion::READ | MappedMemoryRegion::WRITE | | 166 MappedMemoryRegion::READ | MappedMemoryRegion::WRITE | |
| 167 MappedMemoryRegion::EXECUTE | MappedMemoryRegion::PRIVATE}, | 167 MappedMemoryRegion::EXECUTE | MappedMemoryRegion::PRIVATE}, |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) { | 170 for (size_t i = 0; i < arraysize(kTestCases); ++i) { |
| 171 SCOPED_TRACE( | 171 SCOPED_TRACE( |
| 172 base::StringPrintf("kTestCases[%zu] = %s", i, kTestCases[i].input)); | 172 base::StringPrintf("kTestCases[%zu] = %s", i, kTestCases[i].input)); |
| 173 | 173 |
| 174 std::vector<MappedMemoryRegion> regions; | 174 std::vector<MappedMemoryRegion> regions; |
| 175 EXPECT_TRUE(ParseProcMaps(kTestCases[i].input, ®ions)); | 175 EXPECT_TRUE(ParseProcMaps(kTestCases[i].input, ®ions)); |
| 176 EXPECT_EQ(1u, regions.size()); | 176 EXPECT_EQ(1u, regions.size()); |
| 177 if (regions.empty()) | 177 if (regions.empty()) |
| 178 continue; | 178 continue; |
| 179 EXPECT_EQ(kTestCases[i].permissions, regions[0].permissions); | 179 EXPECT_EQ(kTestCases[i].permissions, regions[0].permissions); |
| 180 } | 180 } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 EXPECT_EQ(5ULL, regions.size()); | 304 EXPECT_EQ(5ULL, regions.size()); |
| 305 EXPECT_EQ("/bin/cat", regions[0].path); | 305 EXPECT_EQ("/bin/cat", regions[0].path); |
| 306 EXPECT_EQ("/lib/x86_64-linux-gnu/libc-2.15.so", regions[1].path); | 306 EXPECT_EQ("/lib/x86_64-linux-gnu/libc-2.15.so", regions[1].path); |
| 307 EXPECT_EQ("/lib/x86_64-linux-gnu/ld-2.15.so", regions[2].path); | 307 EXPECT_EQ("/lib/x86_64-linux-gnu/ld-2.15.so", regions[2].path); |
| 308 EXPECT_EQ("\"vd so\"", regions[3].path); | 308 EXPECT_EQ("\"vd so\"", regions[3].path); |
| 309 EXPECT_EQ("[vsys call]", regions[4].path); | 309 EXPECT_EQ("[vsys call]", regions[4].path); |
| 310 } | 310 } |
| 311 | 311 |
| 312 } // namespace debug | 312 } // namespace debug |
| 313 } // namespace base | 313 } // namespace base |
| OLD | NEW |