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

Unified Diff: base/tracked_objects_unittest.cc

Issue 2881493004: Marshal 64 bit byte counts as double to the profiler. (Closed)
Patch Set: Fix the serialization unit test. Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/task_profiler/task_profiler_data_serializer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/tracked_objects_unittest.cc
diff --git a/base/tracked_objects_unittest.cc b/base/tracked_objects_unittest.cc
index 80b40643e5bb027e9bef4c2bef3ddda119674eb8..1eb4199abce70008bb0336a2f50444efb692e162 100644
--- a/base/tracked_objects_unittest.cc
+++ b/base/tracked_objects_unittest.cc
@@ -346,9 +346,23 @@ TEST_F(TrackedObjectsTest, DeathDataTestRecordAllocations) {
EXPECT_EQ(data->alloc_overhead_bytes(), 3 * kAllocOverheadBytes);
EXPECT_EQ(data->max_allocated_bytes(), kLargerMaxAllocatedBytes);
- // Saturate everything but aggregate byte counts. The byte counts will be
- // pushed past the 32 bit value range.
+ // Saturate everything but aggregate byte counts.
+ // In the 32 bit implementation, this tests the case where the low-order
gab 2017/05/12 15:07:52 in the "64 bit implementation"?
Sigurður Ásgeirsson 2017/05/12 15:11:21 No, I specifically mean the 32 bit implementation,
gab 2017/05/12 15:13:41 Ah, indeed, right :)
+ // word goes negative.
data->RecordAllocations(INT_MAX, INT_MAX, INT_MAX, INT_MAX, INT_MAX, INT_MAX);
+ EXPECT_EQ(data->alloc_ops(), INT_MAX);
+ EXPECT_EQ(data->free_ops(), INT_MAX);
+ // The cumulative byte counts are 64 bit wide, and won't saturate easily.
+ EXPECT_EQ(data->allocated_bytes(),
+ static_cast<int64_t>(INT_MAX) +
+ static_cast<int64_t>(3 * kAllocatedBytes));
+ EXPECT_EQ(data->freed_bytes(),
+ static_cast<int64_t>(INT_MAX) + 3 * kFreedBytes);
+ EXPECT_EQ(data->alloc_overhead_bytes(),
+ static_cast<int64_t>(INT_MAX) + 3 * kAllocOverheadBytes);
+ EXPECT_EQ(data->max_allocated_bytes(), INT_MAX);
+
+ // The byte counts will be pushed past the 32 bit value range.
data->RecordAllocations(INT_MAX, INT_MAX, INT_MAX, INT_MAX, INT_MAX, INT_MAX);
EXPECT_EQ(data->alloc_ops(), INT_MAX);
EXPECT_EQ(data->free_ops(), INT_MAX);
« no previous file with comments | « no previous file | chrome/browser/task_profiler/task_profiler_data_serializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698