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

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

Issue 2256273003: arc: Fix crash on window close (on close race condition). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment added Created 4 years, 4 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_window_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 35c7f0eb8e05ab772427e0d6cec7ac9a80d04627..eba29f8ef775487526586b09fed439f3d0905fb4 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,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;
}
@@ -1850,6 +1852,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) {
« no previous file with comments | « chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698