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 "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/test/base/view_event_test_base.h" | 10 #include "chrome/test/base/view_event_test_base.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 return last_command_; | 53 return last_command_; |
54 } | 54 } |
55 | 55 |
56 protected: | 56 protected: |
57 // Called to populate the menu. | 57 // Called to populate the menu. |
58 virtual void BuildMenu(views::MenuItemView* menu) = 0; | 58 virtual void BuildMenu(views::MenuItemView* menu) = 0; |
59 | 59 |
60 // Called once the menu is open. | 60 // Called once the menu is open. |
61 virtual void DoTestWithMenuOpen() = 0; | 61 virtual void DoTestWithMenuOpen() = 0; |
62 | 62 |
63 // Returns a bitmask of flags to use when creating the |menu_runner_|. By | |
64 // default, this is only views::MenuRunner::HAS_MNEMONICS. | |
65 virtual int GetMenuRunnerFlags(); | |
66 | |
67 // ViewEventTestBase implementation. | 63 // ViewEventTestBase implementation. |
68 virtual void SetUp() OVERRIDE; | 64 virtual void SetUp() OVERRIDE; |
69 virtual void TearDown() OVERRIDE; | 65 virtual void TearDown() OVERRIDE; |
70 virtual views::View* CreateContentsView() OVERRIDE; | 66 virtual views::View* CreateContentsView() OVERRIDE; |
71 virtual void DoTestOnMessageLoop() OVERRIDE; | 67 virtual void DoTestOnMessageLoop() OVERRIDE; |
72 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 68 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
73 | 69 |
74 // views::MenuButtonListener implementation | 70 // views::MenuButtonListener implementation |
75 virtual void OnMenuButtonClicked(views::View* source, | 71 virtual void OnMenuButtonClicked(views::View* source, |
76 const gfx::Point& point) OVERRIDE; | 72 const gfx::Point& point) OVERRIDE; |
77 | 73 |
78 // views::MenuDelegate implementation | 74 // views::MenuDelegate implementation |
79 virtual void ExecuteCommand(int id) OVERRIDE; | 75 virtual void ExecuteCommand(int id) OVERRIDE; |
80 | 76 |
81 private: | 77 private: |
82 views::MenuButton* button_; | 78 views::MenuButton* button_; |
83 views::MenuItemView* menu_; | 79 views::MenuItemView* menu_; |
84 scoped_ptr<views::MenuRunner> menu_runner_; | 80 scoped_ptr<views::MenuRunner> menu_runner_; |
85 | 81 |
86 // The command id of the last pressed menu item since the menu was opened. | 82 // The command id of the last pressed menu item since the menu was opened. |
87 int last_command_; | 83 int last_command_; |
88 | 84 |
89 DISALLOW_COPY_AND_ASSIGN(MenuTestBase); | 85 DISALLOW_COPY_AND_ASSIGN(MenuTestBase); |
90 }; | 86 }; |
91 | 87 |
92 #endif // CHROME_BROWSER_UI_VIEWS_MENU_TEST_BASE_H_ | 88 #endif // CHROME_BROWSER_UI_VIEWS_MENU_TEST_BASE_H_ |
OLD | NEW |