Index: chrome/browser/ui/app_list/test/fast_show_pickler_unittest.cc |
diff --git a/chrome/browser/ui/app_list/test/fast_show_pickler_unittest.cc b/chrome/browser/ui/app_list/test/fast_show_pickler_unittest.cc |
index e87fe895a0a9241c8d2b5f303b60956a656123dd..e540488dbec25d5fa146272ab7d3fcea1f3bed48 100644 |
--- a/chrome/browser/ui/app_list/test/fast_show_pickler_unittest.cc |
+++ b/chrome/browser/ui/app_list/test/fast_show_pickler_unittest.cc |
@@ -17,17 +17,22 @@ using app_list::AppListModel; |
class AppListModelPicklerUnitTest : public testing::Test { |
protected: |
void CheckIsSame(AppListModel* m1, AppListModel* m2) { |
- ASSERT_EQ(m1->apps()->item_count(), m2->apps()->item_count()); |
ASSERT_EQ(m1->signed_in(), m2->signed_in()); |
- for (size_t i = 0; i < m1->apps()->item_count(); i++) { |
- ASSERT_EQ(m1->apps()->GetItemAt(i)->id(), |
- m2->apps()->GetItemAt(i)->id()); |
- ASSERT_EQ(m1->apps()->GetItemAt(i)->title(), |
- m2->apps()->GetItemAt(i)->title()); |
- ASSERT_EQ(m1->apps()->GetItemAt(i)->full_name(), |
- m2->apps()->GetItemAt(i)->full_name()); |
- CompareImages(m1->apps()->GetItemAt(i)->icon(), |
- m2->apps()->GetItemAt(i)->icon()); |
+ ASSERT_EQ(m1->GetNumAppPages(), m2->GetNumAppPages()); |
+ for (size_t p = 0; p < m1->GetNumAppPages(); ++p) { |
+ const AppListModel::AppItems& m1apps = m1->GetAppItemsForPage(p); |
+ const AppListModel::AppItems& m2apps = m2->GetAppItemsForPage(p); |
+ ASSERT_EQ(m1apps.item_count(), m2apps.item_count()); |
+ for (size_t i = 0; i < m1apps.item_count(); ++i) { |
+ ASSERT_EQ(m1apps.GetItemAt(i)->id(), |
+ m2apps.GetItemAt(i)->id()); |
+ ASSERT_EQ(m1apps.GetItemAt(i)->title(), |
+ m2apps.GetItemAt(i)->title()); |
+ ASSERT_EQ(m1apps.GetItemAt(i)->full_name(), |
+ m2apps.GetItemAt(i)->full_name()); |
+ CompareImages(m1apps.GetItemAt(i)->icon(), |
+ m2apps.GetItemAt(i)->icon()); |
+ } |
} |
} |
@@ -43,16 +48,15 @@ class AppListModelPicklerUnitTest : public testing::Test { |
} |
} |
- scoped_ptr<AppListModel> CopyViaPickle(AppListModel* model) { |
+ void DoConsistencyChecks(AppListModel* model) { |
scoped_ptr<Pickle> pickle( |
FastShowPickler::PickleAppListModelForFastShow(model)); |
- return FastShowPickler::UnpickleAppListModelForFastShow(pickle.get()); |
- } |
- |
- void DoConsistencyChecks(AppListModel* model) { |
- scoped_ptr<AppListModel> model2(CopyViaPickle(model)); |
+ ASSERT_TRUE(pickle); |
+ scoped_ptr<AppListModel> model2( |
+ FastShowPickler::UnpickleAppListModelForFastShow(pickle.get())); |
+ ASSERT_TRUE(model2); |
AppListModel dest_model; |
- FastShowPickler::CopyOver(model2.get(), &dest_model); |
+ FastShowPickler::CopyAppListModel(model2.get(), &dest_model); |
CheckIsSame(model, model2.get()); |
CheckIsSame(model, &dest_model); |
@@ -79,7 +83,7 @@ TEST_F(AppListModelPicklerUnitTest, OneItem) { |
AppListModel model; |
AppListItemModel* app1 = new AppListItemModel("abc"); |
app1->SetTitleAndFullName("ht", "hello, there"); |
- model.apps()->Add(app1); |
+ model.AddItem(app1); |
DoConsistencyChecks(&model); |
} |
@@ -88,11 +92,11 @@ TEST_F(AppListModelPicklerUnitTest, TwoItems) { |
AppListModel model; |
AppListItemModel* app1 = new AppListItemModel("abc"); |
app1->SetTitleAndFullName("ht", "hello, there"); |
- model.apps()->Add(app1); |
+ model.AddItem(app1); |
AppListItemModel* app2 = new AppListItemModel("abc2"); |
app2->SetTitleAndFullName("ht2", "hello, there 2"); |
- model.apps()->Add(app2); |
+ model.AddItem(app2); |
DoConsistencyChecks(&model); |
} |
@@ -102,11 +106,11 @@ TEST_F(AppListModelPicklerUnitTest, Images) { |
AppListItemModel* app1 = new AppListItemModel("abc"); |
app1->SetTitleAndFullName("ht", "hello, there"); |
app1->SetIcon(MakeImage(), true); |
- model.apps()->Add(app1); |
+ model.AddItem(app1); |
AppListItemModel* app2 = new AppListItemModel("abc2"); |
app2->SetTitleAndFullName("ht2", "hello, there 2"); |
- model.apps()->Add(app2); |
+ model.AddItem(app2); |
DoConsistencyChecks(&model); |
} |
@@ -116,7 +120,7 @@ TEST_F(AppListModelPicklerUnitTest, EmptyImage) { |
AppListItemModel* app1 = new AppListItemModel("abc"); |
app1->SetTitleAndFullName("ht", "hello, there"); |
app1->SetIcon(gfx::ImageSkia(), true); |
- model.apps()->Add(app1); |
+ model.AddItem(app1); |
DoConsistencyChecks(&model); |
} |