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

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

Issue 316393002: App list uses PaginationModel to transition between pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 6 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
« no previous file with comments | « ui/app_list/pagination_model.cc ('k') | ui/app_list/views/contents_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 69429e90077dbbfddcdcc5cd7699f53ddd20987c..280331c0bb5f0d800c1f4097c81c08a36ab121b6 100644
--- a/ui/app_list/views/app_list_view_unittest.cc
+++ b/ui/app_list/views/app_list_view_unittest.cc
@@ -78,6 +78,9 @@ class AppListViewTestContext {
// Tests displaying of the experimental app list and shows the start page.
void RunStartPageTest();
+ // Tests switching rapidly between multiple pages of the launcher.
+ void RunPageSwitchingAnimationTest();
+
// Tests changing the App List profile.
void RunProfileChangeTest();
@@ -316,6 +319,49 @@ void AppListViewTestContext::RunStartPageTest() {
Close();
}
+void AppListViewTestContext::RunPageSwitchingAnimationTest() {
+ if (test_type_ == EXPERIMENTAL) {
+ Show();
+
+ AppListMainView* main_view = view_->app_list_main_view();
+ // Checks on the main view.
+ EXPECT_NO_FATAL_FAILURE(CheckView(main_view));
+ EXPECT_NO_FATAL_FAILURE(CheckView(main_view->contents_view()));
+
+ ContentsView* contents_view = main_view->contents_view();
+ // Pad the ContentsView with blank pages so we have at least 3 views.
+ while (contents_view->NumLauncherPages() < 3)
+ contents_view->AddBlankPageForTesting();
+
+ contents_view->SetActivePage(0);
+ contents_view->Layout();
+ EXPECT_TRUE(IsViewAtOrigin(contents_view->GetPageView(0)));
+ EXPECT_FALSE(IsViewAtOrigin(contents_view->GetPageView(1)));
+ EXPECT_FALSE(IsViewAtOrigin(contents_view->GetPageView(2)));
+
+ // Change pages. View should not have moved without Layout().
+ contents_view->SetActivePage(1);
+ EXPECT_TRUE(IsViewAtOrigin(contents_view->GetPageView(0)));
+ EXPECT_FALSE(IsViewAtOrigin(contents_view->GetPageView(1)));
+ EXPECT_FALSE(IsViewAtOrigin(contents_view->GetPageView(2)));
+
+ // Change to a third page. This queues up the second animation behind the
+ // first.
+ contents_view->SetActivePage(2);
+ EXPECT_TRUE(IsViewAtOrigin(contents_view->GetPageView(0)));
+ EXPECT_FALSE(IsViewAtOrigin(contents_view->GetPageView(1)));
+ EXPECT_FALSE(IsViewAtOrigin(contents_view->GetPageView(2)));
+
+ // Call Layout(). Should jump to the third page.
+ contents_view->Layout();
+ EXPECT_FALSE(IsViewAtOrigin(contents_view->GetPageView(0)));
+ EXPECT_FALSE(IsViewAtOrigin(contents_view->GetPageView(1)));
+ EXPECT_TRUE(IsViewAtOrigin(contents_view->GetPageView(2)));
+ }
+
+ Close();
+}
+
void AppListViewTestContext::RunProfileChangeTest() {
EXPECT_FALSE(view_->GetWidget()->IsVisible());
EXPECT_EQ(-1, GetPaginationModel()->total_pages());
@@ -529,6 +575,15 @@ TEST_P(AppListViewTestDesktop, StartPageTest) {
EXPECT_NO_FATAL_FAILURE(test_context_->RunStartPageTest());
}
+// Tests that the start page view operates correctly.
+TEST_P(AppListViewTestAura, PageSwitchingAnimationTest) {
+ EXPECT_NO_FATAL_FAILURE(test_context_->RunPageSwitchingAnimationTest());
+}
+
+TEST_P(AppListViewTestDesktop, PageSwitchingAnimationTest) {
+ EXPECT_NO_FATAL_FAILURE(test_context_->RunPageSwitchingAnimationTest());
+}
+
// Tests that the profile changes operate correctly.
TEST_P(AppListViewTestAura, ProfileChangeTest) {
EXPECT_NO_FATAL_FAILURE(test_context_->RunProfileChangeTest());
« no previous file with comments | « ui/app_list/pagination_model.cc ('k') | ui/app_list/views/contents_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698