| Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
|
| 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 2f4fc9a9823c578403dae293ccdd580bc970212d..f9758f89aa8b438e588bb156d7d2055fe05e1c32 100644
|
| --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
|
| +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
|
| @@ -2081,6 +2081,37 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, DISABLED_DragOffShelf) {
|
| EXPECT_FALSE(test.IsOverflowButtonVisible());
|
| }
|
|
|
| +// Validates that context menu is shown on right click and drag context is not
|
| +// set in this case and set on left click.
|
| +IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, ShelfButtonContextMenu) {
|
| + ui::test::EventGenerator generator(ash::Shell::GetPrimaryRootWindow(),
|
| + gfx::Point());
|
| + ash::test::ShelfViewTestAPI test(shelf_->GetShelfViewForTesting());
|
| + const int browser_index = GetIndexOfShelfItemType(ash::TYPE_BROWSER_SHORTCUT);
|
| + ASSERT_LE(0, browser_index);
|
| + ash::ShelfButton* button = test.GetButton(browser_index);
|
| + ASSERT_TRUE(button);
|
| +
|
| + // No context menu is shown at this time.
|
| + EXPECT_FALSE(test.shelf_view()->IsShowingMenu());
|
| + const gfx::Rect bounds = button->GetBoundsInScreen();
|
| + generator.MoveMouseTo(bounds.CenterPoint().x(), bounds.CenterPoint().y());
|
| + generator.PressRightButton();
|
| + // Context menu is shown on right button press and no drag context is set.
|
| + EXPECT_TRUE(test.shelf_view()->IsShowingMenu());
|
| + EXPECT_FALSE(test.shelf_view()->drag_view());
|
| + generator.ReleaseRightButton();
|
| + EXPECT_FALSE(test.shelf_view()->drag_view());
|
| +
|
| + // Press left button. Menu should close and drag context is set to |button|.
|
| + generator.PressLeftButton();
|
| + EXPECT_FALSE(test.shelf_view()->IsShowingMenu());
|
| + base::RunLoop().RunUntilIdle();
|
| + EXPECT_EQ(test.shelf_view()->drag_view(), button);
|
| + generator.ReleaseLeftButton();
|
| + EXPECT_FALSE(test.shelf_view()->drag_view());
|
| +}
|
| +
|
| // Check that clicking on an app shelf item launches a new browser.
|
| IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, ClickItem) {
|
| // Get a number of interfaces we need.
|
|
|