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

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

Issue 252393002: Adds UMA histograms for desktop capture device. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/sequenced_task_runner.h" 8 #include "base/sequenced_task_runner.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 #if defined(USE_OZONE) 150 #if defined(USE_OZONE)
151 #define MAYBE_Capture DISABLED_Capture 151 #define MAYBE_Capture DISABLED_Capture
152 #else 152 #else
153 #define MAYBE_Capture Capture 153 #define MAYBE_Capture Capture
154 #endif 154 #endif
155 TEST_F(DesktopCaptureDeviceTest, MAYBE_Capture) { 155 TEST_F(DesktopCaptureDeviceTest, MAYBE_Capture) {
156 scoped_ptr<webrtc::DesktopCapturer> capturer( 156 scoped_ptr<webrtc::DesktopCapturer> capturer(
157 webrtc::ScreenCapturer::Create()); 157 webrtc::ScreenCapturer::Create());
158 DesktopCaptureDevice capture_device( 158 DesktopCaptureDevice capture_device(
159 worker_pool_->GetSequencedTaskRunner(worker_pool_->GetSequenceToken()), 159 worker_pool_->GetSequencedTaskRunner(worker_pool_->GetSequenceToken()),
160 capturer.Pass()); 160 capturer.Pass(),
161 DesktopMediaID::TYPE_SCREEN);
161 media::VideoCaptureFormat format; 162 media::VideoCaptureFormat format;
162 base::WaitableEvent done_event(false, false); 163 base::WaitableEvent done_event(false, false);
163 int frame_size; 164 int frame_size;
164 165
165 scoped_ptr<MockDeviceClient> client(new MockDeviceClient()); 166 scoped_ptr<MockDeviceClient> client(new MockDeviceClient());
166 EXPECT_CALL(*client, OnError(_)).Times(0); 167 EXPECT_CALL(*client, OnError(_)).Times(0);
167 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _)).WillRepeatedly( 168 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _)).WillRepeatedly(
168 DoAll(SaveArg<1>(&frame_size), 169 DoAll(SaveArg<1>(&frame_size),
169 SaveArg<2>(&format), 170 SaveArg<2>(&format),
170 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal))); 171 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal)));
(...skipping 17 matching lines...) Expand all
188 worker_pool_->FlushForTesting(); 189 worker_pool_->FlushForTesting();
189 } 190 }
190 191
191 // Test that screen capturer behaves correctly if the source frame size changes 192 // Test that screen capturer behaves correctly if the source frame size changes
192 // but the caller cannot cope with variable resolution output. 193 // but the caller cannot cope with variable resolution output.
193 TEST_F(DesktopCaptureDeviceTest, ScreenResolutionChangeConstantResolution) { 194 TEST_F(DesktopCaptureDeviceTest, ScreenResolutionChangeConstantResolution) {
194 FakeScreenCapturer* mock_capturer = new FakeScreenCapturer(); 195 FakeScreenCapturer* mock_capturer = new FakeScreenCapturer();
195 196
196 DesktopCaptureDevice capture_device( 197 DesktopCaptureDevice capture_device(
197 worker_pool_->GetSequencedTaskRunner(worker_pool_->GetSequenceToken()), 198 worker_pool_->GetSequencedTaskRunner(worker_pool_->GetSequenceToken()),
198 scoped_ptr<webrtc::DesktopCapturer>(mock_capturer)); 199 scoped_ptr<webrtc::DesktopCapturer>(mock_capturer),
200 DesktopMediaID::TYPE_SCREEN);
199 201
200 media::VideoCaptureFormat format; 202 media::VideoCaptureFormat format;
201 base::WaitableEvent done_event(false, false); 203 base::WaitableEvent done_event(false, false);
202 int frame_size; 204 int frame_size;
203 205
204 scoped_ptr<MockDeviceClient> client(new MockDeviceClient()); 206 scoped_ptr<MockDeviceClient> client(new MockDeviceClient());
205 EXPECT_CALL(*client, OnError(_)).Times(0); 207 EXPECT_CALL(*client, OnError(_)).Times(0);
206 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _)).WillRepeatedly( 208 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _)).WillRepeatedly(
207 DoAll(SaveArg<1>(&frame_size), 209 DoAll(SaveArg<1>(&frame_size),
208 SaveArg<2>(&format), 210 SaveArg<2>(&format),
(...skipping 26 matching lines...) Expand all
235 worker_pool_->FlushForTesting(); 237 worker_pool_->FlushForTesting();
236 } 238 }
237 239
238 // Test that screen capturer behaves correctly if the source frame size changes 240 // Test that screen capturer behaves correctly if the source frame size changes
239 // and the caller can cope with variable resolution output. 241 // and the caller can cope with variable resolution output.
240 TEST_F(DesktopCaptureDeviceTest, ScreenResolutionChangeVariableResolution) { 242 TEST_F(DesktopCaptureDeviceTest, ScreenResolutionChangeVariableResolution) {
241 FakeScreenCapturer* mock_capturer = new FakeScreenCapturer(); 243 FakeScreenCapturer* mock_capturer = new FakeScreenCapturer();
242 244
243 DesktopCaptureDevice capture_device( 245 DesktopCaptureDevice capture_device(
244 worker_pool_->GetSequencedTaskRunner(worker_pool_->GetSequenceToken()), 246 worker_pool_->GetSequencedTaskRunner(worker_pool_->GetSequenceToken()),
245 scoped_ptr<webrtc::DesktopCapturer>(mock_capturer)); 247 scoped_ptr<webrtc::DesktopCapturer>(mock_capturer),
248 DesktopMediaID::TYPE_SCREEN);
246 249
247 media::VideoCaptureFormat format; 250 media::VideoCaptureFormat format;
248 base::WaitableEvent done_event(false, false); 251 base::WaitableEvent done_event(false, false);
249 252
250 scoped_ptr<MockDeviceClient> client(new MockDeviceClient()); 253 scoped_ptr<MockDeviceClient> client(new MockDeviceClient());
251 EXPECT_CALL(*client, OnError(_)).Times(0); 254 EXPECT_CALL(*client, OnError(_)).Times(0);
252 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _)).WillRepeatedly( 255 EXPECT_CALL(*client, OnIncomingCapturedData(_, _, _, _, _)).WillRepeatedly(
253 DoAll(SaveArg<2>(&format), 256 DoAll(SaveArg<2>(&format),
254 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal))); 257 InvokeWithoutArgs(&done_event, &base::WaitableEvent::Signal)));
255 258
(...skipping 18 matching lines...) Expand all
274 capture_device.StopAndDeAllocate(); 277 capture_device.StopAndDeAllocate();
275 278
276 EXPECT_EQ(kTestFrameWidth1, format.frame_size.width()); 279 EXPECT_EQ(kTestFrameWidth1, format.frame_size.width());
277 EXPECT_EQ(kTestFrameHeight1, format.frame_size.height()); 280 EXPECT_EQ(kTestFrameHeight1, format.frame_size.height());
278 EXPECT_EQ(kFrameRate, format.frame_rate); 281 EXPECT_EQ(kFrameRate, format.frame_rate);
279 EXPECT_EQ(media::PIXEL_FORMAT_ARGB, format.pixel_format); 282 EXPECT_EQ(media::PIXEL_FORMAT_ARGB, format.pixel_format);
280 worker_pool_->FlushForTesting(); 283 worker_pool_->FlushForTesting();
281 } 284 }
282 285
283 } // namespace content 286 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/capture/desktop_capture_device_uma_types.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698