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

Unified Diff: ui/views/test/menu_test_utils.h

Issue 2778383002: MenuController Do Not SetSelection to Empty Items on Drag (Closed)
Patch Set: Make logic readible Created 3 years, 9 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_unittest.cc ('k') | ui/views/test/menu_test_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/test/menu_test_utils.h
diff --git a/ui/views/test/menu_test_utils.h b/ui/views/test/menu_test_utils.h
index 6a7dbfa365b123a1c37aa841a26277922d62157e..e05b2ab66e5d47070bc3920204f806ee70282d2a 100644
--- a/ui/views/test/menu_test_utils.h
+++ b/ui/views/test/menu_test_utils.h
@@ -22,16 +22,23 @@ class TestMenuDelegate : public MenuDelegate {
TestMenuDelegate();
~TestMenuDelegate() override;
+ int show_context_menu_count() { return show_context_menu_count_; }
+ MenuItemView* show_context_menu_source() { return show_context_menu_source_; }
int execute_command_id() const { return execute_command_id_; }
-
int on_menu_closed_called() const { return on_menu_closed_called_count_; }
MenuItemView* on_menu_closed_menu() const { return on_menu_closed_menu_; }
MenuRunner::RunResult on_menu_closed_run_result() const {
return on_menu_closed_run_result_;
}
bool on_perform_drop_called() { return on_perform_drop_called_; }
+ int will_hide_menu_count() { return will_hide_menu_count_; }
+ MenuItemView* will_hide_menu() { return will_hide_menu_; }
// MenuDelegate:
+ bool ShowContextMenu(MenuItemView* source,
+ int id,
+ const gfx::Point& p,
+ ui::MenuSourceType source_type) override;
void ExecuteCommand(int id) override;
void OnMenuClosed(MenuItemView* menu, MenuRunner::RunResult result) override;
int OnPerformDrop(MenuItemView* menu,
@@ -39,8 +46,15 @@ class TestMenuDelegate : public MenuDelegate {
const ui::DropTargetEvent& event) override;
int GetDragOperations(MenuItemView* sender) override;
void WriteDragData(MenuItemView* sender, OSExchangeData* data) override;
+ void WillHideMenu(MenuItemView* menu) override;
private:
+ // The number of times ShowContextMenu was called.
+ int show_context_menu_count_ = 0;
+
+ // The value of the last call to ShowContextMenu.
+ MenuItemView* show_context_menu_source_ = nullptr;
+
// ID of last executed command.
int execute_command_id_;
@@ -51,6 +65,12 @@ class TestMenuDelegate : public MenuDelegate {
MenuItemView* on_menu_closed_menu_;
MenuRunner::RunResult on_menu_closed_run_result_;
+ // The number of times WillHideMenu was called.
+ int will_hide_menu_count_ = 0;
+
+ // The value of the last call to WillHideMenu.
+ MenuItemView* will_hide_menu_ = nullptr;
+
bool on_perform_drop_called_;
DISALLOW_COPY_AND_ASSIGN(TestMenuDelegate);
« no previous file with comments | « ui/views/controls/menu/menu_controller_unittest.cc ('k') | ui/views/test/menu_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698