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

Unified Diff: ash/launcher/launcher_unittest.cc

Issue 12313118: Refactor: Shelf Widget (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: formatting and moved a couple unit tests Created 7 years, 10 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/launcher/launcher_unittest.cc
diff --git a/ash/launcher/launcher_unittest.cc b/ash/launcher/launcher_unittest.cc
index f16aae6d2077c966bf2ac5e37ca5f51a479ef474..d4085ba347db8b0d532ed17f228af303a9c396cb 100644
--- a/ash/launcher/launcher_unittest.cc
+++ b/ash/launcher/launcher_unittest.cc
@@ -7,6 +7,7 @@
#include "ash/launcher/launcher_model.h"
#include "ash/launcher/launcher_view.h"
+#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/test/launcher_view_test_api.h"
@@ -28,38 +29,6 @@ using ash::internal::LauncherButton;
namespace ash {
-// Makes sure invoking SetStatusSize on the launcher changes the size of the
-// LauncherView.
-TEST_F(LauncherTest, SetStatusSize) {
- Launcher* launcher = Launcher::ForPrimaryDisplay();
- LauncherView* launcher_view = launcher->GetLauncherViewForTest();
-
- gfx::Size launcher_size =
- launcher->widget()->GetWindowBoundsInScreen().size();
- int total_width = launcher_size.width();
- ASSERT_GT(total_width, 0);
- launcher->SetStatusSize(gfx::Size(total_width / 2, launcher_size.height()));
- EXPECT_EQ(total_width - total_width / 2, launcher_view->width());
-}
-
-// Tests that the dimmer widget resizes itself as appropriate.
-TEST_F(LauncherTest, DimmerSize) {
- Launcher* launcher = Launcher::ForPrimaryDisplay();
- launcher->SetDimsShelf(true);
-
- gfx::Size launcher_size =
- launcher->widget()->GetWindowBoundsInScreen().size();
- EXPECT_EQ(
- launcher->widget()->GetWindowBoundsInScreen().ToString(),
- launcher->GetDimmerWidgetForTest()->GetWindowBoundsInScreen().ToString());
-
- launcher->widget()->SetSize(
- gfx::Size(launcher_size.width() / 2, launcher_size.height() + 10));
- EXPECT_EQ(
- launcher->widget()->GetWindowBoundsInScreen().ToString(),
- launcher->GetDimmerWidgetForTest()->GetWindowBoundsInScreen().ToString());
-}
-
// Confirm that launching a browser gets the appropriate state reflected in
// its button.
TEST_F(LauncherTest, OpenBrowser) {
@@ -120,95 +89,4 @@ TEST_F(LauncherTest, ShowOverflowBubble) {
EXPECT_FALSE(launcher->IsShowingOverflowBubble());
}
-// Launcher can't be activated on mouse click, but it is activable from
-// the focus cycler or as fallback.
-TEST_F(LauncherTest, ActivateAsFallback) {
- // TODO(mtomasz): make this test work with the FocusController.
- if (views::corewm::UseFocusController())
- return;
-
- Launcher* launcher = Launcher::ForPrimaryDisplay();
- views::Widget* launcher_widget = launcher->widget();
- EXPECT_FALSE(launcher_widget->CanActivate());
-
- launcher->WillActivateAsFallback();
- EXPECT_TRUE(launcher_widget->CanActivate());
-
- wm::ActivateWindow(launcher_widget->GetNativeWindow());
- EXPECT_FALSE(launcher_widget->CanActivate());
-}
-
-void TestLauncherAlignment(aura::RootWindow* root,
- ShelfAlignment alignment,
- const std::string& expected) {
- Shell::GetInstance()->SetShelfAlignment(alignment, root);
- gfx::Screen* screen = gfx::Screen::GetScreenFor(root);
- EXPECT_EQ(expected,
- screen->GetDisplayNearestWindow(root).work_area().ToString());
-}
-
-TEST_F(LauncherTest, TestAlignment) {
- Launcher* launcher = Launcher::ForPrimaryDisplay();
- UpdateDisplay("400x400");
- ASSERT_TRUE(launcher);
- {
- SCOPED_TRACE("Single Bottom");
- TestLauncherAlignment(Shell::GetPrimaryRootWindow(),
- SHELF_ALIGNMENT_BOTTOM,
- "0,0 400x352");
- }
- {
- SCOPED_TRACE("Single Right");
- TestLauncherAlignment(Shell::GetPrimaryRootWindow(),
- SHELF_ALIGNMENT_RIGHT,
- "0,0 348x400");
- }
- {
- SCOPED_TRACE("Single Left");
- TestLauncherAlignment(Shell::GetPrimaryRootWindow(),
- SHELF_ALIGNMENT_LEFT,
- "52,0 348x400");
- }
- UpdateDisplay("300x300,500x500");
- Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
- {
- SCOPED_TRACE("Primary Bottom");
- TestLauncherAlignment(root_windows[0],
- SHELF_ALIGNMENT_BOTTOM,
- "0,0 300x252");
- }
- {
- SCOPED_TRACE("Primary Right");
- TestLauncherAlignment(root_windows[0],
- SHELF_ALIGNMENT_RIGHT,
- "0,0 248x300");
- }
- {
- SCOPED_TRACE("Primary Left");
- TestLauncherAlignment(root_windows[0],
- SHELF_ALIGNMENT_LEFT,
- "52,0 248x300");
- }
- if (Shell::IsLauncherPerDisplayEnabled()) {
- {
- SCOPED_TRACE("Secondary Bottom");
- TestLauncherAlignment(root_windows[1],
- SHELF_ALIGNMENT_BOTTOM,
- "300,0 500x452");
- }
- {
- SCOPED_TRACE("Secondary Right");
- TestLauncherAlignment(root_windows[1],
- SHELF_ALIGNMENT_RIGHT,
- "300,0 448x500");
- }
- {
- SCOPED_TRACE("Secondary Left");
- TestLauncherAlignment(root_windows[1],
- SHELF_ALIGNMENT_LEFT,
- "352,0 448x500");
- }
- }
-}
-
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698