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

Side by Side Diff: base/debug/proc_maps_linux_unittest.cc

Issue 656033009: Convert ARRAYSIZE_UNSAFE -> arraysize in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | base/debug/stack_trace_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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, &regions)); 175 EXPECT_TRUE(ParseProcMaps(kTestCases[i].input, &regions));
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
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
OLDNEW
« no previous file with comments | « no previous file | base/debug/stack_trace_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698