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); |