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

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

Issue 2758873002: [Merge M58] arc: Fix crash on deferred app launch. (Closed)
Patch Set: resolve merge conflicts 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
« no previous file with comments | « chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.cc ('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/chrome_launcher_controller_impl_unittest.cc
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc
index 4b5b8ad57c4bcaf22bf4a3a0803c5992c3274ae2..5206b7b8c18e697bf41a87c910f3aa75edf5ccb3 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc
@@ -1910,6 +1910,55 @@ TEST_F(ChromeLauncherControllerImplWithArcTest, ArcDeferredLaunch) {
(request1->IsForApp(app3) && request2->IsForApp(app2)));
}
+// Ensure the deferred controller does not override the active app controller
+// (crbug.com/701152).
+TEST_F(ChromeLauncherControllerImplWithArcTest, ArcDeferredLaunchForActiveApp) {
+ RecreateChromeLauncher();
+ SendListOfArcApps();
+ arc_test_.StopArcInstance();
+
+ const arc::mojom::AppInfo& app = arc_test_.fake_apps()[0];
+ const std::string app_id = ArcAppTest::GetAppId(app);
+
+ launcher_controller_->PinAppWithID(app_id);
+ EXPECT_TRUE(launcher_controller_->IsAppPinned(app_id));
+ const ash::ShelfID shelf_id =
+ launcher_controller_->GetShelfIDForAppID(app_id);
+ EXPECT_NE(ash::kInvalidShelfID, shelf_id);
+
+ int item_index = model_->ItemIndexByID(shelf_id);
+ ASSERT_GE(item_index, 0);
+
+ EXPECT_EQ(model_->items()[item_index].status, ash::STATUS_CLOSED);
+ EXPECT_EQ(model_->items()[item_index].type, ash::TYPE_APP_SHORTCUT);
+
+ // Play Store app is ARC app that might be represented by native Chrome
+ // platform app.
+ AppWindowLauncherItemController* app_controller =
+ new ExtensionAppWindowLauncherItemController(app_id, "",
+ launcher_controller_.get());
+ launcher_controller_->SetItemController(shelf_id, app_controller);
+ launcher_controller_->SetItemStatus(shelf_id, ash::STATUS_RUNNING);
+
+ // This launch request should be ignored in case of active app.
+ arc::LaunchApp(profile(), app_id, ui::EF_LEFT_MOUSE_BUTTON);
+ EXPECT_FALSE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id));
+
+ // Close app but shortcut should exist.
+ launcher_controller_->CloseLauncherItem(shelf_id);
+ EXPECT_EQ(shelf_id, launcher_controller_->GetShelfIDForAppID(app_id));
+
+ // This should switch shelf item into closed state.
+ item_index = model_->ItemIndexByID(shelf_id);
+ ASSERT_GE(item_index, 0);
+ EXPECT_EQ(model_->items()[item_index].status, ash::STATUS_CLOSED);
+ EXPECT_EQ(model_->items()[item_index].type, ash::TYPE_APP_SHORTCUT);
+
+ // Now launch request should not be ignored.
+ arc::LaunchApp(profile(), app_id, ui::EF_LEFT_MOUSE_BUTTON);
+ EXPECT_TRUE(launcher_controller_->GetArcDeferredLauncher()->HasApp(app_id));
+}
+
TEST_F(ChromeLauncherControllerImplMultiProfileWithArcTest, ArcMultiUser) {
SendListOfArcApps();
« no previous file with comments | « chrome/browser/ui/ash/launcher/arc_app_deferred_launcher_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698