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

Unified Diff: services/video_capture/test/service_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/service_unittest.cc
diff --git a/services/video_capture/test/service_unittest.cc b/services/video_capture/test/service_unittest.cc
deleted file mode 100644
index 8b4b4bf3c7b7bf873e6bca6a490f9d3af9da358a..0000000000000000000000000000000000000000
--- a/services/video_capture/test/service_unittest.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-// 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 "base/memory/ref_counted.h"
-#include "base/run_loop.h"
-#include "base/test/mock_callback.h"
-#include "services/video_capture/public/interfaces/device_factory.mojom.h"
-#include "services/video_capture/test/service_test.h"
-
-using testing::Exactly;
-using testing::_;
-using testing::Invoke;
-using testing::InvokeWithoutArgs;
-
-namespace video_capture {
-
-// This alias ensures test output is easily attributed to this service's tests.
-// TODO(rockot/chfremer): Consider just renaming the type.
-using VideoCaptureServiceTest = ServiceTest;
-
-// Tests that an answer arrives from the service when calling
-// GetDeviceInfos().
-TEST_F(VideoCaptureServiceTest, GetDeviceInfosCallbackArrives) {
- base::RunLoop wait_loop;
- EXPECT_CALL(device_info_receiver_, Run(_))
- .Times(Exactly(1))
- .WillOnce(InvokeWithoutArgs([&wait_loop]() { wait_loop.Quit(); }));
-
- factory_->GetDeviceInfos(device_info_receiver_.Get());
- wait_loop.Run();
-}
-
-TEST_F(VideoCaptureServiceTest, FakeDeviceFactoryEnumeratesOneDevice) {
- base::RunLoop wait_loop;
- size_t num_devices_enumerated = 0;
- EXPECT_CALL(device_info_receiver_, Run(_))
- .Times(Exactly(1))
- .WillOnce(
- Invoke([&wait_loop, &num_devices_enumerated](
- const std::vector<media::VideoCaptureDeviceInfo>& infos) {
- num_devices_enumerated = infos.size();
- wait_loop.Quit();
- }));
-
- factory_->GetDeviceInfos(device_info_receiver_.Get());
- wait_loop.Run();
- ASSERT_EQ(1u, num_devices_enumerated);
-}
-
-// Tests that VideoCaptureDeviceFactory::CreateDeviceProxy() returns an error
-// code when trying to create a device for an invalid descriptor.
-TEST_F(VideoCaptureServiceTest, ErrorCodeOnCreateDeviceForInvalidDescriptor) {
- const std::string invalid_device_id = "invalid";
- base::RunLoop wait_loop;
- mojom::DevicePtr fake_device_proxy;
- base::MockCallback<mojom::DeviceFactory::CreateDeviceCallback>
- create_device_proxy_callback;
- EXPECT_CALL(create_device_proxy_callback,
- Run(mojom::DeviceAccessResultCode::ERROR_DEVICE_NOT_FOUND))
- .Times(1)
- .WillOnce(InvokeWithoutArgs([&wait_loop]() { wait_loop.Quit(); }));
- factory_->GetDeviceInfos(device_info_receiver_.Get());
- factory_->CreateDevice(invalid_device_id,
- mojo::MakeRequest(&fake_device_proxy),
- create_device_proxy_callback.Get());
- wait_loop.Run();
-}
-
-} // namespace video_capture
« no previous file with comments | « services/video_capture/test/service_test.cc ('k') | services/video_capture/test/service_unittest_manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698