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

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

Issue 2690013002: Revert of Stop MenuItemView From Directly Caching MenuController (Closed)
Patch Set: Created 3 years, 10 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') | ui/views/controls/menu/menu_item_view.h » ('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 d88ea756b8de10ecd510aec4e57b4f9b1b6628c6..70aded93ba9e3e141f363e8160e635bdf72062be 100644
--- a/ui/views/controls/menu/menu_controller_unittest.cc
+++ b/ui/views/controls/menu/menu_controller_unittest.cc
@@ -24,7 +24,6 @@
#include "ui/views/controls/menu/menu_controller_delegate.h"
#include "ui/views/controls/menu/menu_delegate.h"
#include "ui/views/controls/menu/menu_host.h"
-#include "ui/views/controls/menu/menu_host_root_view.h"
#include "ui/views/controls/menu/menu_item_view.h"
#include "ui/views/controls/menu/menu_message_loop.h"
#include "ui/views/controls/menu/menu_scroll_view_container.h"
@@ -32,7 +31,6 @@
#include "ui/views/test/menu_test_utils.h"
#include "ui/views/test/test_views_delegate.h"
#include "ui/views/test/views_test_base.h"
-#include "ui/views/widget/root_view.h"
#if defined(USE_AURA)
#include "ui/aura/client/drag_drop_client.h"
@@ -508,10 +506,6 @@
MenuHost* GetMenuHost(SubmenuView* submenu) { return submenu->host_; }
- MenuHostRootView* CreateMenuHostRootView(MenuHost* host) {
- return static_cast<MenuHostRootView*>(host->CreateRootView());
- }
-
void MenuHostOnDragWillStart(MenuHost* host) { host->OnDragWillStart(); }
void MenuHostOnDragComplete(MenuHost* host) { host->OnDragComplete(); }
@@ -613,6 +607,7 @@
menu_controller_->ExitMenuRun();
}
+ private:
void DestroyMenuController() {
if (!menu_controller_)
return;
@@ -626,7 +621,6 @@
menu_controller_ = nullptr;
}
- private:
void Init() {
owner_.reset(new Widget);
Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_POPUP);
@@ -1198,28 +1192,6 @@
MenuHostOnDragComplete(host);
}
-// Widget destruction and cleanup occurs on the MessageLoop after the
-// MenuController has been destroyed. A MenuHostRootView should not attempt to
-// access a destroyed MenuController. This test should not cause a crash.
-TEST_F(MenuControllerTest, HostReceivesInputBeforeDestruction) {
- MenuController* controller = menu_controller();
- controller->SetAsyncRun(true);
-
- SubmenuView* submenu = menu_item()->GetSubmenu();
- submenu->ShowAt(owner(), menu_item()->bounds(), false);
- gfx::Point location(submenu->bounds().bottom_right());
- location.Offset(1, 1);
-
- MenuHost* host = GetMenuHost(submenu);
- MenuHostRootView* root_view = CreateMenuHostRootView(host);
- DestroyMenuController();
-
- ui::MouseEvent event(ui::ET_MOUSE_MOVED, location, location,
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0);
-
- root_view->OnMouseMoved(event);
-}
-
// Tets that an asynchronous menu nested within an asynchronous menu closes both
// menus, and notifies both delegates.
TEST_F(MenuControllerTest, DoubleAsynchronousNested) {
« no previous file with comments | « ui/views/controls/menu/menu_controller.cc ('k') | ui/views/controls/menu/menu_item_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698