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

Unified Diff: services/video_capture/test/fake_device_unittest.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/fake_device_unittest.cc
diff --git a/services/video_capture/test/fake_device_unittest.cc b/services/video_capture/test/fake_device_unittest.cc
index ee2d651830e5a4b8c954e65b7062267e970b594c..58dcd18405e3cbd1cee9739b5e1d7279630e5306 100644
--- a/services/video_capture/test/fake_device_unittest.cc
+++ b/services/video_capture/test/fake_device_unittest.cc
@@ -7,6 +7,7 @@
#include "media/base/video_frame.h"
#include "media/mojo/common/media_type_converters.h"
#include "services/video_capture/device_media_to_mojo_adapter.h"
+#include "services/video_capture/public/interfaces/constants.mojom.h"
#include "services/video_capture/public/interfaces/device_factory.mojom.h"
#include "services/video_capture/test/fake_device_test.h"
#include "services/video_capture/test/mock_receiver.h"
@@ -138,4 +139,26 @@ TEST_F(FakeVideoCaptureDeviceTest, BuffersGetReused) {
ASSERT_LE(num_buffers_created, kMaxBufferPoolBuffers);
}
+// Tests that the service requests to be closed when the last client disconnects
+// while using a device.
+TEST_F(FakeVideoCaptureDeviceTest,
+ ServiceQuitsWhenClientDisconnectsWhileUsingDevice) {
+ base::RunLoop wait_loop;
+ EXPECT_CALL(*service_state_observer_, OnServiceStopped(_))
+ .WillOnce(Invoke([&wait_loop](const service_manager::Identity& identity) {
+ if (identity.name() == mojom::kServiceName)
+ wait_loop.Quit();
+ }));
+
+ mojom::ReceiverPtr receiver_proxy;
+ MockReceiver receiver(mojo::MakeRequest(&receiver_proxy));
+ fake_device_proxy_->Start(requestable_settings_, std::move(receiver_proxy));
+
+ fake_device_proxy_.reset();
+ factory_.reset();
+ factory_provider_.reset();
+
+ wait_loop.Run();
+}
+
} // namespace video_capture
« no previous file with comments | « services/video_capture/test/fake_device_descriptor_test.cc ('k') | services/video_capture/test/mock_device_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698