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

Side by Side Diff: webrtc/modules/desktop_capture/screen_capturer_integration_test.cc

Issue 2559583002: Enable screen capturer tests for Linux / DirectX capturer / magnifier capturer (Closed)
Patch Set: Created 4 years 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 | « no previous file | 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 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 24 matching lines...) Expand all
35 #include "webrtc/base/win32.h" 35 #include "webrtc/base/win32.h"
36 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h" 36 #include "webrtc/modules/desktop_capture/win/screen_capturer_win_directx.h"
37 #endif // defined(WEBRTC_WIN) 37 #endif // defined(WEBRTC_WIN)
38 38
39 using ::testing::_; 39 using ::testing::_;
40 40
41 namespace webrtc { 41 namespace webrtc {
42 42
43 namespace { 43 namespace {
44 44
45 ACTION_P(SaveUniquePtrArg, dest) { 45 ACTION_P2(SaveCaptureResult, result, dest) {
46 *result = arg0;
46 *dest = std::move(*arg1); 47 *dest = std::move(*arg1);
47 } 48 }
48 49
49 // Returns true if color in |rect| of |frame| is |color|. 50 // Returns true if color in |rect| of |frame| is |color|.
50 bool ArePixelsColoredBy(const DesktopFrame& frame, 51 bool ArePixelsColoredBy(const DesktopFrame& frame,
51 DesktopRect rect, 52 DesktopRect rect,
52 RgbaColor color, 53 RgbaColor color,
53 bool may_partially_draw) { 54 bool may_partially_draw) {
54 if (!may_partially_draw) { 55 if (!may_partially_draw) {
55 // updated_region() should cover the painted area. 56 // updated_region() should cover the painted area.
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 if (succeeded_capturers == capturers.size()) { 260 if (succeeded_capturers == capturers.size()) {
260 break; 261 break;
261 } 262 }
262 } 263 }
263 264
264 ASSERT_EQ(succeeded_capturers, capturers.size()); 265 ASSERT_EQ(succeeded_capturers, capturers.size());
265 } 266 }
266 267
267 // Expects |capturer| to successfully capture a frame, and returns it. 268 // Expects |capturer| to successfully capture a frame, and returns it.
268 std::unique_ptr<DesktopFrame> CaptureFrame(DesktopCapturer* capturer) { 269 std::unique_ptr<DesktopFrame> CaptureFrame(DesktopCapturer* capturer) {
269 std::unique_ptr<DesktopFrame> frame; 270 for (int i = 0; i < 10; i++) {
270 EXPECT_CALL(callback_, 271 std::unique_ptr<DesktopFrame> frame;
271 OnCaptureResultPtr(DesktopCapturer::Result::SUCCESS, _)) 272 DesktopCapturer::Result result;
272 .WillOnce(SaveUniquePtrArg(&frame)); 273 EXPECT_CALL(callback_, OnCaptureResultPtr(_, _))
273 capturer->CaptureFrame(); 274 .WillOnce(SaveCaptureResult(&result, &frame));
274 EXPECT_TRUE(frame); 275 capturer->CaptureFrame();
275 return frame; 276 if (result == DesktopCapturer::Result::SUCCESS) {
Sergey Ulanov 2016/12/07 19:45:05 Verify that the callback was called, e.g. by calli
Hzj_jie 2016/12/07 20:09:30 Done.
277 EXPECT_TRUE(frame);
278 return frame;
279 } else {
280 EXPECT_FALSE(frame);
281 }
282 }
283
284 EXPECT_TRUE(false);
285 return nullptr;
276 } 286 }
277 }; 287 };
278 288
279 #if defined(WEBRTC_WIN) 289 TEST_F(ScreenCapturerIntegrationTest, CaptureUpdatedRegion) {
280 #define MAYBE_CaptureUpdatedRegion DISABLED_CaptureUpdatedRegion 290 #if !defined(WEBRTC_WIN)
281 #else 291 // ScreenCapturerWinGdi randomly returns blank screen, the root cause is still
282 #define MAYBE_CaptureUpdatedRegion CaptureUpdatedRegion 292 // unknown. Bug, https://bugs.chromium.org/p/webrtc/issues/detail?id=6843.
293 TestCaptureUpdatedRegion();
283 #endif 294 #endif
284 TEST_F(ScreenCapturerIntegrationTest, MAYBE_CaptureUpdatedRegion) {
285 TestCaptureUpdatedRegion();
286 } 295 }
287 296
288 #if defined(WEBRTC_WIN) 297 TEST_F(ScreenCapturerIntegrationTest, TwoCapturers) {
289 #define MAYBE_TwoCapturers DISABLED_TwoCapturers 298 #if !defined(WEBRTC_WIN)
290 #else 299 // ScreenCapturerWinGdi randomly returns blank screen, the root cause is still
291 #define MAYBE_TwoCapturers TwoCapturers 300 // unknown. Bug, https://bugs.chromium.org/p/webrtc/issues/detail?id=6843.
292 #endif
293 TEST_F(ScreenCapturerIntegrationTest, MAYBE_TwoCapturers) {
294 std::unique_ptr<DesktopCapturer> capturer2 = std::move(capturer_); 301 std::unique_ptr<DesktopCapturer> capturer2 = std::move(capturer_);
295 SetUp(); 302 SetUp();
296 TestCaptureUpdatedRegion({capturer_.get(), capturer2.get()}); 303 TestCaptureUpdatedRegion({capturer_.get(), capturer2.get()});
304 #endif
297 } 305 }
298 306
299 #if defined(WEBRTC_WIN) 307 #if defined(WEBRTC_WIN)
300 308
301 TEST_F(ScreenCapturerIntegrationTest, 309 TEST_F(ScreenCapturerIntegrationTest, CaptureUpdatedRegionWithDirectxCapturer) {
302 DISABLED_CaptureUpdatedRegionWithDirectxCapturer) {
303 if (!CreateDirectxCapturer()) { 310 if (!CreateDirectxCapturer()) {
304 return; 311 return;
305 } 312 }
306 313
307 TestCaptureUpdatedRegion(); 314 TestCaptureUpdatedRegion();
308 } 315 }
309 316
310 TEST_F(ScreenCapturerIntegrationTest, DISABLED_TwoDirectxCapturers) { 317 TEST_F(ScreenCapturerIntegrationTest, TwoDirectxCapturers) {
311 if (!CreateDirectxCapturer()) { 318 if (!CreateDirectxCapturer()) {
312 return; 319 return;
313 } 320 }
314 321
315 std::unique_ptr<DesktopCapturer> capturer2 = std::move(capturer_); 322 std::unique_ptr<DesktopCapturer> capturer2 = std::move(capturer_);
316 RTC_CHECK(CreateDirectxCapturer()); 323 RTC_CHECK(CreateDirectxCapturer());
317 TestCaptureUpdatedRegion({capturer_.get(), capturer2.get()}); 324 TestCaptureUpdatedRegion({capturer_.get(), capturer2.get()});
318 } 325 }
319 326
320 TEST_F(ScreenCapturerIntegrationTest, 327 TEST_F(ScreenCapturerIntegrationTest,
321 DISABLED_CaptureUpdatedRegionWithMagnifierCapturer) { 328 CaptureUpdatedRegionWithMagnifierCapturer) {
322 // On Windows 8 or later, magnifier APIs return a frame with a border on test 329 // On Windows 8 or later, magnifier APIs return a frame with a border on test
323 // environment, so disable these tests. 330 // environment, so disable these tests.
324 // Bug https://bugs.chromium.org/p/webrtc/issues/detail?id=6666 331 // Bug https://bugs.chromium.org/p/webrtc/issues/detail?id=6844
325 // TODO(zijiehe): Find the root cause of the border and failure, which cannot 332 // TODO(zijiehe): Find the root cause of the border and failure, which cannot
326 // reproduce on my dev machine. 333 // reproduce on my dev machine.
327 if (rtc::IsWindows8OrLater()) { 334 if (rtc::IsWindows8OrLater()) {
328 return; 335 return;
329 } 336 }
330 CreateMagnifierCapturer(); 337 CreateMagnifierCapturer();
331 TestCaptureUpdatedRegion(); 338 TestCaptureUpdatedRegion();
332 } 339 }
333 340
334 TEST_F(ScreenCapturerIntegrationTest, DISABLED_TwoMagnifierCapturers) { 341 TEST_F(ScreenCapturerIntegrationTest, TwoMagnifierCapturers) {
335 // On Windows 8 or later, magnifier APIs return a frame with a border on test 342 // On Windows 8 or later, magnifier APIs return a frame with a border on test
336 // environment, so disable these tests. 343 // environment, so disable these tests.
337 // Bug https://bugs.chromium.org/p/webrtc/issues/detail?id=6666 344 // Bug https://bugs.chromium.org/p/webrtc/issues/detail?id=6844
338 // TODO(zijiehe): Find the root cause of the border and failure, which cannot 345 // TODO(zijiehe): Find the root cause of the border and failure, which cannot
339 // reproduce on my dev machine. 346 // reproduce on my dev machine.
340 if (rtc::IsWindows8OrLater()) { 347 if (rtc::IsWindows8OrLater()) {
341 return; 348 return;
342 } 349 }
343 CreateMagnifierCapturer(); 350 CreateMagnifierCapturer();
344 std::unique_ptr<DesktopCapturer> capturer2 = std::move(capturer_); 351 std::unique_ptr<DesktopCapturer> capturer2 = std::move(capturer_);
345 CreateMagnifierCapturer(); 352 CreateMagnifierCapturer();
346 TestCaptureUpdatedRegion({capturer_.get(), capturer2.get()}); 353 TestCaptureUpdatedRegion({capturer_.get(), capturer2.get()});
347 } 354 }
348 355
349 TEST_F(ScreenCapturerIntegrationTest, 356 TEST_F(ScreenCapturerIntegrationTest,
350 DISABLED_MaybeCaptureUpdatedRegionWithDirectxCapturer) { 357 MaybeCaptureUpdatedRegionWithDirectxCapturer) {
358 if (!rtc::IsWindows8OrLater()) {
359 // ScreenCapturerWinGdi randomly returns blank screen, the root cause is
360 // still unknown. Bug,
361 // https://bugs.chromium.org/p/webrtc/issues/detail?id=6843.
362 // On Windows 7 or early version, MaybeCreateDirectxCapturer() always
363 // creates GDI capturer.
364 return;
365 }
351 // Even DirectX capturer is not supported in current system, we should be able 366 // Even DirectX capturer is not supported in current system, we should be able
352 // to select a usable capturer. 367 // to select a usable capturer.
353 MaybeCreateDirectxCapturer(); 368 MaybeCreateDirectxCapturer();
354 TestCaptureUpdatedRegion(); 369 TestCaptureUpdatedRegion();
355 } 370 }
356 371
357 #endif // defined(WEBRTC_WIN) 372 #endif // defined(WEBRTC_WIN)
358 373
359 } // namespace webrtc 374 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698