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

Unified Diff: ash/common/shelf/shelf_application_menu_model_unittest.cc

Issue 2716403005: mash: Remove shelf app menu item objects. (Closed)
Patch Set: Address comments. 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
« no previous file with comments | « ash/common/shelf/shelf_application_menu_model.cc ('k') | ash/common/shelf/shelf_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/shelf/shelf_application_menu_model_unittest.cc
diff --git a/ash/common/shelf/shelf_application_menu_model_unittest.cc b/ash/common/shelf/shelf_application_menu_model_unittest.cc
index 704f47331daa1938cee9441e2da811474390354c..aebee58d403a8146557d07c7ee31a59675bf2a7d 100644
--- a/ash/common/shelf/shelf_application_menu_model_unittest.cc
+++ b/ash/common/shelf/shelf_application_menu_model_unittest.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include "ash/common/test/test_shelf_item_delegate.h"
#include "ash/public/cpp/shelf_application_menu_item.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
@@ -49,7 +50,7 @@ class ShelfApplicationMenuModelTestAPI {
// Verifies the menu contents given an empty item list.
TEST(ShelfApplicationMenuModelTest, VerifyContentsWithNoMenuItems) {
base::string16 title = base::ASCIIToUTF16("title");
- ShelfApplicationMenuModel menu(title, ShelfAppMenuItemList());
+ ShelfApplicationMenuModel menu(title, ShelfAppMenuItemList(), nullptr);
// Expect the title with separators.
ASSERT_EQ(static_cast<int>(3), menu.GetItemCount());
EXPECT_EQ(ui::MenuModel::TYPE_SEPARATOR, menu.GetTypeAt(0));
@@ -65,12 +66,12 @@ TEST(ShelfApplicationMenuModelTest, VerifyContentsWithMenuItems) {
base::string16 title1 = base::ASCIIToUTF16("title1");
base::string16 title2 = base::ASCIIToUTF16("title2");
base::string16 title3 = base::ASCIIToUTF16("title3");
- items.push_back(base::MakeUnique<ShelfApplicationMenuItem>(title1));
- items.push_back(base::MakeUnique<ShelfApplicationMenuItem>(title2));
- items.push_back(base::MakeUnique<ShelfApplicationMenuItem>(title3));
+ items.push_back(base::MakeUnique<ShelfApplicationMenuItem>(0, title1));
+ items.push_back(base::MakeUnique<ShelfApplicationMenuItem>(1, title2));
+ items.push_back(base::MakeUnique<ShelfApplicationMenuItem>(2, title3));
base::string16 title = base::ASCIIToUTF16("title");
- ShelfApplicationMenuModel menu(title, std::move(items));
+ ShelfApplicationMenuModel menu(title, std::move(items), nullptr);
ShelfApplicationMenuModelTestAPI menu_test_api(&menu);
// Expect the title with separators, the enabled items, and another separator.
@@ -100,7 +101,8 @@ TEST(ShelfApplicationMenuModelTest, VerifyHistogramBuckets) {
base::HistogramTester histogram_tester;
ShelfAppMenuItemList items;
- ShelfApplicationMenuModel menu(base::ASCIIToUTF16("title"), std::move(items));
+ ShelfApplicationMenuModel menu(base::ASCIIToUTF16("title"), std::move(items),
+ nullptr);
ShelfApplicationMenuModelTestAPI menu_test_api(&menu);
menu_test_api.RecordMenuItemSelectedMetrics(kCommandId, kNumMenuItemsEnabled);
@@ -119,8 +121,9 @@ TEST(ShelfApplicationMenuModelTest, VerifyHistogramOnExecute) {
ShelfAppMenuItemList items;
base::string16 title = base::ASCIIToUTF16("title");
- items.push_back(base::MakeUnique<ShelfApplicationMenuItem>(title));
- ShelfApplicationMenuModel menu(title, std::move(items));
+ items.push_back(base::MakeUnique<ShelfApplicationMenuItem>(0, title));
+ test::TestShelfItemDelegate test_delegate(nullptr);
+ ShelfApplicationMenuModel menu(title, std::move(items), &test_delegate);
menu.ExecuteCommand(0, 0);
histogram_tester.ExpectTotalCount(kNumItemsEnabledHistogramName, 1);
« no previous file with comments | « ash/common/shelf/shelf_application_menu_model.cc ('k') | ash/common/shelf/shelf_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698