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

Unified Diff: ui/views/controls/menu/menu_controller_unittest.cc

Issue 2208113002: Fix MenuPreTargetHandler Crash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | ui/views/controls/menu/menu_pre_target_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/menu/menu_controller_unittest.cc
diff --git a/ui/views/controls/menu/menu_controller_unittest.cc b/ui/views/controls/menu/menu_controller_unittest.cc
index 61017f6297bca7a54ea0ce0b61880320d82b383b..ddc961e45a28e618620ba4ede5b9906eb1004851 100644
--- a/ui/views/controls/menu/menu_controller_unittest.cc
+++ b/ui/views/controls/menu/menu_controller_unittest.cc
@@ -1304,6 +1304,20 @@ TEST_F(MenuControllerTest, AsynchronousCancelEvent) {
EXPECT_EQ(run_result, nullptr);
TestCancelEvent();
}
+
+// Tests that if a menu is ran without a widget, that MenuPreTargetHandler does
+// not cause a crash.
+TEST_F(MenuControllerTest, RunWithoutWidgetDoesntCrash) {
+ ExitMenuRun();
+ MenuController* controller = menu_controller();
+ controller->SetAsyncRun(true);
+ int mouse_event_flags = 0;
+ MenuItemView* run_result =
+ controller->Run(nullptr, nullptr, menu_item(), gfx::Rect(),
+ MENU_ANCHOR_TOPLEFT, false, false, &mouse_event_flags);
+ EXPECT_EQ(run_result, nullptr);
+}
+
#endif // defined(USE_AURA)
} // namespace test
« no previous file with comments | « no previous file | ui/views/controls/menu/menu_pre_target_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698