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

Unified Diff: ui/app_list/views/app_list_view_unittest.cc

Issue 302803002: Refactor app list so AppsGridView owns the PaginationModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments (tapted and xiyuan). Created 6 years, 7 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
Index: ui/app_list/views/app_list_view_unittest.cc
diff --git a/ui/app_list/views/app_list_view_unittest.cc b/ui/app_list/views/app_list_view_unittest.cc
index 5ead23f231f8331686d38a215181d2aff48411f2..ff0bbf1cea7aa99cd1ac5a56d4a65af79bdbaa72 100644
--- a/ui/app_list/views/app_list_view_unittest.cc
+++ b/ui/app_list/views/app_list_view_unittest.cc
@@ -99,9 +99,11 @@ class AppListViewTestContext {
// Closes the app list. This sets |view_| to NULL.
void Close();
+ // Gets the PaginationModel owned by |view_|.
+ PaginationModel* GetPaginationModel();
+
const TestType test_type_;
scoped_ptr<base::RunLoop> run_loop_;
- PaginationModel pagination_model_;
app_list::AppListView* view_; // Owned by native widget.
app_list::test::AppListTestViewDelegate* delegate_; // Owned by |view_|;
@@ -153,7 +155,6 @@ AppListViewTestContext::AppListViewTestContext(int test_type,
// Initialize centered around a point that ensures the window is wholly shown.
view_->InitAsBubbleAtFixedLocation(parent,
- &pagination_model_,
gfx::Point(300, 300),
views::BubbleBorder::FLOAT,
false /* border_accepts_events */);
@@ -192,17 +193,21 @@ void AppListViewTestContext::Close() {
EXPECT_FALSE(view_);
}
+PaginationModel* AppListViewTestContext::GetPaginationModel() {
+ return view_->GetAppsPaginationModel();
+}
+
void AppListViewTestContext::RunDisplayTest() {
EXPECT_FALSE(view_->GetWidget()->IsVisible());
- EXPECT_EQ(-1, pagination_model_.total_pages());
+ EXPECT_EQ(-1, GetPaginationModel()->total_pages());
delegate_->GetTestModel()->PopulateApps(kInitialItems);
Show();
if (is_landscape())
- EXPECT_EQ(2, pagination_model_.total_pages());
+ EXPECT_EQ(2, GetPaginationModel()->total_pages());
else
- EXPECT_EQ(3, pagination_model_.total_pages());
- EXPECT_EQ(0, pagination_model_.selected_page());
+ EXPECT_EQ(3, GetPaginationModel()->total_pages());
+ EXPECT_EQ(0, GetPaginationModel()->selected_page());
// Checks on the main view.
AppListMainView* main_view = view_->app_list_main_view();
@@ -215,7 +220,7 @@ void AppListViewTestContext::RunDisplayTest() {
void AppListViewTestContext::RunReshowWithOpenFolderTest() {
EXPECT_FALSE(view_->GetWidget()->IsVisible());
- EXPECT_EQ(-1, pagination_model_.total_pages());
+ EXPECT_EQ(-1, GetPaginationModel()->total_pages());
AppListTestModel* model = delegate_->GetTestModel();
model->PopulateApps(kInitialItems);
@@ -259,7 +264,7 @@ void AppListViewTestContext::RunReshowWithOpenFolderTest() {
void AppListViewTestContext::RunStartPageTest() {
EXPECT_FALSE(view_->GetWidget()->IsVisible());
- EXPECT_EQ(-1, pagination_model_.total_pages());
+ EXPECT_EQ(-1, GetPaginationModel()->total_pages());
AppListTestModel* model = delegate_->GetTestModel();
model->PopulateApps(3);

Powered by Google App Engine
This is Rietveld 408576698