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 7fcd0a97993455b17a8dda2330277f762707d7b2..095eec642abb949de18393ebd750bdadab1c79a9 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 |
@@ -1932,6 +1932,55 @@ TEST_P(ChromeLauncherControllerImplWithArcTest, ArcDeferredLaunch) { |
(request1->IsForApp(app3) && request2->IsForApp(app2))); |
} |
+// Test that validates deferred controler does not override active app |
msw
2017/03/14 20:28:08
nit: consider "// Ensure the deferred controller d
khmel
2017/03/14 20:32:09
Thanks for ready to use text :)
|
+// controller. |
+TEST_P(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 active state. |
msw
2017/03/14 20:28:08
nit: Does 'active' here contradict the 'STATUS_CLO
khmel
2017/03/14 20:32:09
nice catch.
|
+ 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_P(ChromeLauncherControllerImplMultiProfileWithArcTest, ArcMultiUser) { |
SendListOfArcApps(); |