| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_UI_VIEWS_MENU_TEST_BASE_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_MENU_TEST_BASE_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_MENU_TEST_BASE_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_MENU_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 views::MenuItemView* menu() { | 50 views::MenuItemView* menu() { |
| 51 return menu_; | 51 return menu_; |
| 52 } | 52 } |
| 53 | 53 |
| 54 int last_command() const { | 54 int last_command() const { |
| 55 return last_command_; | 55 return last_command_; |
| 56 } | 56 } |
| 57 | 57 |
| 58 protected: | 58 protected: |
| 59 views::MenuRunner* menu_runner() { return menu_runner_.get(); } |
| 60 |
| 59 // Called to populate the menu. | 61 // Called to populate the menu. |
| 60 virtual void BuildMenu(views::MenuItemView* menu) = 0; | 62 virtual void BuildMenu(views::MenuItemView* menu) = 0; |
| 61 | 63 |
| 62 // Called once the menu is open. | 64 // Called once the menu is open. |
| 63 virtual void DoTestWithMenuOpen() = 0; | 65 virtual void DoTestWithMenuOpen() = 0; |
| 64 | 66 |
| 65 // Returns a bitmask of flags to use when creating the |menu_runner_|. By | 67 // Returns a bitmask of flags to use when creating the |menu_runner_|. By |
| 66 // default, this is only views::MenuRunner::HAS_MNEMONICS. | 68 // default, this is only views::MenuRunner::HAS_MNEMONICS. |
| 67 virtual int GetMenuRunnerFlags(); | 69 virtual int GetMenuRunnerFlags(); |
| 68 | 70 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 86 views::MenuItemView* menu_; | 88 views::MenuItemView* menu_; |
| 87 std::unique_ptr<views::MenuRunner> menu_runner_; | 89 std::unique_ptr<views::MenuRunner> menu_runner_; |
| 88 | 90 |
| 89 // The command id of the last pressed menu item since the menu was opened. | 91 // The command id of the last pressed menu item since the menu was opened. |
| 90 int last_command_; | 92 int last_command_; |
| 91 | 93 |
| 92 DISALLOW_COPY_AND_ASSIGN(MenuTestBase); | 94 DISALLOW_COPY_AND_ASSIGN(MenuTestBase); |
| 93 }; | 95 }; |
| 94 | 96 |
| 95 #endif // CHROME_BROWSER_UI_VIEWS_MENU_TEST_BASE_H_ | 97 #endif // CHROME_BROWSER_UI_VIEWS_MENU_TEST_BASE_H_ |
| OLD | NEW |