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

Unified Diff: ash/shelf/shelf_view_unittest.cc

Issue 2718563008: mash: Use mojo for ShelfItemDelegate and [app] MenuItem. (Closed)
Patch Set: Cleanup; fix ash_shell compile and a couple tests. 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
Index: ash/shelf/shelf_view_unittest.cc
diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc
index a4d70724921a53e4bbb862d24affbbe9e6b856d3..e682c0d1efb222551dfb489fddfbd92482ca5fc6 100644
--- a/ash/shelf/shelf_view_unittest.cc
+++ b/ash/shelf/shelf_view_unittest.cc
@@ -155,18 +155,18 @@ class ShelfItemSelectionTracker : public TestShelfItemDelegate {
bool WasSelected() { return selected_; }
// TestShelfItemDelegate:
- ShelfAction ItemSelected(ui::EventType event_type,
- int event_flags,
- int64_t display_id,
- ShelfLaunchSource source) override {
+ void ItemSelected(std::unique_ptr<ui::Event> event,
+ int64_t display_id,
+ ShelfLaunchSource source,
+ const ItemSelectedCallback& callback) override {
selected_ = true;
- return item_selected_action_;
+ callback.Run(item_selected_action_, MenuItemList());
}
private:
bool selected_;
- // The action returned from ItemSelected(const ui::Event&).
+ // The action reported by ItemSelected.
ShelfAction item_selected_action_;
DISALLOW_COPY_AND_ASSIGN(ShelfItemSelectionTracker);
@@ -1979,12 +1979,14 @@ class ListMenuShelfItemDelegate : public TestShelfItemDelegate {
private:
// TestShelfItemDelegate:
- ShelfAppMenuItemList GetAppMenuItems(int event_flags) override {
- ShelfAppMenuItemList items;
- base::string16 title = base::ASCIIToUTF16("title");
- items.push_back(base::MakeUnique<ShelfApplicationMenuItem>(0, title));
- items.push_back(base::MakeUnique<ShelfApplicationMenuItem>(1, title));
- return items;
+ void ItemSelected(std::unique_ptr<ui::Event> event,
+ int64_t display_id,
+ ShelfLaunchSource source,
+ const ItemSelectedCallback& callback) override {
+ MenuItemList items;
+ items.push_back(ash::mojom::MenuItem::New());
James Cook 2017/03/09 01:09:47 These don't need dummy data?
msw 2017/03/10 06:17:57 Nope! The test only cares that a menu shows; empty
+ items.push_back(ash::mojom::MenuItem::New());
+ callback.Run(ash::SHELF_ACTION_NONE, std::move(items));
}
DISALLOW_COPY_AND_ASSIGN(ListMenuShelfItemDelegate);
@@ -2426,9 +2428,8 @@ TEST_F(ShelfViewInkDropTest, ShelfButtonWithMenuPressRelease) {
// Set a delegate for the shelf item that returns an app list menu.
ShelfID browser_shelf_id = model_->items()[browser_index_].id;
- ListMenuShelfItemDelegate* list_menu_delegate = new ListMenuShelfItemDelegate;
model_->SetShelfItemDelegate(browser_shelf_id,
- base::WrapUnique(list_menu_delegate));
+ base::MakeUnique<ListMenuShelfItemDelegate>());
views::CustomButton* button = browser_button_;
gfx::Point mouse_location = button->GetLocalBounds().CenterPoint();

Powered by Google App Engine
This is Rietveld 408576698