Chromium Code Reviews| 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 35c7f0eb8e05ab772427e0d6cec7ac9a80d04627..be8493f3fe1291dc4c1a27f9b6d42094eed4ead8 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 |
| @@ -846,10 +846,10 @@ class ChromeLauncherControllerImplTest : public BrowserWithTestWindowTest { |
| params.context = GetContext(); |
| views::Widget* widget = new views::Widget(); |
| widget->Init(params); |
| - widget->Show(); |
| - widget->Activate(); |
| exo::ShellSurface::SetApplicationId(widget->GetNativeWindow(), |
|
khmel
2016/08/18 16:09:29
We use visibility event to activate Arc window bin
Mr4D (OOO till 08-26)
2016/08/18 21:00:12
You might want to add a comment for that as well?
khmel
2016/08/18 21:05:12
Agree, this is not clear :)
|
| &window_app_id); |
| + widget->Show(); |
| + widget->Activate(); |
| return widget; |
| } |
| @@ -1850,6 +1850,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) { |