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

Unified Diff: ash/shelf/shelf_view_unittest.cc

Issue 2671923002: mash: Cleanup ash shelf application menu code. (Closed)
Patch Set: Fix tests; cleanup. 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
Index: ash/shelf/shelf_view_unittest.cc
diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc
index e2df5ffe4768fb84bb82116bbd7a39a8b82ac25d..48c6f5f9095a7811cf7e0f5f54fc5d1f98a1bbdf 100644
--- a/ash/shelf/shelf_view_unittest.cc
+++ b/ash/shelf/shelf_view_unittest.cc
@@ -2004,36 +2004,6 @@ class InkDropSpy : public views::InkDrop {
DISALLOW_COPY_AND_ASSIGN(InkDropSpy);
};
-// A menu model that contains minimum number of items needed for a menu to be
-// shown on a shelf item.
-class TestShelfMenuModel : public ui::SimpleMenuModel,
- public ui::SimpleMenuModel::Delegate {
- public:
- TestShelfMenuModel() : ui::SimpleMenuModel(this) { Build(); }
- ~TestShelfMenuModel() override {}
-
- private:
- void Build() {
- // A menu is expected to have at least 6 items. Three spacing separators,
- // one title, and at least two more items.
- AddSeparator(ui::SPACING_SEPARATOR);
- AddItem(0, base::ASCIIToUTF16("Title"));
- AddSeparator(ui::SPACING_SEPARATOR);
- AddItem(1, base::ASCIIToUTF16("Item 1"));
- AddItem(2, base::ASCIIToUTF16("Item 2"));
- AddSeparator(ui::SPACING_SEPARATOR);
- }
-
- // ui::SimpleMenuModel::Delegate:
- bool IsCommandIdChecked(int command_id) const override { return false; }
- bool IsCommandIdEnabled(int command_id) const override {
- return command_id != 0;
- }
- void ExecuteCommand(int command_id, int event_flags) override {}
-
- DISALLOW_COPY_AND_ASSIGN(TestShelfMenuModel);
-};
-
// A ShelfItemDelegate that returns a menu for the shelf item.
class ListMenuShelfItemDelegate : public TestShelfItemDelegate {
public:
@@ -2042,8 +2012,12 @@ class ListMenuShelfItemDelegate : public TestShelfItemDelegate {
private:
// TestShelfItemDelegate:
- ui::SimpleMenuModel* CreateApplicationMenu(int event_flags) override {
- return new TestShelfMenuModel;
+ ShelfApplicationMenuItems GetAppMenuItems(int event_flags) override {
+ ShelfApplicationMenuItems items;
+ base::string16 title = base::ASCIIToUTF16("title");
+ items.push_back(base::MakeUnique<ShelfApplicationMenuItem>(title, nullptr));
James Cook 2017/02/06 17:30:21 Given the number of times the (title, nullptr) con
msw 2017/02/07 09:12:01 Done, I added a default parameter and updated call
+ items.push_back(base::MakeUnique<ShelfApplicationMenuItem>(title, nullptr));
+ return items;
}
DISALLOW_COPY_AND_ASSIGN(ListMenuShelfItemDelegate);

Powered by Google App Engine
This is Rietveld 408576698