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

Unified Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc

Issue 2975063003: [Merge M60] Fix shelf dragging context in case Context Menu is shown. (Closed)
Patch Set: Created 3 years, 5 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/shelf/shelf_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « ash/shelf/shelf_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698