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

Unified Diff: cc/base/list_container_unittest.cc

Issue 1219753003: Change ListContainer::AppendByMoving to return a pointer to the new item (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « cc/base/list_container.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/base/list_container_unittest.cc
diff --git a/cc/base/list_container_unittest.cc b/cc/base/list_container_unittest.cc
index 536a55e27f90798e075720c42e14bc6f2b22b174..57a2d3279279e1858015979ab36213702ebed36a 100644
--- a/cc/base/list_container_unittest.cc
+++ b/cc/base/list_container_unittest.cc
@@ -860,6 +860,20 @@ TEST(ListContainerTest, AppendByMovingDoesNotDestruct) {
EXPECT_CALL(*mde_1, Destruct());
}
+TEST(ListContainerTest, AppendByMovingReturnsMovedPointer) {
+ ListContainer<SimpleDerivedElement> list_1(kCurrentLargestDerivedElementSize);
+ ListContainer<SimpleDerivedElement> list_2(kCurrentLargestDerivedElementSize);
+ SimpleDerivedElement* simple_element =
+ list_1.AllocateAndConstruct<SimpleDerivedElement>();
+
+ SimpleDerivedElement* moved_1 = list_2.AppendByMoving(simple_element);
+ EXPECT_EQ(list_2.back(), moved_1);
+
+ SimpleDerivedElement* moved_2 = list_1.AppendByMoving(moved_1);
+ EXPECT_EQ(list_1.back(), moved_2);
+ EXPECT_NE(moved_1, moved_2);
+}
+
TEST(ListContainerTest, AppendByMovingReplacesSourceWithNewDerivedElement) {
ListContainer<SimpleDerivedElementConstructMagicNumberOne> list_1(
kCurrentLargestDerivedElementSize);
« no previous file with comments | « cc/base/list_container.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698