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

Side by Side Diff: services/video_capture/mock_device_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
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_test.h"
7 7
8 using testing::_; 8 using testing::_;
9 using testing::InvokeWithoutArgs; 9 using testing::Invoke;
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(MockDeviceTest, DeviceIsStoppedWhenDiscardingDeviceProxy) {
16 DeviceIsStoppedWhenDiscardingDeviceProxy) {
17 base::RunLoop wait_loop; 16 base::RunLoop wait_loop;
18 17
19 EXPECT_CALL(*mock_device_, AllocateAndStartPtr(_)); 18 EXPECT_CALL(*mock_device_, AllocateAndStartPtr(_));
20 EXPECT_CALL(*mock_device_, StopAndDeAllocate()) 19 EXPECT_CALL(*mock_device_, StopAndDeAllocate())
21 .WillOnce(InvokeWithoutArgs([&wait_loop]() { wait_loop.Quit(); })); 20 .WillOnce(Invoke([&wait_loop]() { wait_loop.Quit(); }));
22 21
23 device_proxy_->Start(requested_format_, 22 device_proxy_->Start(requested_settings_,
24 media::RESOLUTION_POLICY_FIXED_RESOLUTION,
25 media::PowerLineFrequency::FREQUENCY_DEFAULT,
26 std::move(mock_receiver_proxy_)); 23 std::move(mock_receiver_proxy_));
27 device_proxy_.reset(); 24 device_proxy_.reset();
28 25
29 wait_loop.Run(); 26 wait_loop.Run();
30 } 27 }
31 28
32 // Tests that the service stops the capture device when the client closes the 29 // Tests that the service stops the capture device when the client closes the
33 // connection to the client proxy it provided to the service. 30 // connection to the client proxy it provided to the service.
34 TEST_F(MockDeviceVideoCaptureServiceTest, 31 TEST_F(MockDeviceTest, DeviceIsStoppedWhenDiscardingDeviceClient) {
35 DeviceIsStoppedWhenDiscardingDeviceClient) {
36 base::RunLoop wait_loop; 32 base::RunLoop wait_loop;
37 33
38 EXPECT_CALL(*mock_device_, AllocateAndStartPtr(_)); 34 EXPECT_CALL(*mock_device_, AllocateAndStartPtr(_));
39 EXPECT_CALL(*mock_device_, StopAndDeAllocate()) 35 EXPECT_CALL(*mock_device_, StopAndDeAllocate())
40 .WillOnce(InvokeWithoutArgs([&wait_loop]() { wait_loop.Quit(); })); 36 .WillOnce(Invoke([&wait_loop]() { wait_loop.Quit(); }));
41 37
42 device_proxy_->Start(requested_format_, 38 device_proxy_->Start(requested_settings_,
43 media::RESOLUTION_POLICY_FIXED_RESOLUTION,
44 media::PowerLineFrequency::FREQUENCY_DEFAULT,
45 std::move(mock_receiver_proxy_)); 39 std::move(mock_receiver_proxy_));
46 mock_receiver_.reset(); 40 mock_receiver_.reset();
47 41
48 wait_loop.Run(); 42 wait_loop.Run();
49 } 43 }
50 44
51 } // namespace video_capture 45 } // namespace video_capture
OLDNEW
« no previous file with comments | « services/video_capture/mock_device_test.cc ('k') | services/video_capture/mock_device_video_capture_service_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698