OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/run_loop.h" | 5 #include "base/run_loop.h" |
6 #include "services/video_capture/mock_device_video_capture_service_test.h" | 6 #include "services/video_capture/mock_device_video_capture_service_test.h" |
7 | 7 |
8 using testing::_; | 8 using testing::_; |
9 using testing::InvokeWithoutArgs; | 9 using testing::InvokeWithoutArgs; |
10 | 10 |
11 namespace video_capture { | 11 namespace video_capture { |
12 | 12 |
13 // Tests that the service stops the capture device when the client closes the | 13 // Tests that the service stops the capture device when the client closes the |
14 // connection to the device proxy. | 14 // connection to the device proxy. |
15 TEST_F(MockDeviceVideoCaptureServiceTest, | 15 TEST_F(MockDeviceVideoCaptureServiceTest, |
16 DeviceIsStoppedWhenDiscardingDeviceProxy) { | 16 DeviceIsStoppedWhenDiscardingDeviceProxy) { |
17 base::RunLoop wait_loop; | 17 base::RunLoop wait_loop; |
18 | 18 |
19 EXPECT_CALL(*mock_device_, AllocateAndStartPtr(_)); | 19 EXPECT_CALL(*mock_device_, AllocateAndStartPtr(_)); |
20 EXPECT_CALL(*mock_device_, StopAndDeAllocate()) | 20 EXPECT_CALL(*mock_device_, StopAndDeAllocate()) |
21 .WillOnce(InvokeWithoutArgs([&wait_loop]() { wait_loop.Quit(); })); | 21 .WillOnce(InvokeWithoutArgs([&wait_loop]() { wait_loop.Quit(); })); |
22 | 22 |
23 device_proxy_->Start(std::move(requested_format_), | 23 device_proxy_->Start(requested_format_, |
24 mojom::ResolutionChangePolicy::FIXED_RESOLUTION, | 24 mojom::ResolutionChangePolicy::FIXED_RESOLUTION, |
25 mojom::PowerLineFrequency::DEFAULT, | 25 mojom::PowerLineFrequency::DEFAULT, |
26 std::move(mock_client_proxy_)); | 26 std::move(mock_client_proxy_)); |
27 device_proxy_.reset(); | 27 device_proxy_.reset(); |
28 | 28 |
29 wait_loop.Run(); | 29 wait_loop.Run(); |
30 } | 30 } |
31 | 31 |
32 // Tests that the service stops the capture device when the client closes the | 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. | 33 // connection to the client proxy it provided to the service. |
34 TEST_F(MockDeviceVideoCaptureServiceTest, | 34 TEST_F(MockDeviceVideoCaptureServiceTest, |
35 DeviceIsStoppedWhenDiscardingDeviceClient) { | 35 DeviceIsStoppedWhenDiscardingDeviceClient) { |
36 base::RunLoop wait_loop; | 36 base::RunLoop wait_loop; |
37 | 37 |
38 EXPECT_CALL(*mock_device_, AllocateAndStartPtr(_)); | 38 EXPECT_CALL(*mock_device_, AllocateAndStartPtr(_)); |
39 EXPECT_CALL(*mock_device_, StopAndDeAllocate()) | 39 EXPECT_CALL(*mock_device_, StopAndDeAllocate()) |
40 .WillOnce(InvokeWithoutArgs([&wait_loop]() { wait_loop.Quit(); })); | 40 .WillOnce(InvokeWithoutArgs([&wait_loop]() { wait_loop.Quit(); })); |
41 | 41 |
42 device_proxy_->Start(std::move(requested_format_), | 42 device_proxy_->Start(requested_format_, |
43 mojom::ResolutionChangePolicy::FIXED_RESOLUTION, | 43 mojom::ResolutionChangePolicy::FIXED_RESOLUTION, |
44 mojom::PowerLineFrequency::DEFAULT, | 44 mojom::PowerLineFrequency::DEFAULT, |
45 std::move(mock_client_proxy_)); | 45 std::move(mock_client_proxy_)); |
46 mock_client_.reset(); | 46 mock_client_.reset(); |
47 | 47 |
48 wait_loop.Run(); | 48 wait_loop.Run(); |
49 } | 49 } |
50 | 50 |
51 } // namespace video_capture | 51 } // namespace video_capture |
OLD | NEW |