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

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: Fix tests and bugs. 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..40f0ae7598a9adf0ff3b902b6ffed01791eb082f 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* PaginationModel() const;
xiyuan 2014/05/30 15:47:47 nit: accessor should be named in lower case, like
Matt Giuca 2014/06/02 07:11:23 const: done. lowercase: My reading of the style gu
+
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,25 @@ void AppListViewTestContext::Close() {
EXPECT_FALSE(view_);
}
+PaginationModel* AppListViewTestContext::PaginationModel() const {
+ return view_->app_list_main_view()
+ ->contents_view()
+ ->apps_container_view()
+ ->apps_grid_view()
+ ->GetPaginationModel();
+}
+
void AppListViewTestContext::RunDisplayTest() {
EXPECT_FALSE(view_->GetWidget()->IsVisible());
- EXPECT_EQ(-1, pagination_model_.total_pages());
+ EXPECT_EQ(-1, PaginationModel()->total_pages());
delegate_->GetTestModel()->PopulateApps(kInitialItems);
Show();
if (is_landscape())
- EXPECT_EQ(2, pagination_model_.total_pages());
+ EXPECT_EQ(2, PaginationModel()->total_pages());
else
- EXPECT_EQ(3, pagination_model_.total_pages());
- EXPECT_EQ(0, pagination_model_.selected_page());
+ EXPECT_EQ(3, PaginationModel()->total_pages());
+ EXPECT_EQ(0, PaginationModel()->selected_page());
// Checks on the main view.
AppListMainView* main_view = view_->app_list_main_view();
@@ -215,7 +224,7 @@ void AppListViewTestContext::RunDisplayTest() {
void AppListViewTestContext::RunReshowWithOpenFolderTest() {
EXPECT_FALSE(view_->GetWidget()->IsVisible());
- EXPECT_EQ(-1, pagination_model_.total_pages());
+ EXPECT_EQ(-1, PaginationModel()->total_pages());
AppListTestModel* model = delegate_->GetTestModel();
model->PopulateApps(kInitialItems);
@@ -259,7 +268,7 @@ void AppListViewTestContext::RunReshowWithOpenFolderTest() {
void AppListViewTestContext::RunStartPageTest() {
EXPECT_FALSE(view_->GetWidget()->IsVisible());
- EXPECT_EQ(-1, pagination_model_.total_pages());
+ EXPECT_EQ(-1, PaginationModel()->total_pages());
AppListTestModel* model = delegate_->GetTestModel();
model->PopulateApps(3);

Powered by Google App Engine
This is Rietveld 408576698