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

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

Issue 2440733003: Merge Fix Bookmarks Bar Drag-and-Drop between folders (Closed)
Patch Set: Created 4 years, 2 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 | « ui/views/controls/menu/menu_controller.cc ('k') | no next file » | 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 486e9273df85f324e20d90648ede76169980e02f..451b46952853fb6a80de45a9f50ff25ec9123362 100644
--- a/ui/views/controls/menu/menu_controller_unittest.cc
+++ b/ui/views/controls/menu/menu_controller_unittest.cc
@@ -389,6 +389,12 @@ class MenuControllerTest : public ViewsTestBase {
menu_controller_->showing_ = true;
}
+ // Tests that the menu does not destroy itself when canceled during a drag.
+ void TestCancelAllDuringDrag() {
+ menu_controller_->CancelAll();
+ EXPECT_EQ(0, menu_controller_delegate_->on_menu_closed_called());
+ }
+
protected:
void SetPendingStateItem(MenuItemView* item) {
menu_controller_->pending_state_.item = item;
@@ -1411,6 +1417,27 @@ TEST_F(MenuControllerTest, MenuControllerReplacedDuringDrag) {
StartDrag();
}
+// Tests that if a CancelAll is called during drag-and-drop that it does not
+// destroy the MenuController. On Windows and Linux this destruction also
+// destroys the Widget used for drag-and-drop, thereby ending the drag.
+TEST_F(MenuControllerTest, CancelAllDuringDrag) {
+ // This test creates two native widgets, but expects the child native widget
+ // to be able to reach up and use the parent native widget's aura
+ // objects. https://crbug.com/614037
+ if (IsMus())
+ return;
+
+ MenuController* controller = menu_controller();
+ controller->SetAsyncRun(true);
+
+ TestDragDropClient drag_drop_client(base::Bind(
+ &MenuControllerTest::TestCancelAllDuringDrag, base::Unretained(this)));
+ aura::client::SetDragDropClient(owner()->GetNativeWindow()->GetRootWindow(),
+ &drag_drop_client);
+ AddButtonMenuItems();
+ StartDrag();
+}
+
#endif // defined(USE_AURA)
} // namespace test
« no previous file with comments | « ui/views/controls/menu/menu_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698