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

Side by Side Diff: services/video_capture/mock_device_video_capture_service_unittest.cc

Issue 2457003002: [Mojo Video Capture] Simplify API and some cleanups (Closed)
Patch Set: Created 4 years, 1 month 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 "base/run_loop.h"
6 #include "services/video_capture/mock_device_video_capture_service_test.h"
7
8 using testing::_;
9 using testing::InvokeWithoutArgs;
10
11 namespace video_capture {
12
13 // Tests that the service stops the capture device when the client closes the
14 // connection to the device proxy.
15 TEST_F(MockDeviceVideoCaptureServiceTest,
16 DeviceIsStoppedWhenDiscardingDeviceProxy) {
17 base::RunLoop wait_loop;
18
19 EXPECT_CALL(*mock_device_, AllocateAndStartPtr(_));
20 EXPECT_CALL(*mock_device_, StopAndDeAllocate())
21 .WillOnce(InvokeWithoutArgs([&wait_loop]() { wait_loop.Quit(); }));
22
23 device_proxy_->Start(requested_format_,
24 media::RESOLUTION_POLICY_FIXED_RESOLUTION,
25 media::PowerLineFrequency::FREQUENCY_DEFAULT,
26 std::move(mock_receiver_proxy_));
27 device_proxy_.reset();
28
29 wait_loop.Run();
30 }
31
32 // Tests that the service stops the capture device when the client closes the
33 // connection to the client proxy it provided to the service.
34 TEST_F(MockDeviceVideoCaptureServiceTest,
35 DeviceIsStoppedWhenDiscardingDeviceClient) {
36 base::RunLoop wait_loop;
37
38 EXPECT_CALL(*mock_device_, AllocateAndStartPtr(_));
39 EXPECT_CALL(*mock_device_, StopAndDeAllocate())
40 .WillOnce(InvokeWithoutArgs([&wait_loop]() { wait_loop.Quit(); }));
41
42 device_proxy_->Start(requested_format_,
43 media::RESOLUTION_POLICY_FIXED_RESOLUTION,
44 media::PowerLineFrequency::FREQUENCY_DEFAULT,
45 std::move(mock_receiver_proxy_));
46 mock_receiver_.reset();
47
48 wait_loop.Run();
49 }
50
51 } // namespace video_capture
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698