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

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

Issue 1200323003: media: Quit MojoMediaApplication when no 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_cdm_service.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 f194567c5911785877bebe6ab19086a5109f3bad..5737cac493422793cf1a1d964bdbda8b1cbe6803 100644
--- a/media/mojo/services/media_apptest.cc
+++ b/media/mojo/services/media_apptest.cc
@@ -57,7 +57,9 @@ class MediaAppTest : public mojo::test::ApplicationTestBase {
mojo::URLRequestPtr request = mojo::URLRequest::New();
request->url = "mojo:media";
mojo::ApplicationConnection* connection =
- application_impl()->ConnectToApplication(request.Pass());
+ application_impl()->ConnectToApplication(
+ request.Pass(),
+ base::Bind(&MediaAppTest::OnAppTerminated, base::Unretained(this)));
connection->ConnectToService(&cdm_);
connection->ConnectToService(&media_renderer_);
@@ -100,6 +102,8 @@ class MediaAppTest : public mojo::test::ApplicationTestBase {
base::Unretained(this)));
}
+ MOCK_METHOD0(OnAppTerminated, void());
+
protected:
scoped_ptr<base::RunLoop> run_loop_;
@@ -141,4 +145,17 @@ TEST_F(MediaAppTest, InitializeRenderer_InvalidConfig) {
run_loop_->Run();
}
+TEST_F(MediaAppTest, Lifetime) {
+ // Disconnect one service doesn't terminate the app.
+ cdm_.reset();
+
+ // Disconnect all services should terminate the app.
+ EXPECT_CALL(*this, OnAppTerminated())
+ .Times(Exactly(1))
+ .WillOnce(Invoke(run_loop_.get(), &base::RunLoop::Quit));
+ media_renderer_.reset();
+
+ run_loop_->Run();
+}
+
} // namespace media
« no previous file with comments | « no previous file | media/mojo/services/mojo_cdm_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698