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

Unified Diff: ash/wm/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
Index: ash/wm/app_list_shower_delegate_unittest.cc
diff --git a/ash/wm/app_list_controller_unittest.cc b/ash/wm/app_list_shower_delegate_unittest.cc
similarity index 81%
copy from ash/wm/app_list_controller_unittest.cc
copy to ash/wm/app_list_shower_delegate_unittest.cc
index 39f2b77ba2e9b41c6ceb6d26dca8e3be7d5bee23..fc5bae1831c9e0b7ff4a38ba07d3f28113717c09 100644
--- a/ash/wm/app_list_controller_unittest.cc
+++ b/ash/wm/app_list_shower_delegate_unittest.cc
@@ -5,11 +5,13 @@
#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 "base/memory/scoped_ptr.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"
@@ -18,30 +20,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();
@@ -52,12 +53,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());
@@ -69,7 +74,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());
@@ -83,11 +88,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.
@@ -106,11 +110,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();
@@ -130,7 +134,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;
@@ -155,7 +159,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
@@ -178,14 +182,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

Powered by Google App Engine
This is Rietveld 408576698