Index: Source/platform/PurgeableVectorTest.cpp |
diff --git a/Source/platform/PurgeableVectorTest.cpp b/Source/platform/PurgeableVectorTest.cpp |
index bdb594aacf799f31bf08b74f475bf9e628ad9a20..b0d2de8fa301461bfe4e80a466fd66f5bf08736d 100644 |
--- a/Source/platform/PurgeableVectorTest.cpp |
+++ b/Source/platform/PurgeableVectorTest.cpp |
@@ -177,12 +177,17 @@ TEST_P(PurgeableVectorTestWithPlatformSupport, reserveCapacityUsesExactCapacityW |
EXPECT_EQ(data, purgeableVector.data()); |
EXPECT_EQ(0, memcmp(purgeableVector.data(), testData.data(), testData.size())); |
- // Appending one extra byte should cause a reallocation since the first |
- // allocation happened while the purgeable vector was empty. This behavior |
- // helps us guarantee that there is no memory waste on very small vectors |
- // (which SharedBuffer requires). |
- purgeableVector.append(testData.data(), 1); |
- EXPECT_NE(data, purgeableVector.data()); |
+ // This test is not reliable if the PurgeableVector uses a plain WTF::Vector |
+ // for storage, as it does if discardable memory is not supported; the vectors |
+ // capacity will always be expanded to fill the PartitionAlloc bucket. |
+ if (isDiscardableMemorySupported()) { |
+ // Appending one extra byte should cause a reallocation since the first |
+ // allocation happened while the purgeable vector was empty. This behavior |
+ // helps us guarantee that there is no memory waste on very small vectors |
+ // (which SharedBuffer requires). |
+ purgeableVector.append(testData.data(), 1); |
+ EXPECT_NE(data, purgeableVector.data()); |
+ } |
} |
TEST_P(PurgeableVectorTestWithPlatformSupport, appendReservesCapacityIfNeeded) |