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

Unified Diff: mojo/shell/shell_test_base_unittest.cc

Issue 394903005: mojo: terminate apps if the shell goes away (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 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
Index: mojo/shell/shell_test_base_unittest.cc
diff --git a/mojo/shell/shell_test_base_unittest.cc b/mojo/shell/shell_test_base_unittest.cc
index 446ab09e4f0824fef3efacc9f858b94d197aa973..797ec75ce16a21cc964b43b45d502d743eb66a5d 100644
--- a/mojo/shell/shell_test_base_unittest.cc
+++ b/mojo/shell/shell_test_base_unittest.cc
@@ -135,8 +135,7 @@ TEST_F(ShellTestBaseTest, ConnectInvalidService) {
// Tests that we can connect to a single service within a single app using
// a network based loader instead of local files.
-// TODO(tim): Bug 394477. NetworkService doesn't currently terminate.
-TEST_F(ShellTestBaseTest, DISABLED_ConnectBasicNetwork) {
+TEST_F(ShellTestBaseTest, ConnectBasicNetwork) {
InterfacePtr<TestService> service;
service.Bind(ConnectToServiceViaNetwork(
test_app_url(), TestService::Name_).Pass());
@@ -152,14 +151,16 @@ TEST_F(ShellTestBaseTest, DISABLED_ConnectBasicNetwork) {
// magically exit when TestService is destroyed (unlike ConnectBasic).
// Tearing down the shell context will kill connections. The shell loop will
// exit as soon as no more apps are connected.
- shell_context()->Shutdown();
- message_loop()->Run();
+ // TODO(tim): crbug.com/392685. Calling this explicitly shouldn't be
+ // necessary once the shell terminates if the primordial app exits, which
+ // we could enforce here by resetting |service|.
+ shell_context()->service_manager()->TerminateShellConnections();
+ message_loop()->Run(); // Waits for all connections to die.
}
// Tests that trying to connect to a service over network fails preoprly
// if the service doesn't exist.
-// TODO(tim): Bug 394477. NetworkService doesn't currently terminate.
-TEST_F(ShellTestBaseTest, DISABLED_ConnectInvalidServiceNetwork) {
+TEST_F(ShellTestBaseTest, ConnectInvalidServiceNetwork) {
InterfacePtr<TestService> test_service;
test_service.Bind(ConnectToServiceViaNetwork(
GURL("mojo:non_existent_service"), TestService::Name_).Pass());
@@ -170,8 +171,11 @@ TEST_F(ShellTestBaseTest, DISABLED_ConnectInvalidServiceNetwork) {
message_loop()->Run();
EXPECT_TRUE(test_service.encountered_error());
- shell_context()->Shutdown();
- message_loop()->Run();
+ // TODO(tim): crbug.com/392685. Calling this explicitly shouldn't be
+ // necessary once the shell terminates if the primordial app exits, which
+ // we could enforce here by resetting |service|.
+ shell_context()->service_manager()->TerminateShellConnections();
+ message_loop()->Run(); // Waits for all connections to die.
}
// Similar to ConnectBasic, but causes the app to instantiate multiple
« mojo/public/interfaces/service_provider/service_provider.mojom ('K') | « mojo/shell/context.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698