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

Side by Side Diff: sandbox/win/src/interception_unittest.cc

Issue 1422773008: Fixing remaining VC++ 2015 64-bit build breaks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing unneeded include Created 5 years 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 | « net/cert/test_root_certs_win.cc ('k') | sandbox/win/src/policy_target_test.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This file contains unit tests for InterceptionManager. 5 // This file contains unit tests for InterceptionManager.
6 // The tests require private information so the whole interception.cc file is 6 // The tests require private information so the whole interception.cc file is
7 // included from this file. 7 // included from this file.
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 TEST(InterceptionManagerTest, GetGranularAlignedRandomOffset) { 86 TEST(InterceptionManagerTest, GetGranularAlignedRandomOffset) {
87 std::set<size_t> sizes; 87 std::set<size_t> sizes;
88 88
89 // 544 is current value of interceptions_.size() * sizeof(ThunkData) + 89 // 544 is current value of interceptions_.size() * sizeof(ThunkData) +
90 // sizeof(DllInterceptionData). 90 // sizeof(DllInterceptionData).
91 const size_t kThunkBytes = 544; 91 const size_t kThunkBytes = 544;
92 92
93 // ciel(log2(544)) = 10. 93 // ciel(log2(544)) = 10.
94 // Alignment must be 2^10 = 1024. 94 // Alignment must be 2^10 = 1024.
95 const size_t kAlignmentBits = base::bits::Log2Ceiling(kThunkBytes); 95 const size_t kAlignmentBits = base::bits::Log2Ceiling(kThunkBytes);
96 const size_t kAlignment = 1 << kAlignmentBits; 96 const size_t kAlignment = static_cast<size_t>(1) << kAlignmentBits;
97 97
98 const size_t kAllocGranularity = 65536; 98 const size_t kAllocGranularity = 65536;
99 99
100 // Generate enough sample data to ensure there is at least one value in each 100 // Generate enough sample data to ensure there is at least one value in each
101 // potential bucket. 101 // potential bucket.
102 for (size_t i = 0; i < 1000000; i++) 102 for (size_t i = 0; i < 1000000; i++)
103 sizes.insert(internal::GetGranularAlignedRandomOffset(kThunkBytes)); 103 sizes.insert(internal::GetGranularAlignedRandomOffset(kThunkBytes));
104 104
105 size_t prev_val = 0; 105 size_t prev_val = 0;
106 size_t min_val = kAllocGranularity; 106 size_t min_val = kAllocGranularity;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 int num_dlls, num_functions, num_names; 250 int num_dlls, num_functions, num_names;
251 WalkBuffer(local_buffer.get(), buffer_size, &num_dlls, &num_functions, 251 WalkBuffer(local_buffer.get(), buffer_size, &num_dlls, &num_functions,
252 &num_names); 252 &num_names);
253 253
254 EXPECT_EQ(3, num_dlls); 254 EXPECT_EQ(3, num_dlls);
255 EXPECT_EQ(4, num_functions); 255 EXPECT_EQ(4, num_functions);
256 EXPECT_EQ(0, num_names); 256 EXPECT_EQ(0, num_names);
257 } 257 }
258 258
259 } // namespace sandbox 259 } // namespace sandbox
OLDNEW
« no previous file with comments | « net/cert/test_root_certs_win.cc ('k') | sandbox/win/src/policy_target_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698