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

Unified Diff: chrome/browser/ui/ash/launcher/launcher_context_menu_unittest.cc

Issue 2812693002: mash: Fix controller ownership in LauncherContextMenuTest. (Closed)
Patch Set: Created 3 years, 8 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 | « chrome/browser/ui/ash/launcher/launcher_context_menu.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ash/launcher/launcher_context_menu_unittest.cc
diff --git a/chrome/browser/ui/ash/launcher/launcher_context_menu_unittest.cc b/chrome/browser/ui/ash/launcher/launcher_context_menu_unittest.cc
index d945276d16844383e32ff5443466de72bc575fc3..a44fc7be44daeb279b7f087e3ae62b008f6199d4 100644
--- a/chrome/browser/ui/ash/launcher/launcher_context_menu_unittest.cc
+++ b/chrome/browser/ui/ash/launcher/launcher_context_menu_unittest.cc
@@ -10,6 +10,7 @@
#include "ash/root_window_controller.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
+#include "ash/test/shell_test_api.h"
#include "ash/wm_shell.h"
#include "ash/wm_window.h"
#include "base/macros.h"
@@ -46,13 +47,15 @@ class LauncherContextMenuTest : public ash::test::AshTestBase {
arc_test_.SetUp(profile_.get());
session_manager_ = base::MakeUnique<session_manager::SessionManager>();
ash::test::AshTestBase::SetUp();
- controller_.reset(new ChromeLauncherControllerImpl(
- profile(), ash::Shell::Get()->shelf_model()));
+ std::unique_ptr<ChromeLauncherControllerImpl> controller =
+ base::MakeUnique<ChromeLauncherControllerImpl>(
+ profile(), ash::Shell::Get()->shelf_model());
+ controller_ = controller.get();
controller_->Init();
+ ash::test::ShellTestApi().SetShelfDelegate(std::move(controller));
}
void TearDown() override {
- controller_.reset(nullptr);
ash::test::AshTestBase::TearDown();
}
@@ -69,13 +72,13 @@ class LauncherContextMenuTest : public ash::test::AshTestBase {
ash::ShelfItem item;
item.id = 123; // dummy id
item.type = shelf_item_type;
- return LauncherContextMenu::Create(controller_.get(), &item, wm_shelf);
+ return LauncherContextMenu::Create(controller_, &item, wm_shelf);
}
LauncherContextMenu* CreateLauncherContextMenuForDesktopShell(
ash::WmShelf* wm_shelf) {
ash::ShelfItem* item = nullptr;
- return LauncherContextMenu::Create(controller_.get(), item, wm_shelf);
+ return LauncherContextMenu::Create(controller_, item, wm_shelf);
}
// Creates app window and set optional ARC application id.
@@ -94,11 +97,11 @@ class LauncherContextMenuTest : public ash::test::AshTestBase {
Profile* profile() { return profile_.get(); }
- ChromeLauncherControllerImpl* controller() { return controller_.get(); }
+ ChromeLauncherControllerImpl* controller() { return controller_; }
private:
std::unique_ptr<TestingProfile> profile_;
- std::unique_ptr<ChromeLauncherControllerImpl> controller_;
+ ChromeLauncherControllerImpl* controller_ = nullptr;
ArcAppTest arc_test_;
std::unique_ptr<session_manager::SessionManager> session_manager_;
« no previous file with comments | « chrome/browser/ui/ash/launcher/launcher_context_menu.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698