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 a5529f731d4abe2c02ddbc79ec56a583a76cb264..63ed265df54d6702078d68066bbcfaf8db930419 100644 |
--- a/mojo/shell/shell_test_base_unittest.cc |
+++ b/mojo/shell/shell_test_base_unittest.cc |
@@ -108,7 +108,8 @@ TEST_F(ShellTestBaseTest, ConnectBasic) { |
} |
// Tests that trying to connect to a service fails properly if the service |
-// doesn't exist. |
+// doesn't exist. Implicit in this test is verification that the shell |
+// terminates if no services are running. |
TEST_F(ShellTestBaseTest, ConnectInvalidService) { |
InterfacePtr<TestService> test_service; |
test_service.Bind(ConnectToService(GURL("mojo:non_existent_service"), |
@@ -132,6 +133,38 @@ TEST_F(ShellTestBaseTest, ConnectInvalidService) { |
test_service.reset(); |
} |
+// Tests that we can connect to a single service within a single app using |
+// a network based loader instead of local files. |
+TEST_F(ShellTestBaseTest, ConnectBasicNetwork) { |
+ InterfacePtr<TestService> service; |
+ service.Bind(ConnectToServiceViaNetwork( |
darin (slow to review)
2014/07/15 22:15:15
does this rely on a web server running or is it no
tim (not reviewing)
2014/07/15 22:23:56
ConnectToServiceViaNetwork configures the MojoURLR
|
+ test_app_url(), TestService::Name_).Pass()); |
+ |
+ bool was_run = false; |
+ service->Ping(SetAndQuit<bool>(&was_run, true)); |
+ message_loop()->Run(); |
+ EXPECT_TRUE(was_run); |
+ EXPECT_FALSE(service.encountered_error()); |
+ |
+ // Note that use of the network service is implicit in this test. |
+ // Since TestService is not the only service in use, the shell won't auto |
+ // magically exit when TestService is destroyed (unlike ConnectBasic). |
+} |
+ |
+// Tests that trying to connect to a service over network fails preoprly |
+// if the service doesn't exist. |
+TEST_F(ShellTestBaseTest, ConnectInvalidServiceNetwork) { |
+ InterfacePtr<TestService> test_service; |
+ test_service.Bind(ConnectToServiceViaNetwork( |
+ GURL("mojo:non_existent_service"), TestService::Name_).Pass()); |
+ QuitMessageLoopErrorHandler quitter; |
+ test_service.set_error_handler(&quitter); |
+ bool was_run = false; |
+ test_service->Ping(SetAndQuit<bool>(&was_run, true)); |
+ message_loop()->Run(); |
+ EXPECT_TRUE(test_service.encountered_error()); |
+} |
+ |
// Similar to ConnectBasic, but causes the app to instantiate multiple |
// service implementation objects and verifies the shell can reach both. |
TEST_F(ShellTestBaseTest, ConnectMultipleInstancesPerApp) { |