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

Unified Diff: media/mojo/services/media_apptest.cc

Issue 1249643004: media: Quit MojoMediaApplication when no ServiceFactory service is bound. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 5 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 | « no previous file | media/mojo/services/mojo_media_application.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/services/media_apptest.cc
diff --git a/media/mojo/services/media_apptest.cc b/media/mojo/services/media_apptest.cc
index 15e175e8a2eff83127b5d9827e73df69f67c5555..4d08fbac0b0a5ffca04246e8688a8e55e7f05c7b 100644
--- a/media/mojo/services/media_apptest.cc
+++ b/media/mojo/services/media_apptest.cc
@@ -61,6 +61,8 @@ class MediaAppTest : public mojo::test::ApplicationTestBase {
request->url = "mojo:media";
mojo::ApplicationConnection* connection =
application_impl()->ConnectToApplication(request.Pass());
+ connection->SetRemoteServiceProviderConnectionErrorHandler(
+ base::Bind(&MediaAppTest::ConnectionClosed, base::Unretained(this)));
connection->ConnectToService(&service_factory_);
service_factory_->CreateCdm(mojo::GetProxy(&cdm_));
@@ -105,6 +107,8 @@ class MediaAppTest : public mojo::test::ApplicationTestBase {
base::Unretained(this)));
}
+ MOCK_METHOD0(ConnectionClosed, void());
+
protected:
scoped_ptr<base::RunLoop> run_loop_;
@@ -146,4 +150,19 @@ TEST_F(MediaAppTest, InitializeRenderer_InvalidConfig) {
run_loop_->Run();
}
+TEST_F(MediaAppTest, Lifetime) {
+ // Disconnecting CDM and Renderer services doesn't terminate the app.
+ cdm_.reset();
+ renderer_.reset();
+
+ // Disconnecting ServiceFactory service should terminate the app, which will
+ // close the connection.
+ EXPECT_CALL(*this, ConnectionClosed())
+ .Times(Exactly(1))
+ .WillOnce(Invoke(run_loop_.get(), &base::RunLoop::Quit));
+ service_factory_.reset();
+
+ run_loop_->Run();
+}
+
} // namespace media
« no previous file with comments | « no previous file | media/mojo/services/mojo_media_application.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698