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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/menu/menu_controller.h" 5 #include "ui/views/controls/menu/menu_controller.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 MenuController* controller = menu_controller(); 1297 MenuController* controller = menu_controller();
1298 controller->SetAsyncRun(true); 1298 controller->SetAsyncRun(true);
1299 1299
1300 int mouse_event_flags = 0; 1300 int mouse_event_flags = 0;
1301 MenuItemView* run_result = 1301 MenuItemView* run_result =
1302 controller->Run(owner(), nullptr, menu_item(), gfx::Rect(), 1302 controller->Run(owner(), nullptr, menu_item(), gfx::Rect(),
1303 MENU_ANCHOR_TOPLEFT, false, false, &mouse_event_flags); 1303 MENU_ANCHOR_TOPLEFT, false, false, &mouse_event_flags);
1304 EXPECT_EQ(run_result, nullptr); 1304 EXPECT_EQ(run_result, nullptr);
1305 TestCancelEvent(); 1305 TestCancelEvent();
1306 } 1306 }
1307
1308 // Tests that if a menu is ran without a widget, that MenuPreTargetHandler does
1309 // not cause a crash.
1310 TEST_F(MenuControllerTest, RunWithoutWidgetDoesntCrash) {
1311 ExitMenuRun();
1312 MenuController* controller = menu_controller();
1313 controller->SetAsyncRun(true);
1314 int mouse_event_flags = 0;
1315 MenuItemView* run_result =
1316 controller->Run(nullptr, nullptr, menu_item(), gfx::Rect(),
1317 MENU_ANCHOR_TOPLEFT, false, false, &mouse_event_flags);
1318 EXPECT_EQ(run_result, nullptr);
1319 }
1320
1307 #endif // defined(USE_AURA) 1321 #endif // defined(USE_AURA)
1308 1322
1309 } // namespace test 1323 } // namespace test
1310 } // namespace views 1324 } // namespace views
OLDNEW
« 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