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

Side by Side Diff: content/browser/media/capture/desktop_capture_device_unittest.cc

Issue 663563002: Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/browser/media/capture/desktop_capture_device.h" 5 #include "content/browser/media/capture/desktop_capture_device.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 EXPECT_CALL(*client, OnError(_)).Times(0); 168 EXPECT_CALL(*client, OnError(_)).Times(0);
169 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _)).WillRepeatedly( 169 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _)).WillRepeatedly(
170 DoAll(SaveArg<1>(&frame_size), 170 DoAll(SaveArg<1>(&frame_size),
171 SaveArg<2>(&format), 171 SaveArg<2>(&format),
172 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal))); 172 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal)));
173 173
174 media::VideoCaptureParams capture_params; 174 media::VideoCaptureParams capture_params;
175 capture_params.requested_format.frame_size.SetSize(640, 480); 175 capture_params.requested_format.frame_size.SetSize(640, 480);
176 capture_params.requested_format.frame_rate = kFrameRate; 176 capture_params.requested_format.frame_rate = kFrameRate;
177 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; 177 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
178 capture_device_->AllocateAndStart( 178 capture_device_->AllocateAndStart(capture_params, client.Pass());
179 capture_params, client.PassAs<media::VideoCaptureDevice::Client>());
180 EXPECT_TRUE(done_event.TimedWait(TestTimeouts::action_max_timeout())); 179 EXPECT_TRUE(done_event.TimedWait(TestTimeouts::action_max_timeout()));
181 capture_device_->StopAndDeAllocate(); 180 capture_device_->StopAndDeAllocate();
182 181
183 EXPECT_GT(format.frame_size.width(), 0); 182 EXPECT_GT(format.frame_size.width(), 0);
184 EXPECT_GT(format.frame_size.height(), 0); 183 EXPECT_GT(format.frame_size.height(), 0);
185 EXPECT_EQ(kFrameRate, format.frame_rate); 184 EXPECT_EQ(kFrameRate, format.frame_rate);
186 EXPECT_EQ(media::PIXEL_FORMAT_ARGB, format.pixel_format); 185 EXPECT_EQ(media::PIXEL_FORMAT_ARGB, format.pixel_format);
187 186
188 EXPECT_EQ(format.frame_size.GetArea() * 4, frame_size); 187 EXPECT_EQ(format.frame_size.GetArea() * 4, frame_size);
189 } 188 }
(...skipping 15 matching lines...) Expand all
205 DoAll(SaveArg<1>(&frame_size), 204 DoAll(SaveArg<1>(&frame_size),
206 SaveArg<2>(&format), 205 SaveArg<2>(&format),
207 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal))); 206 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal)));
208 207
209 media::VideoCaptureParams capture_params; 208 media::VideoCaptureParams capture_params;
210 capture_params.requested_format.frame_size.SetSize(kTestFrameWidth1, 209 capture_params.requested_format.frame_size.SetSize(kTestFrameWidth1,
211 kTestFrameHeight1); 210 kTestFrameHeight1);
212 capture_params.requested_format.frame_rate = kFrameRate; 211 capture_params.requested_format.frame_rate = kFrameRate;
213 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; 212 capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420;
214 213
215 capture_device_->AllocateAndStart( 214 capture_device_->AllocateAndStart(capture_params, client.Pass());
216 capture_params, client.PassAs<media::VideoCaptureDevice::Client>());
217 215
218 // Capture at least two frames, to ensure that the source frame size has 216 // Capture at least two frames, to ensure that the source frame size has
219 // changed while capturing. 217 // changed while capturing.
220 EXPECT_TRUE(done_event.TimedWait(TestTimeouts::action_max_timeout())); 218 EXPECT_TRUE(done_event.TimedWait(TestTimeouts::action_max_timeout()));
221 done_event.Reset(); 219 done_event.Reset();
222 EXPECT_TRUE(done_event.TimedWait(TestTimeouts::action_max_timeout())); 220 EXPECT_TRUE(done_event.TimedWait(TestTimeouts::action_max_timeout()));
223 221
224 capture_device_->StopAndDeAllocate(); 222 capture_device_->StopAndDeAllocate();
225 223
226 EXPECT_EQ(kTestFrameWidth1, format.frame_size.width()); 224 EXPECT_EQ(kTestFrameWidth1, format.frame_size.width());
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 264
267 capture_device_->StopAndDeAllocate(); 265 capture_device_->StopAndDeAllocate();
268 266
269 EXPECT_EQ(kTestFrameWidth1, format.frame_size.width()); 267 EXPECT_EQ(kTestFrameWidth1, format.frame_size.width());
270 EXPECT_EQ(kTestFrameHeight1, format.frame_size.height()); 268 EXPECT_EQ(kTestFrameHeight1, format.frame_size.height());
271 EXPECT_EQ(kFrameRate, format.frame_rate); 269 EXPECT_EQ(kFrameRate, format.frame_rate);
272 EXPECT_EQ(media::PIXEL_FORMAT_ARGB, format.pixel_format); 270 EXPECT_EQ(media::PIXEL_FORMAT_ARGB, format.pixel_format);
273 } 271 }
274 272
275 } // namespace content 273 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698