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

Unified Diff: ash/app_list/app_list_shower_delegate_unittest.cc

Issue 1856943003: AppListController refactoring part 2: Ash's AppListShowerDelegate imlementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mus_chrome_delegates_app_list_2
Patch Set: Rebase. Created 4 years, 8 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 | « ash/app_list/app_list_shower_delegate_factory.cc ('k') | ash/app_list/app_list_view_delegate_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/app_list/app_list_shower_delegate_unittest.cc
diff --git a/ash/wm/app_list_controller_unittest.cc b/ash/app_list/app_list_shower_delegate_unittest.cc
similarity index 81%
copy from ash/wm/app_list_controller_unittest.cc
copy to ash/app_list/app_list_shower_delegate_unittest.cc
index 4ac0e5b2644a8b883013c68d5b4f86f92abf936a..37b2526f11b3cfb5b784a06b1d0e1d226769c147 100644
--- a/ash/wm/app_list_controller_unittest.cc
+++ b/ash/app_list/app_list_shower_delegate_unittest.cc
@@ -7,10 +7,12 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/test/ash_test_base.h"
+#include "ash/test/ash_test_helper.h"
#include "ash/test/test_shell_delegate.h"
#include "ash/wm/window_util.h"
#include "base/command_line.h"
#include "ui/app_list/app_list_switches.h"
+#include "ui/app_list/shower/app_list_shower_impl.h"
#include "ui/app_list/views/app_list_view.h"
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h"
@@ -19,30 +21,29 @@
namespace ash {
namespace {
-
const int kMinimalCenteredAppListMargin = 10;
-
}
// The parameter is true to test the centered app list, false for normal.
// (The test name ends in "/0" for normal, "/1" for centered.)
-class AppListControllerTest : public test::AshTestBase,
- public ::testing::WithParamInterface<bool> {
+class AppListShowerDelegateTest : public test::AshTestBase,
+ public ::testing::WithParamInterface<bool> {
public:
- AppListControllerTest();
- virtual ~AppListControllerTest();
+ AppListShowerDelegateTest();
+ virtual ~AppListShowerDelegateTest();
+
+ // testing::Test:
void SetUp() override;
+ app_list::AppListShowerImpl* GetAppListShower();
bool IsCentered() const;
};
-AppListControllerTest::AppListControllerTest() {
-}
+AppListShowerDelegateTest::AppListShowerDelegateTest() {}
-AppListControllerTest::~AppListControllerTest() {
-}
+AppListShowerDelegateTest::~AppListShowerDelegateTest() {}
-void AppListControllerTest::SetUp() {
+void AppListShowerDelegateTest::SetUp() {
AshTestBase::SetUp();
if (IsCentered()) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
@@ -53,12 +54,16 @@ void AppListControllerTest::SetUp() {
UpdateDisplay("1024x768");
}
-bool AppListControllerTest::IsCentered() const {
+app_list::AppListShowerImpl* AppListShowerDelegateTest::GetAppListShower() {
+ return ash_test_helper()->test_shell_delegate()->app_list_shower();
+}
+
+bool AppListShowerDelegateTest::IsCentered() const {
return GetParam();
}
// Tests that app launcher hides when focus moves to a normal window.
-TEST_P(AppListControllerTest, HideOnFocusOut) {
+TEST_P(AppListShowerDelegateTest, HideOnFocusOut) {
Shell::GetInstance()->ShowAppList(NULL);
EXPECT_TRUE(Shell::GetInstance()->GetAppListTargetVisibility());
@@ -70,7 +75,7 @@ TEST_P(AppListControllerTest, HideOnFocusOut) {
// Tests that app launcher remains visible when focus is moved to a different
// window in kShellWindowId_AppListContainer.
-TEST_P(AppListControllerTest, RemainVisibleWhenFocusingToApplistContainer) {
+TEST_P(AppListShowerDelegateTest, RemainVisibleWhenFocusingToApplistContainer) {
Shell::GetInstance()->ShowAppList(NULL);
EXPECT_TRUE(Shell::GetInstance()->GetAppListTargetVisibility());
@@ -84,11 +89,10 @@ TEST_P(AppListControllerTest, RemainVisibleWhenFocusingToApplistContainer) {
}
// Tests that clicking outside the app-list bubble closes it.
-TEST_P(AppListControllerTest, ClickOutsideBubbleClosesBubble) {
+TEST_P(AppListShowerDelegateTest, ClickOutsideBubbleClosesBubble) {
Shell* shell = Shell::GetInstance();
shell->ShowAppList(NULL);
-
- aura::Window* app_window = shell->GetAppListWindow();
+ aura::Window* app_window = GetAppListShower()->GetWindow();
ASSERT_TRUE(app_window);
ui::test::EventGenerator generator(shell->GetPrimaryRootWindow(), app_window);
// Click on the bubble itself. The bubble should remain visible.
@@ -107,11 +111,11 @@ TEST_P(AppListControllerTest, ClickOutsideBubbleClosesBubble) {
}
// Tests that clicking outside the app-list bubble closes it.
-TEST_P(AppListControllerTest, TapOutsideBubbleClosesBubble) {
+TEST_P(AppListShowerDelegateTest, TapOutsideBubbleClosesBubble) {
Shell* shell = Shell::GetInstance();
shell->ShowAppList(NULL);
- aura::Window* app_window = shell->GetAppListWindow();
+ aura::Window* app_window = GetAppListShower()->GetWindow();
ASSERT_TRUE(app_window);
gfx::Rect app_window_bounds = app_window->GetBoundsInRootWindow();
@@ -131,7 +135,7 @@ TEST_P(AppListControllerTest, TapOutsideBubbleClosesBubble) {
// Tests opening the app launcher on a non-primary display, then deleting the
// display.
-TEST_P(AppListControllerTest, NonPrimaryDisplay) {
+TEST_P(AppListShowerDelegateTest, NonPrimaryDisplay) {
if (!SupportsMultipleDisplays())
return;
@@ -156,7 +160,7 @@ TEST_P(AppListControllerTest, NonPrimaryDisplay) {
// Tests opening the app launcher on a tiny display that is too small to contain
// it.
-TEST_P(AppListControllerTest, TinyDisplay) {
+TEST_P(AppListShowerDelegateTest, TinyDisplay) {
// Don't test this for the non-centered app list case; it isn't designed for
// small displays. The most common case of a small display --- when the
// virtual keyboard is open --- switches into the centered app list mode, so
@@ -179,14 +183,14 @@ TEST_P(AppListControllerTest, TinyDisplay) {
// from the anchor (center) and height. There isn't a bounds rect that gives
// the actual app list position (the widget bounds include the bubble border
// which is much bigger than the actual app list size).
- app_list::AppListView* app_list = Shell::GetInstance()->GetAppListView();
+ app_list::AppListView* app_list = GetAppListShower()->GetView();
int app_list_view_top =
app_list->anchor_rect().y() - app_list->bounds().height() / 2;
EXPECT_GE(app_list_view_top, kMinimalCenteredAppListMargin);
}
-INSTANTIATE_TEST_CASE_P(AppListControllerTestInstance,
- AppListControllerTest,
+INSTANTIATE_TEST_CASE_P(AppListShowerDelegateTestInstance,
+ AppListShowerDelegateTest,
::testing::Bool());
} // namespace ash
« no previous file with comments | « ash/app_list/app_list_shower_delegate_factory.cc ('k') | ash/app_list/app_list_view_delegate_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698