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

Unified Diff: Source/platform/graphics/ListContainerTest.cpp

Issue 1193433004: Blink-side contiguous allocation of display items. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove ListContainer::operatorAt[] Created 5 years, 6 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
Index: Source/platform/graphics/ListContainerTest.cpp
diff --git a/Source/platform/graphics/ListContainerTest.cpp b/Source/platform/graphics/ListContainerTest.cpp
index b92b588bcb977fdb77a9bd1e13ba78e1e440cbbd..7245bb2796b416204d2f14a71beb84d32bb20788 100644
--- a/Source/platform/graphics/ListContainerTest.cpp
+++ b/Source/platform/graphics/ListContainerTest.cpp
@@ -853,6 +853,20 @@ TEST(ListContainerTest, AppendByMovingDoesNotDestruct)
EXPECT_CALL(*mde1, Destruct());
}
+TEST(ListContainerTest, AppendByMovingReturnsMovedPointer)
+{
+ ListContainer<SimpleDerivedElement> list1(kCurrentLargestDerivedElementSize);
+ ListContainer<SimpleDerivedElement> list2(kCurrentLargestDerivedElementSize);
+ SimpleDerivedElement* simpleElement = list1.allocateAndConstruct<SimpleDerivedElement>();
+
+ SimpleDerivedElement* movedElement1 = list2.appendByMoving(simpleElement);
+ EXPECT_EQ(list2.back(), movedElement1);
+
+ SimpleDerivedElement* movedElement2 = list1.appendByMoving(movedElement1);
+ EXPECT_EQ(list1.back(), movedElement2);
+ EXPECT_NE(movedElement1, movedElement2);
+}
+
TEST(ListContainerTest, AppendByMovingReplacesSourceWithNewDerivedElement)
{
ListContainer<SimpleDerivedElementConstructMagicNumberOne> list1(kCurrentLargestDerivedElementSize);

Powered by Google App Engine
This is Rietveld 408576698