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

Side by Side Diff: Source/platform/heap/HeapTest.cpp

Issue 1098953003: HeapTest.HeapVectorPartObjects: fix reserveCapacity() expectation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 5746 matching lines...) Expand 10 before | Expand all | Expand 10 after
5757 { 5757 {
5758 HeapVector<PartObjectWithRef> vector1; 5758 HeapVector<PartObjectWithRef> vector1;
5759 HeapVector<PartObjectWithRef> vector2; 5759 HeapVector<PartObjectWithRef> vector2;
5760 5760
5761 for (int i = 0; i < 10; ++i) { 5761 for (int i = 0; i < 10; ++i) {
5762 vector1.append(PartObjectWithRef(i)); 5762 vector1.append(PartObjectWithRef(i));
5763 vector2.append(PartObjectWithRef(i)); 5763 vector2.append(PartObjectWithRef(i));
5764 } 5764 }
5765 5765
5766 vector1.reserveCapacity(150); 5766 vector1.reserveCapacity(150);
5767 EXPECT_EQ(150u, vector1.capacity()); 5767 EXPECT_LE(150u, vector1.capacity());
5768 EXPECT_EQ(10u, vector1.size()); 5768 EXPECT_EQ(10u, vector1.size());
5769 5769
5770 vector2.reserveCapacity(100); 5770 vector2.reserveCapacity(100);
5771 EXPECT_EQ(100u, vector2.capacity()); 5771 EXPECT_LE(100u, vector2.capacity());
5772 EXPECT_EQ(10u, vector2.size()); 5772 EXPECT_EQ(10u, vector2.size());
5773 5773
5774 for (int i = 0; i < 4; ++i) { 5774 for (int i = 0; i < 4; ++i) {
5775 vector1.append(PartObjectWithRef(10 + i)); 5775 vector1.append(PartObjectWithRef(10 + i));
5776 vector2.append(PartObjectWithRef(10 + i)); 5776 vector2.append(PartObjectWithRef(10 + i));
5777 vector2.append(PartObjectWithRef(10 + i)); 5777 vector2.append(PartObjectWithRef(10 + i));
5778 } 5778 }
5779 5779
5780 // Shrinking heap vector backing stores always succeeds, 5780 // Shrinking heap vector backing stores always succeeds,
5781 // so these two will not currently exercise the code path 5781 // so these two will not currently exercise the code path
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
5924 { 5924 {
5925 Persistent<ClassWithMember> object = ClassWithMember::create(); 5925 Persistent<ClassWithMember> object = ClassWithMember::create();
5926 EXPECT_EQ(0, object->traceCount()); 5926 EXPECT_EQ(0, object->traceCount());
5927 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object. get()); 5927 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object. get());
5928 EXPECT_TRUE(mixin); 5928 EXPECT_TRUE(mixin);
5929 EXPECT_GT(object->traceCount(), 0); 5929 EXPECT_GT(object->traceCount(), 0);
5930 EXPECT_GT(mixin->traceCount(), 0); 5930 EXPECT_GT(mixin->traceCount(), 0);
5931 } 5931 }
5932 5932
5933 } // namespace blink 5933 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698