| Index: base/containers/scoped_ptr_map_unittest.cc
|
| diff --git a/base/containers/scoped_ptr_map_unittest.cc b/base/containers/scoped_ptr_map_unittest.cc
|
| index 46843b3f2529f288ec3ef9cdef1884608cfa2524..706b2edfb188b264073989b1d06ce5d79a291dd5 100644
|
| --- a/base/containers/scoped_ptr_map_unittest.cc
|
| +++ b/base/containers/scoped_ptr_map_unittest.cc
|
| @@ -147,15 +147,30 @@ TEST(ScopedPtrMapTest, Clear) {
|
|
|
| TEST(ScopedPtrMapTest, Compare) {
|
| // Construct a ScopedPtrMap with a custom comparison function.
|
| - bool destroyed = false;
|
| - ScopedPtrMap<int, scoped_ptr<ScopedDestroyer>, std::greater<int>> scoped_map;
|
| - scoped_map.insert(0, make_scoped_ptr(new ScopedDestroyer(&destroyed)));
|
| - scoped_map.insert(1, make_scoped_ptr(new ScopedDestroyer(&destroyed)));
|
| + ScopedPtrMap<int, scoped_ptr<int>, std::greater<int>> scoped_map1;
|
| + scoped_map1.insert(0, make_scoped_ptr(new int(0)));
|
| + scoped_map1.insert(1, make_scoped_ptr(new int(0)));
|
|
|
| - auto it = scoped_map.begin();
|
| + auto it = scoped_map1.begin();
|
| EXPECT_EQ(1, it->first);
|
| ++it;
|
| EXPECT_EQ(0, it->first);
|
| +
|
| + // Test the move constructor.
|
| + ScopedPtrMap<int, scoped_ptr<int>, std::greater<int>> scoped_map2(
|
| + scoped_map1.Pass());
|
| + EXPECT_EQ(2u, scoped_map2.size());
|
| + EXPECT_TRUE(scoped_map1.empty());
|
| +
|
| + // Test move assignment.
|
| + scoped_map1 = scoped_map2.Pass();
|
| + EXPECT_EQ(2u, scoped_map1.size());
|
| + EXPECT_TRUE(scoped_map2.empty());
|
| +
|
| + // Test swap.
|
| + scoped_map2.swap(scoped_map1);
|
| + EXPECT_EQ(2u, scoped_map2.size());
|
| + EXPECT_TRUE(scoped_map1.empty());
|
| }
|
|
|
| TEST(ScopedPtrMapTest, Scope) {
|
|
|