summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharrym@chromium.org <harrym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-05 01:09:02 +0000
committerharrym@chromium.org <harrym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-05 01:09:02 +0000
commitf54effec70d277cdafeb4199171ceb8290ded068 (patch)
tree3e151ce06c782ef37b2c3400558a8f88c83e1aa8
parente6a1b4ee5411faaf44a95204299e9738bffc8a80 (diff)
downloadchromium_src-f54effec70d277cdafeb4199171ceb8290ded068.zip
chromium_src-f54effec70d277cdafeb4199171ceb8290ded068.tar.gz
chromium_src-f54effec70d277cdafeb4199171ceb8290ded068.tar.bz2
ash:Shelf - Enable Alternate Shelf and Side Shelf by default.
Updated and/or duplicated (updated with copy renamed *ForLegacyShelfLayout) unit tests as required. BUG=246279 TBR=jamescook@chromium.org, skuhne@chromium.org Review URL: https://codereview.chromium.org/22793011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221325 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/ash_switches.cc12
-rw-r--r--ash/ash_switches.h1
-rw-r--r--ash/dip_unittest.cc41
-rw-r--r--ash/display/display_controller_unittest.cc96
-rw-r--r--ash/launcher/launcher_model_unittest.cc125
-rw-r--r--ash/launcher/launcher_navigator_unittest.cc69
-rw-r--r--ash/launcher/launcher_view.cc5
-rw-r--r--ash/launcher/launcher_view_unittest.cc203
-rw-r--r--ash/root_window_controller_unittest.cc4
-rw-r--r--ash/screen_ash_unittest.cc4
-rw-r--r--ash/shelf/shelf_layout_manager.cc6
-rw-r--r--ash/shelf/shelf_layout_manager_unittest.cc11
-rw-r--r--ash/shelf/shelf_widget_unittest.cc18
-rw-r--r--ash/wm/custom_frame_view_ash_unittest.cc2
-rw-r--r--ash/wm/workspace/workspace_layout_manager_unittest.cc6
-rw-r--r--ash/wm/workspace/workspace_window_resizer_unittest.cc6
-rw-r--r--chrome/browser/about_flags.cc3
-rw-r--r--chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc29
-rw-r--r--chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc117
-rw-r--r--chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc14
20 files changed, 613 insertions, 159 deletions
diff --git a/ash/ash_switches.cc b/ash/ash_switches.cc
index 33d3672..b70c6f9 100644
--- a/ash/ash_switches.cc
+++ b/ash/ash_switches.cc
@@ -44,6 +44,10 @@ const char kAshDefaultGuestWallpaperSmall[] =
const char kAshDefaultWallpaperLarge[] = "ash-default-wallpaper-large";
const char kAshDefaultWallpaperSmall[] = "ash-default-wallpaper-small";
+// Disable the alternate shelf layout.
+const char kAshDisableAlternateShelfLayout[] =
+ "ash-disable-alternate-shelf-layout";
+
#if defined(OS_CHROMEOS)
// Disable the status tray volume menu for allowing the user to choose an audio
// input and output device.
@@ -180,8 +184,8 @@ const char kAshDisableDragAndDropAppListToLauncher[] =
const char kForcedMaximizeMode[] = "forced-maximize-mode";
bool UseAlternateShelfLayout() {
- return CommandLine::ForCurrentProcess()->
- HasSwitch(ash::switches::kAshUseAlternateShelfLayout);
+ return !CommandLine::ForCurrentProcess()->
+ HasSwitch(ash::switches::kAshDisableAlternateShelfLayout);
}
bool UseDragOffShelf() {
@@ -190,8 +194,8 @@ bool UseDragOffShelf() {
}
bool ShowShelfAlignmentMenu() {
- return CommandLine::ForCurrentProcess()->
- HasSwitch(switches::kShowShelfAlignmentMenu);
+ return !CommandLine::ForCurrentProcess()->
+ HasSwitch(switches::kHideShelfAlignmentMenu);
}
#if defined(OS_CHROMEOS)
diff --git a/ash/ash_switches.h b/ash/ash_switches.h
index 73f2303..bbf026a 100644
--- a/ash/ash_switches.h
+++ b/ash/ash_switches.h
@@ -26,6 +26,7 @@ ASH_EXPORT extern const char kAshDefaultGuestWallpaperLarge[];
ASH_EXPORT extern const char kAshDefaultGuestWallpaperSmall[];
ASH_EXPORT extern const char kAshDefaultWallpaperLarge[];
ASH_EXPORT extern const char kAshDefaultWallpaperSmall[];
+ASH_EXPORT extern const char kAshDisableAlternateShelfLayout[];
#if defined(OS_CHROMEOS)
ASH_EXPORT extern const char kAshDisableAudioDeviceMenu[];
#endif
diff --git a/ash/dip_unittest.cc b/ash/dip_unittest.cc
index 9869a01..4a6745a 100644
--- a/ash/dip_unittest.cc
+++ b/ash/dip_unittest.cc
@@ -5,6 +5,7 @@
#include <algorithm>
#include <vector>
+#include "ash/ash_switches.h"
#include "ash/display/display_manager.h"
#include "ash/launcher/launcher.h"
#include "ash/shelf/shelf_widget.h"
@@ -12,6 +13,7 @@
#include "ash/test/ash_test_base.h"
#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
+#include "base/command_line.h"
#include "base/memory/scoped_ptr.h"
#include "ui/aura/client/activation_client.h"
#include "ui/aura/root_window.h"
@@ -39,6 +41,45 @@ TEST_F(DIPTest, WorkArea) {
EXPECT_EQ("0,0 1000x900", display.bounds().ToString());
gfx::Rect work_area = display.work_area();
+ EXPECT_EQ("0,0 1000x853", work_area.ToString());
+ EXPECT_EQ("0,0,47,0", display.bounds().InsetsFrom(work_area).ToString());
+
+ UpdateDisplay("2000x1800*2.0f");
+ gfx::Screen* screen = Shell::GetScreen();
+
+ const gfx::Display display_2x = screen->GetDisplayNearestWindow(root);
+ const internal::DisplayInfo display_info_2x =
+ Shell::GetInstance()->display_manager()->GetDisplayInfo(display_2x.id());
+
+ // The |bounds_in_pixel()| should report bounds in pixel coordinate.
+ EXPECT_EQ("1,1 2000x1800",
+ display_info_2x.bounds_in_pixel().ToString());
+
+ // Aura and views coordinates are in DIP, so they their bounds do not change.
+ EXPECT_EQ("0,0 1000x900", display_2x.bounds().ToString());
+ work_area = display_2x.work_area();
+ EXPECT_EQ("0,0 1000x853", work_area.ToString());
+ EXPECT_EQ("0,0,47,0", display_2x.bounds().InsetsFrom(work_area).ToString());
+
+ // Sanity check if the workarea's inset hight is same as
+ // the launcher's height.
+ Launcher* launcher = Launcher::ForPrimaryDisplay();
+ EXPECT_EQ(
+ display_2x.bounds().InsetsFrom(work_area).height(),
+ launcher->shelf_widget()->GetNativeView()->layer()->bounds().height());
+}
+
+TEST_F(DIPTest, WorkAreaForLegacyShelfLayout) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ ash::switches::kAshDisableAlternateShelfLayout);
+ UpdateDisplay("1000x900*1.0f");
+
+ aura::RootWindow* root = Shell::GetPrimaryRootWindow();
+ const gfx::Display display =
+ Shell::GetScreen()->GetDisplayNearestWindow(root);
+
+ EXPECT_EQ("0,0 1000x900", display.bounds().ToString());
+ gfx::Rect work_area = display.work_area();
EXPECT_EQ("0,0 1000x852", work_area.ToString());
EXPECT_EQ("0,0,48,0", display.bounds().InsetsFrom(work_area).ToString());
diff --git a/ash/display/display_controller_unittest.cc b/ash/display/display_controller_unittest.cc
index 7e6a048..5024ef9 100644
--- a/ash/display/display_controller_unittest.cc
+++ b/ash/display/display_controller_unittest.cc
@@ -4,6 +4,7 @@
#include "ash/display/display_controller.h"
+#include "ash/ash_switches.h"
#include "ash/display/display_info.h"
#include "ash/display/display_layout_store.h"
#include "ash/display/display_manager.h"
@@ -13,6 +14,7 @@
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/test/cursor_manager_test_api.h"
+#include "base/command_line.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/aura/test/event_generator.h"
@@ -479,6 +481,100 @@ TEST_F(DisplayControllerTest, SwapPrimary) {
Shell::GetScreen()->GetDisplayNearestWindow(NULL).id());
EXPECT_EQ("0,0 200x200", primary_display.bounds().ToString());
+ EXPECT_EQ("0,0 200x153", primary_display.work_area().ToString());
+ EXPECT_EQ("200,0 300x300", secondary_display.bounds().ToString());
+ EXPECT_EQ("200,0 300x253", secondary_display.work_area().ToString());
+ EXPECT_EQ("right, 50",
+ display_manager->GetCurrentDisplayLayout().ToString());
+
+ // Switch primary and secondary
+ display_controller->SetPrimaryDisplay(secondary_display);
+ const DisplayLayout& inverted_layout =
+ display_manager->GetCurrentDisplayLayout();
+ EXPECT_EQ("left, -50", inverted_layout.ToString());
+
+ EXPECT_EQ(secondary_display.id(),
+ Shell::GetScreen()->GetPrimaryDisplay().id());
+ EXPECT_EQ(primary_display.id(), ScreenAsh::GetSecondaryDisplay().id());
+ EXPECT_EQ(secondary_display.id(),
+ Shell::GetScreen()->GetDisplayNearestPoint(
+ gfx::Point(-100, -100)).id());
+ EXPECT_EQ(secondary_display.id(),
+ Shell::GetScreen()->GetDisplayNearestWindow(NULL).id());
+
+ EXPECT_EQ(
+ primary_root,
+ display_controller->GetRootWindowForDisplayId(secondary_display.id()));
+ EXPECT_EQ(
+ secondary_root,
+ display_controller->GetRootWindowForDisplayId(primary_display.id()));
+ EXPECT_TRUE(primary_root->Contains(launcher_window));
+ EXPECT_FALSE(secondary_root->Contains(launcher_window));
+
+ // Test if the bounds are correctly swapped.
+ gfx::Display swapped_primary = Shell::GetScreen()->GetPrimaryDisplay();
+ gfx::Display swapped_secondary = ScreenAsh::GetSecondaryDisplay();
+ EXPECT_EQ("0,0 300x300", swapped_primary.bounds().ToString());
+ EXPECT_EQ("0,0 300x253", swapped_primary.work_area().ToString());
+ EXPECT_EQ("-200,-50 200x200", swapped_secondary.bounds().ToString());
+
+ EXPECT_EQ("-200,-50 200x153", swapped_secondary.work_area().ToString());
+
+ aura::WindowTracker tracker;
+ tracker.Add(primary_root);
+ tracker.Add(secondary_root);
+
+ // Deleting 2nd display should move the primary to original primary display.
+ UpdateDisplay("200x200");
+ RunAllPendingInMessageLoop(); // RootWindow is deleted in a posted task.
+ EXPECT_EQ(1, Shell::GetScreen()->GetNumDisplays());
+ EXPECT_EQ(primary_display.id(), Shell::GetScreen()->GetPrimaryDisplay().id());
+ EXPECT_EQ(primary_display.id(),
+ Shell::GetScreen()->GetDisplayNearestPoint(
+ gfx::Point(-100, -100)).id());
+ EXPECT_EQ(primary_display.id(),
+ Shell::GetScreen()->GetDisplayNearestWindow(NULL).id());
+ EXPECT_TRUE(tracker.Contains(primary_root));
+ EXPECT_FALSE(tracker.Contains(secondary_root));
+ EXPECT_TRUE(primary_root->Contains(launcher_window));
+}
+
+TEST_F(DisplayControllerTest, SwapPrimaryForLegacyShelfLayout) {
+ if (!SupportsMultipleDisplays())
+ return;
+
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ ash::switches::kAshDisableAlternateShelfLayout);
+
+ DisplayController* display_controller =
+ Shell::GetInstance()->display_controller();
+ internal::DisplayManager* display_manager =
+ Shell::GetInstance()->display_manager();
+
+ UpdateDisplay("200x200,300x300");
+ gfx::Display primary_display = Shell::GetScreen()->GetPrimaryDisplay();
+ gfx::Display secondary_display = ScreenAsh::GetSecondaryDisplay();
+
+ DisplayLayout display_layout(DisplayLayout::RIGHT, 50);
+ display_controller->SetLayoutForCurrentDisplays(display_layout);
+
+ EXPECT_NE(primary_display.id(), secondary_display.id());
+ aura::RootWindow* primary_root =
+ display_controller->GetRootWindowForDisplayId(primary_display.id());
+ aura::RootWindow* secondary_root =
+ display_controller->GetRootWindowForDisplayId(secondary_display.id());
+ EXPECT_NE(primary_root, secondary_root);
+ aura::Window* launcher_window =
+ Launcher::ForPrimaryDisplay()->shelf_widget()->GetNativeView();
+ EXPECT_TRUE(primary_root->Contains(launcher_window));
+ EXPECT_FALSE(secondary_root->Contains(launcher_window));
+ EXPECT_EQ(primary_display.id(),
+ Shell::GetScreen()->GetDisplayNearestPoint(
+ gfx::Point(-100, -100)).id());
+ EXPECT_EQ(primary_display.id(),
+ Shell::GetScreen()->GetDisplayNearestWindow(NULL).id());
+
+ EXPECT_EQ("0,0 200x200", primary_display.bounds().ToString());
EXPECT_EQ("0,0 200x152", primary_display.work_area().ToString());
EXPECT_EQ("200,0 300x300", secondary_display.bounds().ToString());
EXPECT_EQ("200,0 300x252", secondary_display.work_area().ToString());
diff --git a/ash/launcher/launcher_model_unittest.cc b/ash/launcher/launcher_model_unittest.cc
index 7011e27..38a855b 100644
--- a/ash/launcher/launcher_model_unittest.cc
+++ b/ash/launcher/launcher_model_unittest.cc
@@ -7,7 +7,9 @@
#include <set>
#include <string>
+#include "ash/ash_switches.h"
#include "ash/launcher/launcher_model_observer.h"
+#include "base/command_line.h"
#include "base/strings/stringprintf.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -143,6 +145,94 @@ TEST(LauncherModel, AddIndices) {
LauncherItem browser_shortcut;
browser_shortcut.type = TYPE_BROWSER_SHORTCUT;
int browser_shortcut_index = model.Add(browser_shortcut);
+ EXPECT_EQ(1, browser_shortcut_index);
+
+ // platform app items should be after browser shortcut.
+ LauncherItem item;
+ item.type = TYPE_PLATFORM_APP;
+ int platform_app_index1 = model.Add(item);
+ EXPECT_EQ(2, platform_app_index1);
+
+ // Add another platform app item, it should follow first.
+ int platform_app_index2 = model.Add(item);
+ EXPECT_EQ(3, platform_app_index2);
+
+ // APP_SHORTCUT priority is higher than PLATFORM_APP but same as
+ // BROWSER_SHORTCUT. So APP_SHORTCUT is located after BROWSER_SHORCUT.
+ item.type = TYPE_APP_SHORTCUT;
+ int app_shortcut_index1 = model.Add(item);
+ EXPECT_EQ(2, app_shortcut_index1);
+
+ item.type = TYPE_APP_SHORTCUT;
+ int app_shortcut_index2 = model.Add(item);
+ EXPECT_EQ(3, app_shortcut_index2);
+
+ // Check that AddAt() figures out the correct indexes for app shortcuts.
+ // APP_SHORTCUT and BROWSER_SHORTCUT has the same weight.
+ // So APP_SHORTCUT is located at index 0. And, BROWSER_SHORTCUT is located at
+ // index 1.
+ item.type = TYPE_APP_SHORTCUT;
+ int app_shortcut_index3 = model.AddAt(1, item);
+ EXPECT_EQ(1, app_shortcut_index3);
+
+ item.type = TYPE_APP_SHORTCUT;
+ int app_shortcut_index4 = model.AddAt(6, item);
+ EXPECT_EQ(5, app_shortcut_index4);
+
+ item.type = TYPE_APP_SHORTCUT;
+ int app_shortcut_index5 = model.AddAt(3, item);
+ EXPECT_EQ(3, app_shortcut_index5);
+
+ // Before there are any panels, no icons should be right aligned.
+ EXPECT_EQ(model.item_count(), model.FirstPanelIndex());
+
+ // Check that AddAt() figures out the correct indexes for platform apps and
+ // panels.
+ item.type = TYPE_PLATFORM_APP;
+ int platform_app_index3 = model.AddAt(3, item);
+ EXPECT_EQ(7, platform_app_index3);
+
+ item.type = TYPE_APP_PANEL;
+ int app_panel_index1 = model.AddAt(2, item);
+ EXPECT_EQ(10, app_panel_index1);
+
+ item.type = TYPE_PLATFORM_APP;
+ int platform_app_index4 = model.AddAt(11, item);
+ EXPECT_EQ(10, platform_app_index4);
+
+ item.type = TYPE_APP_PANEL;
+ int app_panel_index2 = model.AddAt(12, item);
+ EXPECT_EQ(12, app_panel_index2);
+
+ item.type = TYPE_PLATFORM_APP;
+ int platform_app_index5 = model.AddAt(7, item);
+ EXPECT_EQ(7, platform_app_index5);
+
+ item.type = TYPE_APP_PANEL;
+ int app_panel_index3 = model.AddAt(13, item);
+ EXPECT_EQ(13, app_panel_index3);
+
+ // Right aligned index should be the first app panel index.
+ EXPECT_EQ(12, model.FirstPanelIndex());
+
+ EXPECT_EQ(TYPE_BROWSER_SHORTCUT, model.items()[2].type);
+ EXPECT_EQ(TYPE_APP_LIST, model.items()[0].type);
+}
+
+// Assertions around where items are added.
+TEST(LauncherModel, AddIndicesForLegacyShelfLayout) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ ash::switches::kAshDisableAlternateShelfLayout);
+ TestLauncherModelObserver observer;
+ LauncherModel model;
+
+ // Model is initially populated with one item.
+ EXPECT_EQ(1, model.item_count());
+
+ // Insert browser short cut at index 0.
+ LauncherItem browser_shortcut;
+ browser_shortcut.type = TYPE_BROWSER_SHORTCUT;
+ int browser_shortcut_index = model.Add(browser_shortcut);
EXPECT_EQ(0, browser_shortcut_index);
// platform app items should be after browser shortcut.
@@ -155,7 +245,7 @@ TEST(LauncherModel, AddIndices) {
int platform_app_index2 = model.Add(item);
EXPECT_EQ(2, platform_app_index2);
- // APP_SHORTCUT's priority is higher than PLATFORM_APP but same as
+ // APP_SHORTCUT priority is higher than PLATFORM_APP but same as
// BROWSER_SHORTCUT. So APP_SHORTCUT is located after BROWSER_SHORCUT.
item.type = TYPE_APP_SHORTCUT;
int app_shortcut_index1 = model.Add(item);
@@ -258,6 +348,39 @@ TEST(LauncherModel, CorrectMoveItemsWhenStateChange) {
LauncherItem browser_shortcut;
browser_shortcut.type = TYPE_BROWSER_SHORTCUT;
int browser_shortcut_index = model.Add(browser_shortcut);
+ EXPECT_EQ(1, browser_shortcut_index);
+
+ // Add three shortcuts. They should all be moved between the two.
+ LauncherItem item;
+ item.type = TYPE_APP_SHORTCUT;
+ int app1_index = model.Add(item);
+ EXPECT_EQ(2, app1_index);
+ int app2_index = model.Add(item);
+ EXPECT_EQ(3, app2_index);
+ int app3_index = model.Add(item);
+ EXPECT_EQ(4, app3_index);
+
+ // Now change the type of the second item and make sure that it is moving
+ // behind the shortcuts.
+ item.type = TYPE_PLATFORM_APP;
+ model.Set(app2_index, item);
+
+ // The item should have moved in front of the app launcher.
+ EXPECT_EQ(TYPE_PLATFORM_APP, model.items()[4].type);
+}
+
+TEST(LauncherModel, CorrectMoveItemsWhenStateChangeForLegacyShelfLayout) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ ash::switches::kAshDisableAlternateShelfLayout);
+ LauncherModel model;
+
+ // The app list should be the last item in the list.
+ EXPECT_EQ(1, model.item_count());
+
+ // The first item is the browser.
+ LauncherItem browser_shortcut;
+ browser_shortcut.type = TYPE_BROWSER_SHORTCUT;
+ int browser_shortcut_index = model.Add(browser_shortcut);
EXPECT_EQ(0, browser_shortcut_index);
// Add three shortcuts. They should all be moved between the two.
diff --git a/ash/launcher/launcher_navigator_unittest.cc b/ash/launcher/launcher_navigator_unittest.cc
index 78f1261..7fa3446 100644
--- a/ash/launcher/launcher_navigator_unittest.cc
+++ b/ash/launcher/launcher_navigator_unittest.cc
@@ -4,9 +4,11 @@
#include "ash/launcher/launcher_navigator.h"
+#include "ash/ash_switches.h"
#include "ash/launcher/launcher.h"
#include "ash/launcher/launcher_model.h"
#include "ash/launcher/launcher_types.h"
+#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -62,7 +64,22 @@ class LauncherNavigatorTest : public testing::Test {
DISALLOW_COPY_AND_ASSIGN(LauncherNavigatorTest);
};
-} // namespace
+class LauncherNavigatorLegacyShelfLayoutTest : public LauncherNavigatorTest {
+ public:
+ LauncherNavigatorLegacyShelfLayoutTest() : LauncherNavigatorTest() {}
+
+ protected:
+ virtual void SetUp() OVERRIDE {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ ash::switches::kAshDisableAlternateShelfLayout);
+ LauncherNavigatorTest::SetUp();
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(LauncherNavigatorLegacyShelfLayoutTest);
+};
+
+} // namespace
TEST_F(LauncherNavigatorTest, BasicCycle) {
// An app shortcut and three platform apps.
@@ -70,6 +87,22 @@ TEST_F(LauncherNavigatorTest, BasicCycle) {
TYPE_APP_SHORTCUT, TYPE_PLATFORM_APP, TYPE_PLATFORM_APP, TYPE_PLATFORM_APP,
};
// LauncherModel automatically adds BROWSER_SHORTCUT item at the
+ // beginning, so '3' refers the first TYPE_PLATFORM_APP item.
+ SetupMockLauncherModel(types, arraysize(types), 3);
+
+ EXPECT_EQ(4, GetNextActivatedItemIndex(model(), CYCLE_FORWARD));
+
+ // Fourth one. It will skip the APP_SHORTCUT at the beginning of the list and
+ // the APP_LIST item which is automatically added at the end of items.
+ EXPECT_EQ(5, GetNextActivatedItemIndex(model(), CYCLE_BACKWARD));
+}
+
+TEST_F(LauncherNavigatorLegacyShelfLayoutTest, BasicCycle) {
+ // An app shortcut and three platform apps.
+ LauncherItemType types[] = {
+ TYPE_APP_SHORTCUT, TYPE_PLATFORM_APP, TYPE_PLATFORM_APP, TYPE_PLATFORM_APP,
+ };
+ // LauncherModel automatically adds BROWSER_SHORTCUT item at the
// beginning, so '2' refers the first TYPE_PLATFORM_APP item.
SetupMockLauncherModel(types, arraysize(types), 2);
@@ -84,6 +117,18 @@ TEST_F(LauncherNavigatorTest, WrapToBeginning) {
LauncherItemType types[] = {
TYPE_APP_SHORTCUT, TYPE_PLATFORM_APP, TYPE_PLATFORM_APP, TYPE_PLATFORM_APP,
};
+ SetupMockLauncherModel(types, arraysize(types), 5);
+
+ // Second one. It skips the APP_LIST item at the end of the list,
+ // wraps to the beginning, and skips BROWSER_SHORTCUT and APP_SHORTCUT
+ // at the beginning of the list.
+ EXPECT_EQ(3, GetNextActivatedItemIndex(model(), CYCLE_FORWARD));
+}
+
+TEST_F(LauncherNavigatorLegacyShelfLayoutTest, WrapToBeginning) {
+ LauncherItemType types[] = {
+ TYPE_APP_SHORTCUT, TYPE_PLATFORM_APP, TYPE_PLATFORM_APP, TYPE_PLATFORM_APP,
+ };
SetupMockLauncherModel(types, arraysize(types), 4);
// Second one. It skips the APP_LIST item at the end of the list,
@@ -100,6 +145,16 @@ TEST_F(LauncherNavigatorTest, Empty) {
TEST_F(LauncherNavigatorTest, SingleEntry) {
LauncherItemType type = TYPE_PLATFORM_APP;
+ SetupMockLauncherModel(&type, 1, 2);
+
+ // If there's only one item there and it is already active, there's no item
+ // to be activated next.
+ EXPECT_EQ(-1, GetNextActivatedItemIndex(model(), CYCLE_FORWARD));
+ EXPECT_EQ(-1, GetNextActivatedItemIndex(model(), CYCLE_BACKWARD));
+}
+
+TEST_F(LauncherNavigatorLegacyShelfLayoutTest, SingleEntry) {
+ LauncherItemType type = TYPE_PLATFORM_APP;
SetupMockLauncherModel(&type, 1, 1);
// If there's only one item there and it is already active, there's no item
@@ -116,6 +171,18 @@ TEST_F(LauncherNavigatorTest, NoActive) {
SetupMockLauncherModel(types, arraysize(types), -1);
// If there are no active status, pick the first running item as a fallback.
+ EXPECT_EQ(2, GetNextActivatedItemIndex(model(), CYCLE_FORWARD));
+ EXPECT_EQ(2, GetNextActivatedItemIndex(model(), CYCLE_BACKWARD));
+}
+
+TEST_F(LauncherNavigatorLegacyShelfLayoutTest, NoActive) {
+ LauncherItemType types[] = {
+ TYPE_PLATFORM_APP, TYPE_PLATFORM_APP,
+ };
+ // Special case: no items are 'STATUS_ACTIVE'.
+ SetupMockLauncherModel(types, arraysize(types), -1);
+
+ // If there are no active status, pick the first running item as a fallback.
EXPECT_EQ(1, GetNextActivatedItemIndex(model(), CYCLE_FORWARD));
EXPECT_EQ(1, GetNextActivatedItemIndex(model(), CYCLE_BACKWARD));
}
diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc
index ce43c60..2e6f9da 100644
--- a/ash/launcher/launcher_view.cc
+++ b/ash/launcher/launcher_view.cc
@@ -805,7 +805,7 @@ void LauncherView::CalculateIdealBounds(IdealBounds* bounds) {
// Create Space for the overflow button
if (show_overflow && ash::switches::UseAlternateShelfLayout() &&
- last_visible_index_ > 0)
+ last_visible_index_ > 0 && last_visible_index_ < last_button_index)
--last_visible_index_;
for (int i = 0; i < view_model_->view_size(); ++i) {
bool visible = i <= last_visible_index_ || i > last_hidden_index_;
@@ -821,7 +821,8 @@ void LauncherView::CalculateIdealBounds(IdealBounds* bounds) {
if (last_visible_index_ == -1) {
x = shelf->SelectValueForShelfAlignment(inset, 0, 0, inset);
y = shelf->SelectValueForShelfAlignment(0, inset, inset, 0);
- } else if (last_visible_index_ == last_button_index) {
+ } else if (last_visible_index_ == last_button_index
+ && !ash::switches::UseAlternateShelfLayout()) {
x = view_model_->ideal_bounds(last_visible_index_).x();
y = view_model_->ideal_bounds(last_visible_index_).y();
} else {
diff --git a/ash/launcher/launcher_view_unittest.cc b/ash/launcher/launcher_view_unittest.cc
index cb4dc9a..a92f969 100644
--- a/ash/launcher/launcher_view_unittest.cc
+++ b/ash/launcher/launcher_view_unittest.cc
@@ -195,7 +195,7 @@ TEST_F(LauncherViewIconObserverTest, BoundsChanged) {
class LauncherViewTest : public AshTestBase {
public:
- LauncherViewTest() : model_(NULL), launcher_view_(NULL) {}
+ LauncherViewTest() : model_(NULL), launcher_view_(NULL), browser_index_(1) {}
virtual ~LauncherViewTest() {}
virtual void SetUp() OVERRIDE {
@@ -213,7 +213,7 @@ class LauncherViewTest : public AshTestBase {
// Add browser shortcut launcher item at index 0 for test.
AddBrowserShortcut();
- }
+ }
virtual void TearDown() OVERRIDE {
test_api_.reset();
@@ -226,7 +226,7 @@ class LauncherViewTest : public AshTestBase {
browser_shortcut.type = TYPE_BROWSER_SHORTCUT;
LauncherID id = model_->next_id();
- model_->AddAt(0, browser_shortcut);
+ model_->AddAt(browser_index_, browser_shortcut);
test_api_->RunMessageLoopUntilAnimationsDone();
return id;
}
@@ -366,9 +366,9 @@ class LauncherViewTest : public AshTestBase {
// Add 5 app launcher buttons for testing.
for (int i = 0; i < 5; ++i) {
LauncherID id = AddAppShortcut();
- // browser shortcut is located at index 0. So we should start to add app
- // shortcut at index 1.
- id_map->insert(id_map->begin() + (i + 1),
+ // App Icon is located at index 0, and browser shortcut is located at
+ // index 1. So we should start to add app shortcut at index 2.
+ id_map->insert(id_map->begin() + (i + browser_index_ + 1),
std::make_pair(id, GetButtonByID(id)));
}
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(*id_map));
@@ -384,6 +384,7 @@ class LauncherViewTest : public AshTestBase {
LauncherModel* model_;
internal::LauncherView* launcher_view_;
+ int browser_index_;
scoped_ptr<LauncherViewTestAPI> test_api_;
@@ -391,6 +392,24 @@ class LauncherViewTest : public AshTestBase {
DISALLOW_COPY_AND_ASSIGN(LauncherViewTest);
};
+class LauncherViewLegacyShelfLayoutTest : public LauncherViewTest {
+ public:
+ LauncherViewLegacyShelfLayoutTest() : LauncherViewTest() {
+ browser_index_ = 0;
+ }
+
+ virtual ~LauncherViewLegacyShelfLayoutTest() {}
+
+ virtual void SetUp() OVERRIDE {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ ash::switches::kAshDisableAlternateShelfLayout);
+ LauncherViewTest::SetUp();
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(LauncherViewLegacyShelfLayoutTest);
+};
+
class LauncherViewTextDirectionTest
: public LauncherViewTest,
public testing::WithParamInterface<bool> {
@@ -515,6 +534,30 @@ TEST_F(LauncherViewTest, AddAppShortcutWithBrowserButtonUntilOverflow) {
ASSERT_LT(items_added, 10000);
}
+ // And the platform app button is invisible.
+ EXPECT_FALSE(GetButtonByID(browser_button_id)->visible());
+}
+
+TEST_F(LauncherViewLegacyShelfLayoutTest,
+ AddAppShortcutWithBrowserButtonUntilOverflow) {
+ // All buttons should be visible.
+ ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1,
+ test_api_->GetButtonCount());
+
+ LauncherID browser_button_id = AddPlatformApp();
+
+ // Add app shortcut until overflow.
+ int items_added = 0;
+ LauncherID last_added = AddAppShortcut();
+ while (!test_api_->IsOverflowButtonVisible()) {
+ // Added button is visible after animation while in this loop.
+ EXPECT_TRUE(GetButtonByID(last_added)->visible());
+
+ last_added = AddAppShortcut();
+ ++items_added;
+ ASSERT_LT(items_added, 10000);
+ }
+
// The last added app short button should be visible.
EXPECT_TRUE(GetButtonByID(last_added)->visible());
// And the platform app button is invisible.
@@ -530,6 +573,33 @@ TEST_F(LauncherViewTest, AddPanelHidesPlatformAppButton) {
int items_added = 0;
LauncherID first_added = AddPlatformApp();
EXPECT_TRUE(GetButtonByID(first_added)->visible());
+ while (true) {
+ LauncherID added = AddPlatformApp();
+ if (test_api_->IsOverflowButtonVisible()) {
+ EXPECT_FALSE(GetButtonByID(added)->visible());
+ RemoveByID(added);
+ break;
+ }
+ ++items_added;
+ ASSERT_LT(items_added, 10000);
+ }
+
+ LauncherID panel = AddPanel();
+ EXPECT_TRUE(test_api_->IsOverflowButtonVisible());
+
+ RemoveByID(panel);
+ EXPECT_FALSE(test_api_->IsOverflowButtonVisible());
+}
+
+TEST_F(LauncherViewLegacyShelfLayoutTest, AddPanelHidesPlatformAppButton) {
+ ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1,
+ test_api_->GetButtonCount());
+
+ // Add platform app button until overflow, remember last visible platform app
+ // button.
+ int items_added = 0;
+ LauncherID first_added = AddPlatformApp();
+ EXPECT_TRUE(GetButtonByID(first_added)->visible());
LauncherID last_visible = first_added;
while (true) {
LauncherID added = AddPlatformApp();
@@ -681,6 +751,73 @@ TEST_F(LauncherViewTest, ModelChangesWhileDragging) {
std::vector<std::pair<LauncherID, views::View*> > id_map;
SetupForDragTest(&id_map);
+ // Dragging browser shortcut at index 1.
+ EXPECT_TRUE(model_->items()[1].type == TYPE_BROWSER_SHORTCUT);
+ views::View* dragged_button = SimulateDrag(
+ internal::LauncherButtonHost::MOUSE, 1, 3);
+ std::rotate(id_map.begin() + 1,
+ id_map.begin() + 2,
+ id_map.begin() + 4);
+ ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
+ button_host->PointerReleasedOnButton(dragged_button,
+ internal::LauncherButtonHost::MOUSE,
+ false);
+ EXPECT_TRUE(model_->items()[3].type == TYPE_BROWSER_SHORTCUT);
+
+ // Dragging changes model order.
+ dragged_button = SimulateDrag(
+ internal::LauncherButtonHost::MOUSE, 1, 3);
+ std::rotate(id_map.begin() + 1,
+ id_map.begin() + 2,
+ id_map.begin() + 4);
+ ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
+
+ // Cancelling the drag operation restores previous order.
+ button_host->PointerReleasedOnButton(dragged_button,
+ internal::LauncherButtonHost::MOUSE,
+ true);
+ std::rotate(id_map.begin() + 1,
+ id_map.begin() + 3,
+ id_map.begin() + 4);
+ ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
+
+ // Deleting an item keeps the remaining intact.
+ dragged_button = SimulateDrag(internal::LauncherButtonHost::MOUSE, 1, 3);
+ model_->RemoveItemAt(1);
+ id_map.erase(id_map.begin() + 1);
+ ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
+ button_host->PointerReleasedOnButton(dragged_button,
+ internal::LauncherButtonHost::MOUSE,
+ false);
+
+ // Adding a launcher item cancels the drag and respects the order.
+ dragged_button = SimulateDrag(internal::LauncherButtonHost::MOUSE, 1, 3);
+ LauncherID new_id = AddAppShortcut();
+ id_map.insert(id_map.begin() + 6,
+ std::make_pair(new_id, GetButtonByID(new_id)));
+ ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
+ button_host->PointerReleasedOnButton(dragged_button,
+ internal::LauncherButtonHost::MOUSE,
+ false);
+
+ // Adding a launcher item at the end (i.e. a panel) canels drag and respects
+ // the order.
+ dragged_button = SimulateDrag(internal::LauncherButtonHost::MOUSE, 1, 3);
+ new_id = AddPanel();
+ id_map.insert(id_map.begin() + 7,
+ std::make_pair(new_id, GetButtonByID(new_id)));
+ ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
+ button_host->PointerReleasedOnButton(dragged_button,
+ internal::LauncherButtonHost::MOUSE,
+ false);
+}
+
+TEST_F(LauncherViewLegacyShelfLayoutTest, ModelChangesWhileDragging) {
+ internal::LauncherButtonHost* button_host = launcher_view_;
+
+ std::vector<std::pair<LauncherID, views::View*> > id_map;
+ SetupForDragTest(&id_map);
+
// Dragging browser shortcut at index 0.
EXPECT_TRUE(model_->items()[0].type == TYPE_BROWSER_SHORTCUT);
views::View* dragged_button = SimulateDrag(
@@ -751,14 +888,14 @@ TEST_F(LauncherViewTest, SimultaneousDrag) {
// Start a mouse drag.
views::View* dragged_button_mouse = SimulateDrag(
- internal::LauncherButtonHost::MOUSE, 0, 2);
- std::rotate(id_map.begin(),
- id_map.begin() + 1,
- id_map.begin() + 3);
+ internal::LauncherButtonHost::MOUSE, 1, 3);
+ std::rotate(id_map.begin() + 1,
+ id_map.begin() + 2,
+ id_map.begin() + 4);
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
// Attempt a touch drag before the mouse drag finishes.
views::View* dragged_button_touch = SimulateDrag(
- internal::LauncherButtonHost::TOUCH, 3, 1);
+ internal::LauncherButtonHost::TOUCH, 4, 2);
// Nothing changes since 2nd drag is ignored.
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
@@ -771,15 +908,15 @@ TEST_F(LauncherViewTest, SimultaneousDrag) {
// Now start a touch drag.
dragged_button_touch = SimulateDrag(
- internal::LauncherButtonHost::TOUCH, 3, 1);
- std::rotate(id_map.begin() + 2,
- id_map.begin() + 3,
- id_map.begin() + 4);
+ internal::LauncherButtonHost::TOUCH, 4, 2);
+ std::rotate(id_map.begin() + 3,
+ id_map.begin() + 4,
+ id_map.begin() + 5);
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
// And attempt a mouse drag before the touch drag finishes.
dragged_button_mouse = SimulateDrag(
- internal::LauncherButtonHost::MOUSE, 0, 1);
+ internal::LauncherButtonHost::MOUSE, 1, 2);
// Nothing changes since 2nd drag is ignored.
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
@@ -802,17 +939,17 @@ TEST_F(LauncherViewTest, ClickOneDragAnother) {
SimulateClick(internal::LauncherButtonHost::MOUSE, 1);
// Dragging browser index at 0 should change the model order correctly.
- EXPECT_TRUE(model_->items()[0].type == TYPE_BROWSER_SHORTCUT);
+ EXPECT_TRUE(model_->items()[1].type == TYPE_BROWSER_SHORTCUT);
views::View* dragged_button = SimulateDrag(
- internal::LauncherButtonHost::MOUSE, 0, 2);
- std::rotate(id_map.begin(),
- id_map.begin() + 1,
- id_map.begin() + 3);
+ internal::LauncherButtonHost::MOUSE, 1, 3);
+ std::rotate(id_map.begin() + 1,
+ id_map.begin() + 2,
+ id_map.begin() + 4);
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
button_host->PointerReleasedOnButton(dragged_button,
internal::LauncherButtonHost::MOUSE,
false);
- EXPECT_TRUE(model_->items()[2].type == TYPE_BROWSER_SHORTCUT);
+ EXPECT_TRUE(model_->items()[3].type == TYPE_BROWSER_SHORTCUT);
}
// Confirm that item status changes are reflected in the buttons.
@@ -834,7 +971,8 @@ TEST_F(LauncherViewTest, LauncherItemStatus) {
ASSERT_EQ(internal::LauncherButton::STATE_ATTENTION, button->state());
}
-TEST_F(LauncherViewTest, LauncherItemPositionReflectedOnStateChanged) {
+TEST_F(LauncherViewLegacyShelfLayoutTest,
+ LauncherItemPositionReflectedOnStateChanged) {
ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1,
test_api_->GetButtonCount());
@@ -864,19 +1002,6 @@ TEST_F(LauncherViewTest, LauncherItemPositionReflectedOnStateChanged) {
ASSERT_NE(item1_button->GetIconBounds().y(),
item2_button->GetIconBounds().y());
item1_button->ClearState(internal::LauncherButton::STATE_HOVERED);
-
- // Enable the alternate shelf layout.
- CommandLine::ForCurrentProcess()->AppendSwitch(
- ash::switches::kAshUseAlternateShelfLayout);
- launcher_view_->Layout();
-
- // Since default alignment in tests is bottom, state is reflected in y-axis.
- // In alternate shelf layout there is no visible hovered state.
- ASSERT_EQ(item1_button->GetIconBounds().y(),
- item2_button->GetIconBounds().y());
- item1_button->AddState(internal::LauncherButton::STATE_HOVERED);
- ASSERT_EQ(item1_button->GetIconBounds().y(),
- item2_button->GetIconBounds().y());
}
// Confirm that item status changes are reflected in the buttons
@@ -1052,13 +1177,13 @@ TEST_F(LauncherViewTest, ShouldHideTooltipWhenHoveringOnTooltip) {
// Move the mouse cursor slightly to the right of the item. The tooltip should
// stay open.
- generator.MoveMouseBy(-(bounds.width() / 2 + 5), 0);
+ generator.MoveMouseBy(bounds.width() / 2 + 5, 0);
// Make sure there is no delayed close.
RunAllPendingInMessageLoop();
EXPECT_TRUE(tooltip_manager->IsVisible());
// Move back - it should still stay open.
- generator.MoveMouseBy(bounds.width() / 2 + 5, 0);
+ generator.MoveMouseBy(-(bounds.width() / 2 + 5), 0);
// Make sure there is no delayed close.
RunAllPendingInMessageLoop();
EXPECT_TRUE(tooltip_manager->IsVisible());
@@ -1110,7 +1235,7 @@ TEST_F(LauncherViewTest, ResizeDuringOverflowAddAnimation) {
// Check that the first item in the list follows Fitt's law by including the
// first pixel and being therefore bigger then the others.
-TEST_F(LauncherViewTest, CheckFittsLaw) {
+TEST_F(LauncherViewLegacyShelfLayoutTest, CheckFittsLaw) {
// All buttons should be visible.
ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1,
test_api_->GetButtonCount());
diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc
index b4c16e3..86feabe9 100644
--- a/ash/root_window_controller_unittest.cc
+++ b/ash/root_window_controller_unittest.cc
@@ -171,8 +171,8 @@ TEST_F(RootWindowControllerTest, MoveWindows_Basic) {
views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100));
maximized->Maximize();
EXPECT_EQ(root_windows[1], maximized->GetNativeView()->GetRootWindow());
- EXPECT_EQ("600,0 500x452", maximized->GetWindowBoundsInScreen().ToString());
- EXPECT_EQ("0,0 500x452",
+ EXPECT_EQ("600,0 500x453", maximized->GetWindowBoundsInScreen().ToString());
+ EXPECT_EQ("0,0 500x453",
maximized->GetNativeView()->GetBoundsInRootWindow().ToString());
views::Widget* minimized = CreateTestWidget(gfx::Rect(800, 10, 100, 100));
diff --git a/ash/screen_ash_unittest.cc b/ash/screen_ash_unittest.cc
index 2243742..89b0ea8 100644
--- a/ash/screen_ash_unittest.cc
+++ b/ash/screen_ash_unittest.cc
@@ -40,7 +40,7 @@ TEST_F(ScreenAshTest, Bounds) {
EXPECT_EQ("0,0 600x597",
ScreenAsh::GetMaximizedWindowBoundsInParent(
primary->GetNativeView()).ToString());
- EXPECT_EQ("0,0 500x452",
+ EXPECT_EQ("0,0 500x453",
ScreenAsh::GetMaximizedWindowBoundsInParent(
secondary->GetNativeView()).ToString());
@@ -56,7 +56,7 @@ TEST_F(ScreenAshTest, Bounds) {
EXPECT_EQ("0,0 600x597",
ScreenAsh::GetDisplayWorkAreaBoundsInParent(
primary->GetNativeView()).ToString());
- EXPECT_EQ("0,0 500x452",
+ EXPECT_EQ("0,0 500x453",
ScreenAsh::GetDisplayWorkAreaBoundsInParent(
secondary->GetNativeView()).ToString());
}
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index a507da6..9d3b52e 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -892,10 +892,10 @@ void ShelfLayoutManager::UpdateTargetBoundsForGesture(
if (ash::switches::UseAlternateShelfLayout()) {
if (alignment_ == SHELF_ALIGNMENT_RIGHT) {
- target_bounds->shelf_bounds_in_root.set_x(
- available_bounds.right() - shelf_width + kStatusAreaInset);
+ target_bounds->status_bounds_in_shelf.set_x(kStatusAreaInset);
} else {
- target_bounds->shelf_bounds_in_root.set_x(kStatusAreaInset);
+ target_bounds->status_bounds_in_shelf.set_x(
+ available_bounds.right() - shelf_width + kStatusAreaInset);
}
} else {
// The statusbar should be in the center of the shelf.
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc
index e44fe34..6121845 100644
--- a/ash/shelf/shelf_layout_manager_unittest.cc
+++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -709,14 +709,11 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) {
// Make sure the bounds of the two widgets changed.
launcher_bounds = shelf->GetNativeView()->bounds();
- int bottom =
- screen->GetPrimaryDisplay().bounds().bottom() - shelf_height;
- EXPECT_EQ(launcher_bounds.y(),
- bottom + (manager->GetIdealBounds().height() -
- launcher_bounds.height()) / 2);
+ EXPECT_LT(launcher_bounds.y(),
+ screen->GetPrimaryDisplay().bounds().bottom());
status_bounds = shelf->status_area_widget()->GetNativeView()->bounds();
- EXPECT_EQ(status_bounds.y(),
- bottom + shelf_height - status_bounds.height());
+ EXPECT_LT(status_bounds.y(),
+ screen->GetPrimaryDisplay().bounds().bottom());
}
// Makes sure LayoutShelf invoked while animating cleans things up.
diff --git a/ash/shelf/shelf_widget_unittest.cc b/ash/shelf/shelf_widget_unittest.cc
index f043f34..6168787 100644
--- a/ash/shelf/shelf_widget_unittest.cc
+++ b/ash/shelf/shelf_widget_unittest.cc
@@ -72,19 +72,19 @@ TEST_F(ShelfWidgetTest, TestAlignment) {
SCOPED_TRACE("Single Bottom");
TestLauncherAlignment(Shell::GetPrimaryRootWindow(),
SHELF_ALIGNMENT_BOTTOM,
- "0,0 400x352");
+ "0,0 400x353");
}
{
SCOPED_TRACE("Single Right");
TestLauncherAlignment(Shell::GetPrimaryRootWindow(),
SHELF_ALIGNMENT_RIGHT,
- "0,0 352x400");
+ "0,0 353x400");
}
{
SCOPED_TRACE("Single Left");
TestLauncherAlignment(Shell::GetPrimaryRootWindow(),
SHELF_ALIGNMENT_LEFT,
- "48,0 352x400");
+ "47,0 353x400");
}
if (!SupportsMultipleDisplays())
return;
@@ -95,37 +95,37 @@ TEST_F(ShelfWidgetTest, TestAlignment) {
SCOPED_TRACE("Primary Bottom");
TestLauncherAlignment(root_windows[0],
SHELF_ALIGNMENT_BOTTOM,
- "0,0 300x252");
+ "0,0 300x253");
}
{
SCOPED_TRACE("Primary Right");
TestLauncherAlignment(root_windows[0],
SHELF_ALIGNMENT_RIGHT,
- "0,0 252x300");
+ "0,0 253x300");
}
{
SCOPED_TRACE("Primary Left");
TestLauncherAlignment(root_windows[0],
SHELF_ALIGNMENT_LEFT,
- "48,0 252x300");
+ "47,0 253x300");
}
{
SCOPED_TRACE("Secondary Bottom");
TestLauncherAlignment(root_windows[1],
SHELF_ALIGNMENT_BOTTOM,
- "300,0 500x452");
+ "300,0 500x453");
}
{
SCOPED_TRACE("Secondary Right");
TestLauncherAlignment(root_windows[1],
SHELF_ALIGNMENT_RIGHT,
- "300,0 452x500");
+ "300,0 453x500");
}
{
SCOPED_TRACE("Secondary Left");
TestLauncherAlignment(root_windows[1],
SHELF_ALIGNMENT_LEFT,
- "348,0 452x500");
+ "347,0 453x500");
}
}
diff --git a/ash/wm/custom_frame_view_ash_unittest.cc b/ash/wm/custom_frame_view_ash_unittest.cc
index 8036cc6..565dd8d 100644
--- a/ash/wm/custom_frame_view_ash_unittest.cc
+++ b/ash/wm/custom_frame_view_ash_unittest.cc
@@ -252,7 +252,7 @@ TEST_F(CustomFrameViewAshTest, MAYBE_ResizeButtonDrag) {
EXPECT_FALSE(ash::wm::IsWindowMinimized(window));
// This is a short resizing distance and different touch behavior
// applies which leads in half of the screen being used.
- EXPECT_EQ("400,0 400x552", window->bounds().ToString());
+ EXPECT_EQ("400,0 400x553", window->bounds().ToString());
}
// Snap left.
diff --git a/ash/wm/workspace/workspace_layout_manager_unittest.cc b/ash/wm/workspace/workspace_layout_manager_unittest.cc
index 13cfdea..5ec242f 100644
--- a/ash/wm/workspace/workspace_layout_manager_unittest.cc
+++ b/ash/wm/workspace/workspace_layout_manager_unittest.cc
@@ -138,7 +138,7 @@ TEST_F(WorkspaceLayoutManagerTest, MaximizeInDisplayToBeRestored) {
// is inside 2nd display.
wm::MaximizeWindow(window.get());
EXPECT_EQ(root_windows[1], window->GetRootWindow());
- EXPECT_EQ("300,0 400x452", window->GetBoundsInScreen().ToString());
+ EXPECT_EQ("300,0 400x453", window->GetBoundsInScreen().ToString());
wm::RestoreWindow(window.get());
EXPECT_EQ(root_windows[1], window->GetRootWindow());
@@ -149,7 +149,7 @@ TEST_F(WorkspaceLayoutManagerTest, MaximizeInDisplayToBeRestored) {
SetRestoreBoundsInScreen(window.get(), gfx::Rect(280, 0, 30, 40));
wm::MaximizeWindow(window.get());
EXPECT_EQ(root_windows[1], window->GetRootWindow());
- EXPECT_EQ("300,0 400x452", window->GetBoundsInScreen().ToString());
+ EXPECT_EQ("300,0 400x453", window->GetBoundsInScreen().ToString());
wm::RestoreWindow(window.get());
EXPECT_EQ(root_windows[1], window->GetRootWindow());
@@ -165,7 +165,7 @@ TEST_F(WorkspaceLayoutManagerTest, MaximizeInDisplayToBeRestored) {
w1->Show();
EXPECT_TRUE(w1->IsMaximized());
EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow());
- EXPECT_EQ("300,0 400x452", w1->GetWindowBoundsInScreen().ToString());
+ EXPECT_EQ("300,0 400x453", w1->GetWindowBoundsInScreen().ToString());
w1->Restore();
EXPECT_EQ(root_windows[1], w1->GetNativeView()->GetRootWindow());
EXPECT_EQ("400,0 30x40", w1->GetWindowBoundsInScreen().ToString());
diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc
index 8459c54..7b7f255 100644
--- a/ash/wm/workspace/workspace_window_resizer_unittest.cc
+++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc
@@ -1171,11 +1171,11 @@ TEST_F(WorkspaceWindowResizerTest, TestProperSizerResolutions) {
shelf_layout_manager()->SetAutoHideBehavior(
SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
rect = resizer->GetTargetBoundsForSize(0);
- EXPECT_EQ("0,0 720x552", rect.ToString());
+ EXPECT_EQ("0,0 720x553", rect.ToString());
rect = resizer->GetTargetBoundsForSize(1);
- EXPECT_EQ("0,0 640x552", rect.ToString());
+ EXPECT_EQ("0,0 640x553", rect.ToString());
rect = resizer->GetTargetBoundsForSize(2);
- EXPECT_EQ("0,0 400x552", rect.ToString());
+ EXPECT_EQ("0,0 400x553", rect.ToString());
}
// Verifies that a dragged window will restore to its pre-maximized size.
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 203eec2..344c918 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -923,7 +923,8 @@ const Experiment kExperiments[] = {
IDS_FLAGS_ALTERNATE_SHELF_LAYOUT_NAME,
IDS_FLAGS_ALTERNATE_SHELF_LAYOUT_DESCRIPTION,
kOsCrOS,
- SINGLE_VALUE_TYPE(ash::switches::kAshUseAlternateShelfLayout)
+ ENABLE_DISABLE_VALUE_TYPE(ash::switches::kAshUseAlternateShelfLayout,
+ ash::switches::kAshDisableAlternateShelfLayout)
},
{
"ash-disable-drag-off-shelf",
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
index 01e6b8b..0f131fb 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
@@ -131,8 +131,8 @@ class LauncherPlatformAppBrowserTest
const ash::LauncherItem& GetLastLauncherItem() {
// Unless there are any panels, the item at index [count - 1] will be
- // the app list, and the item at [count - 2] will be the desired item.
- return launcher_model()->items()[launcher_model()->item_count() - 2];
+ // the desired item.
+ return launcher_model()->items()[launcher_model()->item_count() - 1];
}
const ash::LauncherItem& GetLastLauncherPanelItem() {
@@ -816,10 +816,9 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, SetIcon) {
// This test creates one shell window and one panel window.
int launcher_item_count = launcher_model()->item_count();
ASSERT_EQ(base_launcher_item_count + 2, launcher_item_count);
- // The Panel will be the last item, the app list second-to-last, the app
- // third from last.
+ // The Panel will be the last item, the app second-to-last.
const ash::LauncherItem& app_item =
- launcher_model()->items()[launcher_item_count - 3];
+ launcher_model()->items()[launcher_item_count - 2];
const ash::LauncherItem& panel_item =
launcher_model()->items()[launcher_item_count - 1];
const LauncherItemController* app_item_controller =
@@ -1377,11 +1376,11 @@ IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTestNoDefaultBrowser,
AltNumberBrowserTabbing) {
// Get the number of items in the browser menu.
EXPECT_EQ(0u, chrome::GetTotalBrowserCount());
- // The first activation should create a browser.
- launcher_->ActivateLauncherItem(0);
+ // The first activation should create a browser at index 1 (App List @ 0).
+ launcher_->ActivateLauncherItem(1);
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
// A second activation should not create a new instance.
- launcher_->ActivateLauncherItem(0);
+ launcher_->ActivateLauncherItem(1);
Browser* browser1 = chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow());
EXPECT_TRUE(browser1);
aura::Window* window1 = browser1->window()->GetNativeWindow();
@@ -1393,9 +1392,9 @@ IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTestNoDefaultBrowser,
EXPECT_EQ(window2, ash::wm::GetActiveWindow());
// Activate multiple times the switcher to see that the windows get activated.
- launcher_->ActivateLauncherItem(0);
+ launcher_->ActivateLauncherItem(1);
EXPECT_EQ(window1, ash::wm::GetActiveWindow());
- launcher_->ActivateLauncherItem(0);
+ launcher_->ActivateLauncherItem(1);
EXPECT_EQ(window2, ash::wm::GetActiveWindow());
// Create a third browser - make sure that we do not toggle simply between
@@ -1408,13 +1407,13 @@ IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTestNoDefaultBrowser,
EXPECT_NE(window2, window3);
EXPECT_EQ(window3, ash::wm::GetActiveWindow());
- launcher_->ActivateLauncherItem(0);
+ launcher_->ActivateLauncherItem(1);
EXPECT_EQ(window1, ash::wm::GetActiveWindow());
- launcher_->ActivateLauncherItem(0);
+ launcher_->ActivateLauncherItem(1);
EXPECT_EQ(window2, ash::wm::GetActiveWindow());
- launcher_->ActivateLauncherItem(0);
+ launcher_->ActivateLauncherItem(1);
EXPECT_EQ(window3, ash::wm::GetActiveWindow());
- launcher_->ActivateLauncherItem(0);
+ launcher_->ActivateLauncherItem(1);
EXPECT_EQ(window1, ash::wm::GetActiveWindow());
// Create anther app and make sure that none of our browsers is active.
@@ -1423,7 +1422,7 @@ IN_PROC_BROWSER_TEST_F(LauncherAppBrowserTestNoDefaultBrowser,
EXPECT_NE(window2, ash::wm::GetActiveWindow());
// After activation our browser should be active again.
- launcher_->ActivateLauncherItem(0);
+ launcher_->ActivateLauncherItem(1);
EXPECT_EQ(window1, ash::wm::GetActiveWindow());
}
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc
index b48158e..8cf8076 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc
@@ -336,6 +336,12 @@ class ChromeLauncherControllerTest : public BrowserWithTestWindowTest {
return result;
}
+ // Set the index at which the chrome icon should be.
+ void SetShelfChromeIconIndex(int index) {
+ profile()->GetTestingPrefService()->SetInteger(prefs::kShelfChromeIconIndex,
+ index + 1);
+ }
+
// Needed for extension service & friends to work.
scoped_refptr<Extension> extension1_;
scoped_refptr<Extension> extension2_;
@@ -350,36 +356,30 @@ class ChromeLauncherControllerTest : public BrowserWithTestWindowTest {
DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerTest);
};
-// The testing framework to test the alternate shelf layout.
-class AlternateLayoutChromeLauncherControllerTest
+// The testing framework to test the legacy shelf layout.
+class LegacyShelfLayoutChromeLauncherControllerTest
: public ChromeLauncherControllerTest {
protected:
- AlternateLayoutChromeLauncherControllerTest() {
+ LegacyShelfLayoutChromeLauncherControllerTest() {
}
- virtual ~AlternateLayoutChromeLauncherControllerTest() {
+ virtual ~LegacyShelfLayoutChromeLauncherControllerTest() {
}
- // Overwrite the Setup function to add the Alternate Shelf layout option.
+ // Overwrite the Setup function to use the legacy shelf layout option.
virtual void SetUp() OVERRIDE {
CommandLine::ForCurrentProcess()->AppendSwitch(
- ash::switches::kAshUseAlternateShelfLayout);
+ ash::switches::kAshDisableAlternateShelfLayout);
ChromeLauncherControllerTest::SetUp();
}
- // Set the index at which the chrome icon should be.
- void SetShelfChromeIconIndex(int index) {
- profile()->GetTestingPrefService()->SetInteger(prefs::kShelfChromeIconIndex,
- index + 1);
- }
-
private:
- DISALLOW_COPY_AND_ASSIGN(AlternateLayoutChromeLauncherControllerTest);
+ DISALLOW_COPY_AND_ASSIGN(LegacyShelfLayoutChromeLauncherControllerTest);
};
-TEST_F(ChromeLauncherControllerTest, DefaultApps) {
+TEST_F(LegacyShelfLayoutChromeLauncherControllerTest, DefaultApps) {
InitLauncherController();
// Model should only contain the browser shortcut and app list items.
EXPECT_EQ(2, model_->item_count());
@@ -398,7 +398,8 @@ TEST_F(ChromeLauncherControllerTest, DefaultApps) {
// Check that the restauration of launcher items is happening in the same order
// as the user has pinned them (on another system) when they are synced reverse
// order.
-TEST_F(ChromeLauncherControllerTest, RestoreDefaultAppsReverseOrder) {
+TEST_F(LegacyShelfLayoutChromeLauncherControllerTest,
+ RestoreDefaultAppsReverseOrder) {
InitLauncherController();
base::ListValue policy_value;
@@ -437,7 +438,8 @@ TEST_F(ChromeLauncherControllerTest, RestoreDefaultAppsReverseOrder) {
// Check that the restauration of launcher items is happening in the same order
// as the user has pinned them (on another system) when they are synced random
// order.
-TEST_F(ChromeLauncherControllerTest, RestoreDefaultAppsRandomOrder) {
+TEST_F(LegacyShelfLayoutChromeLauncherControllerTest,
+ RestoreDefaultAppsRandomOrder) {
InitLauncherController();
base::ListValue policy_value;
@@ -475,7 +477,8 @@ TEST_F(ChromeLauncherControllerTest, RestoreDefaultAppsRandomOrder) {
// Check that the restauration of launcher items is happening in the same order
// as the user has pinned / moved them (on another system) when they are synced
// random order - including the chrome icon.
-TEST_F(ChromeLauncherControllerTest, RestoreDefaultAppsRandomOrderChromeMoved) {
+TEST_F(LegacyShelfLayoutChromeLauncherControllerTest,
+ RestoreDefaultAppsRandomOrderChromeMoved) {
InitLauncherController();
base::ListValue policy_value;
@@ -513,7 +516,8 @@ TEST_F(ChromeLauncherControllerTest, RestoreDefaultAppsRandomOrderChromeMoved) {
}
// Check that syncing to a different state does the correct thing.
-TEST_F(ChromeLauncherControllerTest, RestoreDefaultAppsResyncOrder) {
+TEST_F(LegacyShelfLayoutChromeLauncherControllerTest,
+ RestoreDefaultAppsResyncOrder) {
InitLauncherController();
base::ListValue policy_value;
InsertPrefValue(&policy_value, 0, extension1_->id());
@@ -548,7 +552,7 @@ TEST_F(ChromeLauncherControllerTest, RestoreDefaultAppsResyncOrder) {
EXPECT_EQ("App2, Chrome, App3, App1, AppList, ", GetPinnedAppStatus());
}
-TEST_F(AlternateLayoutChromeLauncherControllerTest, DefaultApps) {
+TEST_F(ChromeLauncherControllerTest, DefaultApps) {
InitLauncherController();
// Model should only contain the browser shortcut and app list items.
EXPECT_EQ(2, model_->item_count());
@@ -567,8 +571,7 @@ TEST_F(AlternateLayoutChromeLauncherControllerTest, DefaultApps) {
// Check that the restauration of launcher items is happening in the same order
// as the user has pinned them (on another system) when they are synced reverse
// order.
-TEST_F(AlternateLayoutChromeLauncherControllerTest,
- RestoreDefaultAppsReverseOrder) {
+TEST_F(ChromeLauncherControllerTest, RestoreDefaultAppsReverseOrder) {
InitLauncherController();
base::ListValue policy_value;
@@ -607,8 +610,7 @@ TEST_F(AlternateLayoutChromeLauncherControllerTest,
// Check that the restauration of launcher items is happening in the same order
// as the user has pinned them (on another system) when they are synced random
// order.
-TEST_F(AlternateLayoutChromeLauncherControllerTest,
- RestoreDefaultAppsRandomOrder) {
+TEST_F(ChromeLauncherControllerTest, RestoreDefaultAppsRandomOrder) {
InitLauncherController();
base::ListValue policy_value;
@@ -645,9 +647,8 @@ TEST_F(AlternateLayoutChromeLauncherControllerTest,
// Check that the restauration of launcher items is happening in the same order
// as the user has pinned / moved them (on another system) when they are synced
-// random order - including the chrome icon - using the alternate shelf layout.
-TEST_F(AlternateLayoutChromeLauncherControllerTest,
- RestoreDefaultAppsRandomOrderChromeMoved) {
+// random order - including the chrome icon.
+TEST_F(ChromeLauncherControllerTest, RestoreDefaultAppsRandomOrderChromeMoved) {
InitLauncherController();
base::ListValue policy_value;
@@ -683,10 +684,8 @@ TEST_F(AlternateLayoutChromeLauncherControllerTest,
EXPECT_EQ("AppList, App1, Chrome, App2, App3, ", GetPinnedAppStatus());
}
-// Check that syncing to a different state does the correct thing with the
-// alternate shelf layout.
-TEST_F(AlternateLayoutChromeLauncherControllerTest,
- RestoreDefaultAppsResyncOrder) {
+// Check that syncing to a different state does the correct thing.
+TEST_F(ChromeLauncherControllerTest, RestoreDefaultAppsResyncOrder) {
InitLauncherController();
base::ListValue policy_value;
InsertPrefValue(&policy_value, 0, extension1_->id());
@@ -694,7 +693,7 @@ TEST_F(AlternateLayoutChromeLauncherControllerTest,
InsertPrefValue(&policy_value, 2, extension3_->id());
profile()->GetTestingPrefService()->SetUserPref(prefs::kPinnedLauncherApps,
policy_value.DeepCopy());
- // The alternate shelf layout has always one static item at the beginning.
+ // The shelf layout has always one static item at the beginning (App List).
SetShelfChromeIconIndex(0);
extension_service_->AddExtension(extension2_.get());
EXPECT_EQ("AppList, Chrome, App2, ", GetPinnedAppStatus());
@@ -761,7 +760,7 @@ TEST_F(ChromeLauncherControllerTest, CheckLockApps) {
launcher_controller_->LockV1AppWithID(extension1_->id());
EXPECT_EQ(3, model_->item_count());
- EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[1].type);
+ EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[2].type);
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id()));
EXPECT_TRUE(launcher_controller_->IsWindowedAppInLauncher(extension1_->id()));
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id()));
@@ -792,7 +791,7 @@ TEST_F(ChromeLauncherControllerTest, CheckMukltiLockApps) {
launcher_controller_->LockV1AppWithID(extension1_->id());
EXPECT_EQ(3, model_->item_count());
- EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[1].type);
+ EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[2].type);
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id()));
EXPECT_TRUE(launcher_controller_->IsWindowedAppInLauncher(
extension1_->id()));
@@ -801,7 +800,7 @@ TEST_F(ChromeLauncherControllerTest, CheckMukltiLockApps) {
launcher_controller_->UnlockV1AppWithID(extension1_->id());
EXPECT_EQ(3, model_->item_count());
- EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[1].type);
+ EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[2].type);
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id()));
EXPECT_TRUE(launcher_controller_->IsWindowedAppInLauncher(extension1_->id()));
@@ -830,7 +829,7 @@ TEST_F(ChromeLauncherControllerTest, CheckAlreadyPinnedLockApps) {
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id()));
EXPECT_EQ(3, model_->item_count());
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type);
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type);
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id()));
EXPECT_FALSE(
launcher_controller_->IsWindowedAppInLauncher(extension1_->id()));
@@ -838,7 +837,7 @@ TEST_F(ChromeLauncherControllerTest, CheckAlreadyPinnedLockApps) {
launcher_controller_->LockV1AppWithID(extension1_->id());
EXPECT_EQ(3, model_->item_count());
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type);
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type);
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id()));
EXPECT_FALSE(
launcher_controller_->IsWindowedAppInLauncher(extension1_->id()));
@@ -846,7 +845,7 @@ TEST_F(ChromeLauncherControllerTest, CheckAlreadyPinnedLockApps) {
launcher_controller_->UnlockV1AppWithID(extension1_->id());
EXPECT_EQ(3, model_->item_count());
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type);
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type);
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id()));
EXPECT_FALSE(
launcher_controller_->IsWindowedAppInLauncher(extension1_->id()));
@@ -868,7 +867,7 @@ TEST_F(ChromeLauncherControllerTest, CheckPinnedAppsStayAfterUnlock) {
launcher_controller_->PinAppWithID(extension1_->id());
EXPECT_EQ(3, model_->item_count());
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type);
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type);
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id()));
EXPECT_FALSE(
launcher_controller_->IsWindowedAppInLauncher(extension1_->id()));
@@ -876,7 +875,7 @@ TEST_F(ChromeLauncherControllerTest, CheckPinnedAppsStayAfterUnlock) {
launcher_controller_->LockV1AppWithID(extension1_->id());
EXPECT_EQ(3, model_->item_count());
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type);
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type);
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id()));
EXPECT_FALSE(
launcher_controller_->IsWindowedAppInLauncher(extension1_->id()));
@@ -884,7 +883,7 @@ TEST_F(ChromeLauncherControllerTest, CheckPinnedAppsStayAfterUnlock) {
launcher_controller_->UnpinAppWithID(extension1_->id());
EXPECT_EQ(3, model_->item_count());
- EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[1].type);
+ EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[2].type);
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id()));
EXPECT_TRUE(launcher_controller_->IsWindowedAppInLauncher(extension1_->id()));
@@ -905,14 +904,14 @@ TEST_F(ChromeLauncherControllerTest, CheckLockPinUnlockUnpin) {
launcher_controller_->LockV1AppWithID(extension1_->id());
EXPECT_EQ(3, model_->item_count());
- EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[1].type);
+ EXPECT_EQ(ash::TYPE_WINDOWED_APP, model_->items()[2].type);
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id()));
EXPECT_TRUE(launcher_controller_->IsWindowedAppInLauncher(extension1_->id()));
launcher_controller_->PinAppWithID(extension1_->id());
EXPECT_EQ(3, model_->item_count());
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type);
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type);
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id()));
EXPECT_FALSE(
launcher_controller_->IsWindowedAppInLauncher(extension1_->id()));
@@ -920,7 +919,7 @@ TEST_F(ChromeLauncherControllerTest, CheckLockPinUnlockUnpin) {
launcher_controller_->UnlockV1AppWithID(extension1_->id());
EXPECT_EQ(3, model_->item_count());
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type);
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type);
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id()));
EXPECT_FALSE(
launcher_controller_->IsWindowedAppInLauncher(extension1_->id()));
@@ -945,7 +944,7 @@ TEST_F(ChromeLauncherControllerTest, Policy) {
// take effect when the policy override is in place.
InitLauncherController();
EXPECT_EQ(3, model_->item_count());
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type);
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type);
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id()));
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension2_->id()));
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id()));
@@ -953,8 +952,8 @@ TEST_F(ChromeLauncherControllerTest, Policy) {
// Installing |extension2_| should add it to the launcher.
extension_service_->AddExtension(extension2_.get());
EXPECT_EQ(4, model_->item_count());
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type);
EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type);
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[3].type);
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension1_->id()));
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id()));
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id()));
@@ -964,7 +963,7 @@ TEST_F(ChromeLauncherControllerTest, Policy) {
profile()->GetTestingPrefService()->SetManagedPref(prefs::kPinnedLauncherApps,
policy_value.DeepCopy());
EXPECT_EQ(3, model_->item_count());
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type);
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type);
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension1_->id()));
EXPECT_TRUE(launcher_controller_->IsAppPinned(extension2_->id()));
EXPECT_FALSE(launcher_controller_->IsAppPinned(extension3_->id()));
@@ -1437,8 +1436,8 @@ TEST_F(ChromeLauncherControllerTest, PersistLauncherItemPositions) {
TestAppTabHelperImpl* app_tab_helper = new TestAppTabHelperImpl;
SetAppTabHelper(app_tab_helper);
- EXPECT_EQ(ash::TYPE_BROWSER_SHORTCUT, model_->items()[0].type);
- EXPECT_EQ(ash::TYPE_APP_LIST, model_->items()[1].type);
+ EXPECT_EQ(ash::TYPE_APP_LIST, model_->items()[0].type);
+ EXPECT_EQ(ash::TYPE_BROWSER_SHORTCUT, model_->items()[1].type);
TabStripModel* tab_strip_model = browser()->tab_strip_model();
EXPECT_EQ(0, tab_strip_model->count());
@@ -1453,17 +1452,17 @@ TEST_F(ChromeLauncherControllerTest, PersistLauncherItemPositions) {
EXPECT_TRUE(launcher_controller_->IsAppPinned("1"));
launcher_controller_->PinAppWithID("2");
- EXPECT_EQ(ash::TYPE_BROWSER_SHORTCUT, model_->items()[0].type);
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type);
+ EXPECT_EQ(ash::TYPE_APP_LIST, model_->items()[0].type);
+ EXPECT_EQ(ash::TYPE_BROWSER_SHORTCUT, model_->items()[1].type);
EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type);
- EXPECT_EQ(ash::TYPE_APP_LIST, model_->items()[3].type);
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[3].type);
- // Move browser shortcut item from index 0 to index 2.
- model_->Move(0, 2);
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[0].type);
+ // Move browser shortcut item from index 1 to index 3.
+ model_->Move(1, 3);
+ EXPECT_EQ(ash::TYPE_APP_LIST, model_->items()[0].type);
EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type);
- EXPECT_EQ(ash::TYPE_BROWSER_SHORTCUT, model_->items()[2].type);
- EXPECT_EQ(ash::TYPE_APP_LIST, model_->items()[3].type);
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type);
+ EXPECT_EQ(ash::TYPE_BROWSER_SHORTCUT, model_->items()[3].type);
launcher_controller_.reset();
model_.reset(new ash::LauncherModel);
@@ -1477,10 +1476,10 @@ TEST_F(ChromeLauncherControllerTest, PersistLauncherItemPositions) {
launcher_controller_->Init();
// Check LauncherItems are restored after resetting ChromeLauncherController.
- EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[0].type);
+ EXPECT_EQ(ash::TYPE_APP_LIST, model_->items()[0].type);
EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[1].type);
- EXPECT_EQ(ash::TYPE_BROWSER_SHORTCUT, model_->items()[2].type);
- EXPECT_EQ(ash::TYPE_APP_LIST, model_->items()[3].type);
+ EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[2].type);
+ EXPECT_EQ(ash::TYPE_BROWSER_SHORTCUT, model_->items()[3].type);
}
// Verifies pinned apps are persisted and restored.
diff --git a/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc b/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc
index 2b54530..bdd8c3b 100644
--- a/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc
+++ b/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc
@@ -49,7 +49,7 @@ gfx::Rect GetChromeIconBoundsForRootWindow(aura::RootWindow* root_window) {
const views::ViewModel* view_model = launcher_view->view_model_for_test();
EXPECT_EQ(2, view_model->view_size());
- return view_model->view_at(0)->GetBoundsInScreen();
+ return view_model->view_at(1)->GetBoundsInScreen();
}
void OpenBrowserUsingShelfOnRootWindow(aura::RootWindow* root_window) {
@@ -67,15 +67,15 @@ void OpenBrowserUsingShelfOnRootWindow(aura::RootWindow* root_window) {
} // namespace
#if defined(OS_WIN)
-#define MAYBE_OpenBrowserUsingShelfOnOhterDisplay DISABLED_OpenBrowserUsingShelfOnOhterDisplay
-#define MAYBE_OpenBrowserUsingContextMenuOnOhterDisplay DISABLED_OpenBrowserUsingContextMenuOnOhterDisplay
+#define MAYBE_OpenBrowserUsingShelfOnOtherDisplay DISABLED_OpenBrowserUsingShelfOnOtherDisplay
+#define MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay DISABLED_OpenBrowserUsingContextMenuOnOtherDisplay
#else
-#define MAYBE_OpenBrowserUsingShelfOnOhterDisplay OpenBrowserUsingShelfOnOhterDisplay
-#define MAYBE_OpenBrowserUsingContextMenuOnOhterDisplay OpenBrowserUsingContextMenuOnOhterDisplay
+#define MAYBE_OpenBrowserUsingShelfOnOtherDisplay OpenBrowserUsingShelfOnOtherDisplay
+#define MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay OpenBrowserUsingContextMenuOnOtherDisplay
#endif
IN_PROC_BROWSER_TEST_F(WindowSizerTest,
- MAYBE_OpenBrowserUsingShelfOnOhterDisplay) {
+ MAYBE_OpenBrowserUsingShelfOnOtherDisplay) {
// Don't shutdown when closing the last browser window.
chrome::StartKeepAlive();
@@ -163,7 +163,7 @@ void OpenBrowserUsingContextMenuOnRootWindow(aura::RootWindow* root_window) {
} // namespace
IN_PROC_BROWSER_TEST_F(WindowSizerContextMenuTest,
- MAYBE_OpenBrowserUsingContextMenuOnOhterDisplay) {
+ MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay) {
// Don't shutdown when closing the last browser window.
chrome::StartKeepAlive();