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

Side by Side 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, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "services/video_capture/test/device_factory_provider_test.h"
6
7 #include "services/service_manager/public/interfaces/constants.mojom.h"
8 #include "services/service_manager/public/interfaces/service_manager.mojom.h"
9 #include "services/video_capture/public/interfaces/constants.mojom.h"
10
11 namespace video_capture {
12
13 ServiceManagerListenerImpl::ServiceManagerListenerImpl(
14 service_manager::mojom::ServiceManagerListenerRequest request,
15 base::RunLoop* loop)
16 : binding_(this, std::move(request)), loop_(loop) {}
17
18 ServiceManagerListenerImpl::~ServiceManagerListenerImpl() = default;
19
20 DeviceFactoryProviderTest::DeviceFactoryProviderTest()
21 : service_manager::test::ServiceTest("video_capture_unittests") {}
22
23 DeviceFactoryProviderTest::~DeviceFactoryProviderTest() = default;
24
25 void DeviceFactoryProviderTest::SetUp() {
26 service_manager::test::ServiceTest::SetUp();
27
28 service_manager::mojom::ServiceManagerPtr service_manager;
29 connector()->BindInterface(service_manager::mojom::kServiceName,
30 &service_manager);
31 service_manager::mojom::ServiceManagerListenerPtr listener;
32 base::RunLoop loop;
33 service_state_observer_ = base::MakeUnique<ServiceManagerListenerImpl>(
34 mojo::MakeRequest(&listener), &loop);
35 service_manager->AddListener(std::move(listener));
36 loop.Run();
37
38 connector()->BindInterface(mojom::kServiceName, &factory_provider_);
39 factory_provider_->SetShutdownDelayInSeconds(0.0f);
40 factory_provider_->ConnectToFakeDeviceFactory(mojo::MakeRequest(&factory_));
41 }
42
43 } // namespace video_capture
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698