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

Unified Diff: mojo/shell/shell_test_base_unittest.cc

Issue 397733003: mojo: kill app_thread before unloading main app library and add tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: also service_manager_unittests 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
« no previous file with comments | « mojo/shell/shell_test_base.cc ('k') | mojo/shell/shell_test_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..446ab09e4f0824fef3efacc9f858b94d197aa973 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,47 @@ 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.
+// TODO(tim): Bug 394477. NetworkService doesn't currently terminate.
+TEST_F(ShellTestBaseTest, DISABLED_ConnectBasicNetwork) {
+ InterfacePtr<TestService> service;
+ service.Bind(ConnectToServiceViaNetwork(
+ 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).
+ // 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();
+}
+
+// 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) {
+ 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());
+
+ shell_context()->Shutdown();
+ message_loop()->Run();
+}
+
// Similar to ConnectBasic, but causes the app to instantiate multiple
// service implementation objects and verifies the shell can reach both.
TEST_F(ShellTestBaseTest, ConnectMultipleInstancesPerApp) {
« no previous file with comments | « mojo/shell/shell_test_base.cc ('k') | mojo/shell/shell_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698