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

Side by Side Diff: content/browser/renderer_host/media/video_capture_manager_unittest.cc

Issue 801363002: Queue commands to the Os to start a video device. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adressed comments. Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « content/browser/renderer_host/media/video_capture_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Unit test for VideoCaptureManager. 5 // Unit test for VideoCaptureManager.
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 VideoCaptureControllerID client_id = StartClient(video_session_id, true); 169 VideoCaptureControllerID client_id = StartClient(video_session_id, true);
170 170
171 StopClient(client_id); 171 StopClient(client_id);
172 vcm_->Close(video_session_id); 172 vcm_->Close(video_session_id);
173 173
174 // Wait to check callbacks before removing the listener. 174 // Wait to check callbacks before removing the listener.
175 message_loop_->RunUntilIdle(); 175 message_loop_->RunUntilIdle();
176 vcm_->Unregister(); 176 vcm_->Unregister();
177 } 177 }
178 178
179 TEST_F(VideoCaptureManagerTest, CreateAndCloseMultipleTimes) {
180 StreamDeviceInfoArray devices;
181
182 InSequence s;
183 EXPECT_CALL(*listener_, DevicesEnumerated(MEDIA_DEVICE_VIDEO_CAPTURE, _))
184 .WillOnce(SaveArg<1>(&devices));
185
186 vcm_->EnumerateDevices(MEDIA_DEVICE_VIDEO_CAPTURE);
187
188 // Wait to get device callback.
189 message_loop_->RunUntilIdle();
190
191 for (int i = 1 ; i < 3 ; ++i) {
192 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, i));
193 EXPECT_CALL(*listener_, Closed(MEDIA_DEVICE_VIDEO_CAPTURE, i));
194 int video_session_id = vcm_->Open(devices.front());
195 VideoCaptureControllerID client_id = StartClient(video_session_id, true);
196
197 StopClient(client_id);
198 vcm_->Close(video_session_id);
199 }
200
201 // Wait to check callbacks before removing the listener.
202 message_loop_->RunUntilIdle();
203 vcm_->Unregister();
204 }
205
179 // Try to open, start, and abort a device. 206 // Try to open, start, and abort a device.
180 TEST_F(VideoCaptureManagerTest, CreateAndAbort) { 207 TEST_F(VideoCaptureManagerTest, CreateAndAbort) {
181 StreamDeviceInfoArray devices; 208 StreamDeviceInfoArray devices;
182 209
183 InSequence s; 210 InSequence s;
184 EXPECT_CALL(*listener_, DevicesEnumerated(MEDIA_DEVICE_VIDEO_CAPTURE, _)) 211 EXPECT_CALL(*listener_, DevicesEnumerated(MEDIA_DEVICE_VIDEO_CAPTURE, _))
185 .WillOnce(SaveArg<1>(&devices)); 212 .WillOnce(SaveArg<1>(&devices));
186 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _)); 213 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _));
187 EXPECT_CALL(*listener_, Aborted(MEDIA_DEVICE_VIDEO_CAPTURE, _)); 214 EXPECT_CALL(*listener_, Aborted(MEDIA_DEVICE_VIDEO_CAPTURE, _));
188 215
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 510
484 // Wait to check callbacks before removing the listener 511 // Wait to check callbacks before removing the listener
485 message_loop_->RunUntilIdle(); 512 message_loop_->RunUntilIdle();
486 vcm_->Unregister(); 513 vcm_->Unregister();
487 } 514 }
488 515
489 // TODO(mcasas): Add a test to check consolidation of the supported formats 516 // TODO(mcasas): Add a test to check consolidation of the supported formats
490 // provided by the device when http://crbug.com/323913 is closed. 517 // provided by the device when http://crbug.com/323913 is closed.
491 518
492 } // namespace content 519 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/video_capture_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698