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

Unified Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc

Issue 12529012: Context menu on views must show on mouse down for non-WIN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/browser_action_view.cc » ('j') | ui/views/widget/widget.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
index d0a0a971bb5fbac8ea6a6536080efb0f21cfea8f..d145462007067f5c1502f58777116776b70fa78b 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc
@@ -69,6 +69,26 @@ class TestingPageNavigator : public PageNavigator {
GURL url_;
};
+// Delay before allowing menu selection. When context menu is shown on mouse
+// press, we enforce a delay before a selection can be made. So for tests that
+// perform selection on context menu, we add this delay before going to the next
+// step. See comment on |kContextMenuSelectionHoldTimeMs| in menu_controller.cc
+// for more info. The delay here should be greater than
+// |kContextMenuSelectionHoldTimeMs|.
+#define STEP_3_WITH_SELECTION_DELAY(test_class)\
+ void Step3() {\
+ views::MenuItemView* menu = bb_view_->GetContextMenu();\
+ ASSERT_TRUE(menu && menu->GetSubmenu() && menu->GetSubmenu()->IsShowing());\
+ if (views::View::ShouldShowContextMenuOnMousePress()) {\
+ MessageLoop::current()->PostDelayedTask(FROM_HERE,\
+ CreateEventTask(this, &test_class::Step3_1),\
+ base::TimeDelta::FromMilliseconds(250));\
sky 2013/04/05 17:23:37 This is fragile, and it adds more time to tests. C
varunjain 2013/04/05 18:01:44 Done.
+ } else {\
+ Step3_1();\
+ }\
+ }\
+ void Step3_1() {
+
} // namespace
// Base class for event generating bookmark view tests. These test are intended
@@ -482,7 +502,7 @@ class BookmarkBarViewTest4 : public BookmarkBarViewEventTestBase {
// Step3 will be invoked by ContextMenuNotificationObserver.
}
- void Step3() {
+ STEP_3_WITH_SELECTION_DELAY(BookmarkBarViewTest4)
// Make sure the context menu is showing.
views::MenuItemView* menu = bb_view_->GetContextMenu();
ASSERT_TRUE(menu != NULL);
@@ -1109,7 +1129,7 @@ class BookmarkBarViewTest12 : public BookmarkBarViewEventTestBase {
CreateEventTask(this, &BookmarkBarViewTest12::Step3));
}
- void Step3() {
+ STEP_3_WITH_SELECTION_DELAY(BookmarkBarViewTest12)
// Make sure the context menu is showing.
views::MenuItemView* menu = bb_view_->GetContextMenu();
ASSERT_TRUE(menu && menu->GetSubmenu() && menu->GetSubmenu()->IsShowing());
@@ -1195,7 +1215,7 @@ class BookmarkBarViewTest13 : public BookmarkBarViewEventTestBase {
// Step3 will be invoked by ContextMenuNotificationObserver.
}
- void Step3() {
+ STEP_3_WITH_SELECTION_DELAY(BookmarkBarViewTest13)
// Make sure the context menu is showing.
views::MenuItemView* menu = bb_view_->GetContextMenu();
ASSERT_TRUE(menu != NULL);
@@ -1322,7 +1342,7 @@ class BookmarkBarViewTest15 : public BookmarkBarViewEventTestBase {
// Step3 will be invoked by ContextMenuNotificationObserver.
}
- void Step3() {
+ STEP_3_WITH_SELECTION_DELAY(BookmarkBarViewTest15)
// Make sure the context menu is showing.
views::MenuItemView* menu = bb_view_->GetContextMenu();
ASSERT_TRUE(menu != NULL);
@@ -1749,7 +1769,7 @@ class BookmarkBarViewTest21 : public BookmarkBarViewEventTestBase {
}
// Confirm that context menu shows and click REMOVE menu.
- void Step3() {
+ STEP_3_WITH_SELECTION_DELAY(BookmarkBarViewTest21)
// Make sure the context menu is showing.
views::MenuItemView* menu = bb_view_->GetContextMenu();
ASSERT_TRUE(menu != NULL);
« no previous file with comments | « no previous file | chrome/browser/ui/views/browser_action_view.cc » ('j') | ui/views/widget/widget.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698