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

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

Issue 701773002: App list: Added contents view custom animation framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename some arguments. Created 6 years, 1 month 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 901bcf2f7261a4dd5f0bf8ce6f5551021b9e0ab2..b4bebc28b3b1a08b3882133595c766c71b40c061 100644
--- a/ui/app_list/views/app_list_view_unittest.cc
+++ b/ui/app_list/views/app_list_view_unittest.cc
@@ -19,6 +19,7 @@
#include "ui/app_list/views/app_list_main_view.h"
#include "ui/app_list/views/apps_container_view.h"
#include "ui/app_list/views/apps_grid_view.h"
+#include "ui/app_list/views/contents_animator.h"
#include "ui/app_list/views/contents_switcher_view.h"
#include "ui/app_list/views/contents_view.h"
#include "ui/app_list/views/search_box_view.h"
@@ -102,6 +103,9 @@ class AppListViewTestContext {
// Tests switching rapidly between multiple pages of the launcher.
void RunPageSwitchingAnimationTest();
+ // Tests custom animations between different pages of the launcher.
+ void RunCustomAnimationsTest();
+
// Tests changing the App List profile.
void RunProfileChangeTest();
@@ -442,6 +446,41 @@ void AppListViewTestContext::RunPageSwitchingAnimationTest() {
Close();
}
+void AppListViewTestContext::RunCustomAnimationsTest() {
+ if (test_type_ == EXPERIMENTAL) {
+ Show();
+
+ ContentsView* contents_view = view_->app_list_main_view()->contents_view();
+ ContentsAnimator* animator;
+ bool reverse;
+
+ // A transition without a custom animation.
+ animator = contents_view->GetAnimatorForTransitionForTests(
+ contents_view->GetPageIndexForState(AppListModel::STATE_START),
+ contents_view->GetPageIndexForState(AppListModel::STATE_SEARCH_RESULTS),
+ &reverse);
+ EXPECT_EQ("DefaultAnimator", animator->NameForTests());
+ EXPECT_FALSE(reverse);
+
+ // Test some custom animations.
+ animator = contents_view->GetAnimatorForTransitionForTests(
+ contents_view->GetPageIndexForState(AppListModel::STATE_START),
+ contents_view->GetPageIndexForState(AppListModel::STATE_APPS),
+ &reverse);
+ EXPECT_EQ("StartToAppsAnimator", animator->NameForTests());
+ EXPECT_FALSE(reverse);
+
+ animator = contents_view->GetAnimatorForTransitionForTests(
+ contents_view->GetPageIndexForState(AppListModel::STATE_APPS),
+ contents_view->GetPageIndexForState(AppListModel::STATE_START),
+ &reverse);
+ EXPECT_EQ("StartToAppsAnimator", animator->NameForTests());
+ EXPECT_TRUE(reverse);
+ }
+
+ Close();
calamity 2014/11/05 06:29:07 It's probably worth putting this in its own conten
Matt Giuca 2014/11/06 00:32:58 I just tried doing this. It basically requires the
calamity 2014/11/06 05:34:47 ??? Why? AppListMainViewTest gets by without an Ap
Matt Giuca 2014/11/10 04:08:26 Done. (Thanks for the tip; it was non-obvious how
+}
+
void AppListViewTestContext::RunProfileChangeTest() {
EXPECT_FALSE(view_->GetWidget()->IsVisible());
EXPECT_EQ(-1, GetPaginationModel()->total_pages());
@@ -723,6 +762,15 @@ TEST_P(AppListViewTestDesktop, PageSwitchingAnimationTest) {
EXPECT_NO_FATAL_FAILURE(test_context_->RunPageSwitchingAnimationTest());
}
+// Tests that the contents view correctly selects custom animations.
+TEST_P(AppListViewTestAura, CustomAnimationsTest) {
+ EXPECT_NO_FATAL_FAILURE(test_context_->RunCustomAnimationsTest());
+}
+
+TEST_P(AppListViewTestDesktop, CustomAnimationsTest) {
+ EXPECT_NO_FATAL_FAILURE(test_context_->RunCustomAnimationsTest());
+}
+
// Tests that the profile changes operate correctly.
TEST_P(AppListViewTestAura, ProfileChangeTest) {
EXPECT_NO_FATAL_FAILURE(test_context_->RunProfileChangeTest());

Powered by Google App Engine
This is Rietveld 408576698