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

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

Issue 2804373002: Eliminate Connector::Connect(), Connection, etc. (Closed)
Patch Set: . Created 3 years, 8 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 | « media/mojo/services/media_service.cc ('k') | services/catalog/catalog.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/services/media_service_unittest.cc
diff --git a/media/mojo/services/media_service_unittest.cc b/media/mojo/services/media_service_unittest.cc
index bdc2cd7cd22c4451f6f89b568b15f10f6655cb6b..c7e611c2cfb1477b8bf5b2923c3339328440598d 100644
--- a/media/mojo/services/media_service_unittest.cc
+++ b/media/mojo/services/media_service_unittest.cc
@@ -77,9 +77,8 @@ class MediaServiceTest : public service_manager::test::ServiceTest {
void SetUp() override {
ServiceTest::SetUp();
- connection_ = connector()->Connect("media");
media::mojom::MediaServicePtr media_service;
- connection_->GetInterface(&media_service);
+ connector()->BindInterface("media", &media_service);
auto registry =
base::MakeUnique<service_manager::InterfaceRegistry>(std::string());
@@ -148,7 +147,6 @@ class MediaServiceTest : public service_manager::test::ServiceTest {
MOCK_METHOD0(ConnectionClosed, void());
protected:
- std::unique_ptr<service_manager::Connection> connection_;
std::unique_ptr<base::RunLoop> run_loop_;
mojom::InterfaceFactoryPtr interface_factory_;
@@ -202,7 +200,12 @@ TEST_F(MediaServiceTest, InitializeRenderer_InvalidConfig) {
#endif // defined(ENABLE_MOJO_RENDERER)
TEST_F(MediaServiceTest, Lifetime) {
- connection_->SetConnectionLostClosure(
+ // The lifetime of the media service is controlled by the number of
+ // live InterfaceFactory impls, not MediaService impls, so this pipe should
+ // be closed when the last InterfaceFactory is destroyed.
+ media::mojom::MediaServicePtr media_service;
+ connector()->BindInterface("media", &media_service);
+ media_service.set_connection_error_handler(
base::Bind(&MediaServiceTest::ConnectionClosed, base::Unretained(this)));
// Disconnecting CDM and Renderer services doesn't terminate the app.
« no previous file with comments | « media/mojo/services/media_service.cc ('k') | services/catalog/catalog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698