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

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

Issue 22876027: Consolidate duplicated frame / capability structures in video_capture_types.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased: changed media::VideoCaptureCapability::kI420 -> media::PIXEL_FORMAT_I420 etc. Created 7 years, 3 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
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 // Wait to get device callback. 107 // Wait to get device callback.
108 message_loop_->RunUntilIdle(); 108 message_loop_->RunUntilIdle();
109 109
110 int video_session_id = vcm_->Open(devices.front()); 110 int video_session_id = vcm_->Open(devices.front());
111 111
112 media::VideoCaptureParams capture_params; 112 media::VideoCaptureParams capture_params;
113 capture_params.session_id = video_session_id; 113 capture_params.session_id = video_session_id;
114 capture_params.width = 320; 114 capture_params.width = 320;
115 capture_params.height = 240; 115 capture_params.height = 240;
116 capture_params.frame_per_second = 30; 116 capture_params.frame_rate = 30;
117 vcm_->Start(capture_params, frame_observer_.get()); 117 vcm_->Start(capture_params, frame_observer_.get());
118 118
119 vcm_->Stop(video_session_id, base::Closure()); 119 vcm_->Stop(video_session_id, base::Closure());
120 vcm_->Close(video_session_id); 120 vcm_->Close(video_session_id);
121 121
122 // Wait to check callbacks before removing the listener. 122 // Wait to check callbacks before removing the listener.
123 message_loop_->RunUntilIdle(); 123 message_loop_->RunUntilIdle();
124 vcm_->Unregister(); 124 vcm_->Unregister();
125 } 125 }
126 126
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 // Start a device using "magic" id, i.e. call Start without calling Open. 215 // Start a device using "magic" id, i.e. call Start without calling Open.
216 TEST_F(VideoCaptureManagerTest, StartUsingId) { 216 TEST_F(VideoCaptureManagerTest, StartUsingId) {
217 InSequence s; 217 InSequence s;
218 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _)).Times(1); 218 EXPECT_CALL(*listener_, Opened(MEDIA_DEVICE_VIDEO_CAPTURE, _)).Times(1);
219 EXPECT_CALL(*listener_, Closed(MEDIA_DEVICE_VIDEO_CAPTURE, _)).Times(1); 219 EXPECT_CALL(*listener_, Closed(MEDIA_DEVICE_VIDEO_CAPTURE, _)).Times(1);
220 220
221 media::VideoCaptureParams capture_params; 221 media::VideoCaptureParams capture_params;
222 capture_params.session_id = VideoCaptureManager::kStartOpenSessionId; 222 capture_params.session_id = VideoCaptureManager::kStartOpenSessionId;
223 capture_params.width = 320; 223 capture_params.width = 320;
224 capture_params.height = 240; 224 capture_params.height = 240;
225 capture_params.frame_per_second = 30; 225 capture_params.frame_rate = 30;
226 226
227 // Start shall trigger the Open callback. 227 // Start shall trigger the Open callback.
228 vcm_->Start(capture_params, frame_observer_.get()); 228 vcm_->Start(capture_params, frame_observer_.get());
229 229
230 // Stop shall trigger the Close callback 230 // Stop shall trigger the Close callback
231 vcm_->Stop(VideoCaptureManager::kStartOpenSessionId, base::Closure()); 231 vcm_->Stop(VideoCaptureManager::kStartOpenSessionId, base::Closure());
232 232
233 // Wait to check callbacks before removing the listener. 233 // Wait to check callbacks before removing the listener.
234 message_loop_->RunUntilIdle(); 234 message_loop_->RunUntilIdle();
235 vcm_->Unregister(); 235 vcm_->Unregister();
(...skipping 13 matching lines...) Expand all
249 249
250 // Wait to get device callback. 250 // Wait to get device callback.
251 message_loop_->RunUntilIdle(); 251 message_loop_->RunUntilIdle();
252 252
253 int video_session_id = vcm_->Open(devices.front()); 253 int video_session_id = vcm_->Open(devices.front());
254 254
255 media::VideoCaptureParams capture_params; 255 media::VideoCaptureParams capture_params;
256 capture_params.session_id = video_session_id; 256 capture_params.session_id = video_session_id;
257 capture_params.width = 320; 257 capture_params.width = 320;
258 capture_params.height = 240; 258 capture_params.height = 240;
259 capture_params.frame_per_second = 30; 259 capture_params.frame_rate = 30;
260 vcm_->Start(capture_params, frame_observer_.get()); 260 vcm_->Start(capture_params, frame_observer_.get());
261 261
262 // Close will stop the running device, an assert will be triggered in 262 // Close will stop the running device, an assert will be triggered in
263 // VideoCaptureManager destructor otherwise. 263 // VideoCaptureManager destructor otherwise.
264 vcm_->Close(video_session_id); 264 vcm_->Close(video_session_id);
265 vcm_->Stop(video_session_id, base::Closure()); 265 vcm_->Stop(video_session_id, base::Closure());
266 266
267 // Wait to check callbacks before removing the listener 267 // Wait to check callbacks before removing the listener
268 message_loop_->RunUntilIdle(); 268 message_loop_->RunUntilIdle();
269 vcm_->Unregister(); 269 vcm_->Unregister();
270 } 270 }
271 271
272 } // namespace content 272 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698