| Index: ui/base/models/list_model_unittest.cc
|
| diff --git a/ui/base/models/list_model_unittest.cc b/ui/base/models/list_model_unittest.cc
|
| index 56661671547e80687e72689c8703ec67043eab13..eab2bf05773b81123ac0ed89e40bfd2d32f974ad 100644
|
| --- a/ui/base/models/list_model_unittest.cc
|
| +++ b/ui/base/models/list_model_unittest.cc
|
| @@ -7,6 +7,7 @@
|
| #include "base/basictypes.h"
|
| #include "base/compiler_specific.h"
|
| #include "base/memory/scoped_ptr.h"
|
| +#include "base/memory/scoped_vector.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace ui {
|
| @@ -94,6 +95,34 @@ TEST_F(ListModelTest, Add) {
|
| EXPECT_EQ(1, model.GetItemAt(2)->id());
|
| }
|
|
|
| +TEST_F(ListModelTest, AddAll) {
|
| + ListModel<FooItem> model;
|
| + model.AddObserver(this);
|
| +
|
| + // Append FooItem(0)
|
| + model.Add(new FooItem(0));
|
| + ExpectCountsEqual(1, 0, 0, 0);
|
| +
|
| + ScopedVector<FooItem> items;
|
| + items.push_back(new FooItem(1));
|
| + items.push_back(new FooItem(2));
|
| +
|
| + // Append FooItem(1), FooItem(2)
|
| + model.AddAll(items.Pass());
|
| + ExpectCountsEqual(3, 0, 0, 0);
|
| +
|
| + // Onwership of FooItems transferred.
|
| + EXPECT_TRUE(items.empty());
|
| +
|
| + // Total 3 items in model.
|
| + EXPECT_EQ(3U, model.item_count());
|
| +
|
| + // First one should be FooItem(0), followed by FooItem(1) and FooItem(2)
|
| + EXPECT_EQ(0, model.GetItemAt(0)->id());
|
| + EXPECT_EQ(1, model.GetItemAt(1)->id());
|
| + EXPECT_EQ(2, model.GetItemAt(2)->id());
|
| +}
|
| +
|
| TEST_F(ListModelTest, Remove) {
|
| ListModel<FooItem> model;
|
| model.AddObserver(this);
|
|
|