| 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 ca99f93bcada93362b9d96c497237acf7a175fe8..53152ed83cc98d7eaeb9c88ca093f5503f71e575 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
|
| @@ -863,10 +863,12 @@ class ChromeLauncherControllerImplTest : public BrowserWithTestWindowTest {
|
| params.context = GetContext();
|
| views::Widget* widget = new views::Widget();
|
| widget->Init(params);
|
| - widget->Show();
|
| - widget->Activate();
|
| + // Set Arc id before showing the window to be recognized in
|
| + // ArcAppWindowLauncherController.
|
| exo::ShellSurface::SetApplicationId(widget->GetNativeWindow(),
|
| &window_app_id);
|
| + widget->Show();
|
| + widget->Activate();
|
| return widget;
|
| }
|
|
|
| @@ -1868,6 +1870,45 @@ TEST_F(ChromeLauncherControllerImplTest, ArcRunningApp) {
|
| EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id));
|
| }
|
|
|
| +// Test race creation/deletion of Arc app.
|
| +// TODO (khmel): Remove after moving everything to wayland protocol.
|
| +TEST_F(ChromeLauncherControllerImplTest, ArcRaceCreateClose) {
|
| + arc_test_.SetUp(profile());
|
| + InitLauncherController();
|
| +
|
| + const std::string arc_app_id1 =
|
| + ArcAppTest::GetAppId(arc_test_.fake_apps()[0]);
|
| + const std::string arc_app_id2 =
|
| + ArcAppTest::GetAppId(arc_test_.fake_apps()[1]);
|
| + SendListOfArcApps();
|
| +
|
| + // Arc window created before and closed after mojom notification.
|
| + std::string window_app_id1("org.chromium.arc.1");
|
| + views::Widget* arc_window = CreateArcWindow(window_app_id1);
|
| + EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1));
|
| + ASSERT_TRUE(arc_window);
|
| + arc_test_.app_instance()->SendTaskCreated(1, arc_test_.fake_apps()[0]);
|
| + EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1));
|
| + arc_test_.app_instance()->SendTaskDestroyed(1);
|
| + EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1));
|
| + arc_window->Close();
|
| + base::RunLoop().RunUntilIdle();
|
| + EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id1));
|
| +
|
| + // Arc window created after and closed before mojom notification.
|
| + std::string window_app_id2("org.chromium.arc.2");
|
| + arc_test_.app_instance()->SendTaskCreated(2, arc_test_.fake_apps()[1]);
|
| + EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2));
|
| + arc_window = CreateArcWindow(window_app_id2);
|
| + ASSERT_TRUE(arc_window);
|
| + EXPECT_NE(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2));
|
| + arc_window->Close();
|
| + base::RunLoop().RunUntilIdle();
|
| + EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2));
|
| + arc_test_.app_instance()->SendTaskDestroyed(2);
|
| + EXPECT_EQ(0, launcher_controller_->GetShelfIDForAppID(arc_app_id2));
|
| +}
|
| +
|
| // Validate that Arc app is pinned correctly and pin is removed automatically
|
| // once app is uninstalled.
|
| TEST_F(ChromeLauncherControllerImplTest, ArcAppPin) {
|
|
|