Index: base/memory/scoped_vector_unittest.cc |
diff --git a/base/memory/scoped_vector_unittest.cc b/base/memory/scoped_vector_unittest.cc |
index d2f3d0aef8dce672b13fa6c4c9d6c1bf00eecdb8..64ce6d6809c573744c854986d7866f441f36ff8b 100644 |
--- a/base/memory/scoped_vector_unittest.cc |
+++ b/base/memory/scoped_vector_unittest.cc |
@@ -126,6 +126,41 @@ TEST(ScopedVectorTest, Scope) { |
EXPECT_EQ(LC_DESTROYED, watcher.life_cycle_state()); |
} |
+TEST(ScopedVectorTest, MoveConstruct) { |
+ LifeCycleWatcher watcher; |
+ EXPECT_EQ(LC_INITIAL, watcher.life_cycle_state()); |
+ { |
+ ScopedVector<LifeCycleObject> scoped_vector; |
+ scoped_vector.push_back(watcher.NewLifeCycleObject()); |
+ EXPECT_FALSE(scoped_vector.empty()); |
+ |
+ ScopedVector<LifeCycleObject> scoped_vector_copy(scoped_vector.Pass()); |
+ EXPECT_TRUE(scoped_vector.empty()); |
+ EXPECT_FALSE(scoped_vector_copy.empty()); |
+ |
+ EXPECT_EQ(LC_CONSTRUCTED, watcher.life_cycle_state()); |
+ } |
+ EXPECT_EQ(LC_DESTROYED, watcher.life_cycle_state()); |
+} |
+ |
+TEST(ScopedVectorTest, MoveAssign) { |
+ LifeCycleWatcher watcher; |
+ EXPECT_EQ(LC_INITIAL, watcher.life_cycle_state()); |
+ { |
+ ScopedVector<LifeCycleObject> scoped_vector; |
+ scoped_vector.push_back(watcher.NewLifeCycleObject()); |
+ ScopedVector<LifeCycleObject> scoped_vector_assign; |
+ EXPECT_FALSE(scoped_vector.empty()); |
+ |
+ scoped_vector_assign = scoped_vector.Pass(); |
+ EXPECT_TRUE(scoped_vector.empty()); |
+ EXPECT_FALSE(scoped_vector_assign.empty()); |
+ |
+ EXPECT_EQ(LC_CONSTRUCTED, watcher.life_cycle_state()); |
+ } |
+ EXPECT_EQ(LC_DESTROYED, watcher.life_cycle_state()); |
+} |
+ |
TEST(ScopedVectorTest, InsertRange) { |
LifeCycleWatcher watchers[5]; |