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

Unified Diff: services/video_capture/test/device_factory_provider_test.cc

Issue 2824883005: [Mojo Video Capture] Stop service when last client disconnects. (Closed)
Patch Set: Incorporate suggestions from PatchSet #4 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
Index: services/video_capture/test/device_factory_provider_test.cc
diff --git a/services/video_capture/test/device_factory_provider_test.cc b/services/video_capture/test/device_factory_provider_test.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4c270281f795f339bbfb013278fd6e43c721928c
--- /dev/null
+++ b/services/video_capture/test/device_factory_provider_test.cc
@@ -0,0 +1,43 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "services/video_capture/test/device_factory_provider_test.h"
+
+#include "services/service_manager/public/interfaces/constants.mojom.h"
+#include "services/service_manager/public/interfaces/service_manager.mojom.h"
+#include "services/video_capture/public/interfaces/constants.mojom.h"
+
+namespace video_capture {
+
+ServiceManagerListenerImpl::ServiceManagerListenerImpl(
+ service_manager::mojom::ServiceManagerListenerRequest request,
+ base::RunLoop* loop)
+ : binding_(this, std::move(request)), loop_(loop) {}
+
+ServiceManagerListenerImpl::~ServiceManagerListenerImpl() = default;
+
+DeviceFactoryProviderTest::DeviceFactoryProviderTest()
+ : service_manager::test::ServiceTest("video_capture_unittests") {}
+
+DeviceFactoryProviderTest::~DeviceFactoryProviderTest() = default;
+
+void DeviceFactoryProviderTest::SetUp() {
+ service_manager::test::ServiceTest::SetUp();
+
+ service_manager::mojom::ServiceManagerPtr service_manager;
+ connector()->BindInterface(service_manager::mojom::kServiceName,
+ &service_manager);
+ service_manager::mojom::ServiceManagerListenerPtr listener;
+ base::RunLoop loop;
+ service_state_observer_ = base::MakeUnique<ServiceManagerListenerImpl>(
+ mojo::MakeRequest(&listener), &loop);
+ service_manager->AddListener(std::move(listener));
+ loop.Run();
+
+ connector()->BindInterface(mojom::kServiceName, &factory_provider_);
+ factory_provider_->SetShutdownDelayInSeconds(0.0f);
+ factory_provider_->ConnectToFakeDeviceFactory(mojo::MakeRequest(&factory_));
+}
+
+} // namespace video_capture

Powered by Google App Engine
This is Rietveld 408576698