7 Commits

Author SHA1 Message Date
zijiehe
e083909f85 Remove evil defines out of shared_x_display.h
This is a trivial but dangerous change to remove X11/Xlib.h out of
shared_x_display.h. Since we do not have a strict and automatically
Include-What-You-Use rule, I cannot quite tell whether any Chromium source files
wrongly assume X11/Xlib.h will be included through shared_x_display.h. We can
fix the breaks in Chromium after this change has been failed to integrate to
Chromium.

BUG=webrtc:6513

Review-Url: https://codereview.webrtc.org/2482963003
Cr-Commit-Position: refs/heads/master@{#14987}
2016-11-08 20:47:19 +00:00
zijiehe
6be0a657c5 Move ScreenCapturer 'real' tests out of screen_capturer_unittest.cc.
This is a trivial change, I just cutted and pasted part of the code in
screen_capturer_unittest.cc to screen_capturer_integration_test.cc, removed
DISABLED_ prefixes, and updated build file.

BUG=webrtc:6366

Review-Url: https://codereview.webrtc.org/2444583002
Cr-Commit-Position: refs/heads/master@{#14806}
2016-10-27 23:50:43 +00:00
zijiehe
6a4607e100 Deflaky ScreenCapturerTest
ScreenCapturer tests may fail on trybot, so this change is to fix the issue.

Changes include,
1. Sometimes, a capturer may capture part of the change, i.e. usually the draw
actions are not atomic. So the updated_region may be inaccurate. So I have added
a MayDrawIncompleteShapes() function in ScreenDrawer. If it returns false, the
updated_region check will be ignored.
2. Several test cases may run concurrently, which makes one ScreenDrawer won't
really work. Its window may be covered by another ScreenDrawer. So I have added
a system wide lock to ensure only one ScreenDrawer is working at a certain time.
3. On unity (Linux), the top several pixels of a window may be covered by a
shadow effect if the window is not focused. So I have added a BringToFront()
function, and call it in WaitForPendingDraws().
4. On Windows, the drawn shapes are 'temporary drawing', which will be erased
once the window is covered by another one. So I repeat DrawRectangle() function
call in the test case.

TODO(zijiehe): The DISABLED_ prefixes will be added back after the code review.
And I will move these test cases into modules_test in a coming change.

BUG=647067

Review-Url: https://codereview.webrtc.org/2337073007
Cr-Commit-Position: refs/heads/master@{#14674}
2016-10-19 01:22:25 +00:00
zijiehe
0f49daccbe Reland of [WebRTC] A real ScreenCapturer test (patchset #1 id:1 of https://codereview.webrtc.org/2310953002/ )
Reason for revert:
Resubmit capturer tests

Original issue's description:
> Revert of [WebRTC] A real ScreenCapturer test (patchset #8 id:240001 of https://codereview.webrtc.org/2268093002/ )
>
> Reason for revert:
> ScreenCapturerTest.CaptureUpdatedRegion fails on Win DrMemory Full.
>
> Original issue's description:
> > [WebRTC] A real ScreenCapturer test
> >
> > We do not have a real ScreenCapturer test before. And after CL 2210443002, a new
> > ScreenDrawer interface is added to the code base to draw various shapes on the
> > screen. This change is to use ScreenDrawer to test ScreenCapturer. Besides test
> > cases, some other changes are included,
> >
> > 1. A WaitForPendingPaintings() function in ScreenDrawer, to wait for a
> > ScreenDrawer to finish all the pending draws. This function now only sleeps 50
> > milliseconds on X11 and 100 milliseconds on Windows.
> >
> > 2. A Color structure to help handle a big-endian or little-endian safe color and
> > provide functions to compare with DesktopFrame::data(). Both ScreenDrawer and
> > DesktopFrameGenerator (in change 2202443002) can use this class to create colors
> > and compare with or paint to a DesktopFrame.
> >
> > 3. ScreenDrawer now uses Color structure instead of uint32_t.
> >
> > BUG=314516
> >
> > TBR=kjellander@chromium.org
> >
> > Committed: https://crrev.com/9d1c54ace0dc9f68da0152aa1ded2a8dba0a43ae
> > Cr-Commit-Position: refs/heads/master@{#14058}
>
> TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,zijiehe@chromium.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=314516
>
> Committed: https://crrev.com/4c44202dc348613695a4b529bbd7c9bdab6195ec
> Cr-Commit-Position: refs/heads/master@{#14071}

TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,asapersson@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=644130

Review-Url: https://codereview.webrtc.org/2313653003
Cr-Commit-Position: refs/heads/master@{#14113}
2016-09-07 18:52:28 +00:00
asapersson
4c44202dc3 Revert of [WebRTC] A real ScreenCapturer test (patchset #8 id:240001 of https://codereview.webrtc.org/2268093002/ )
Reason for revert:
ScreenCapturerTest.CaptureUpdatedRegion fails on Win DrMemory Full.

Original issue's description:
> [WebRTC] A real ScreenCapturer test
>
> We do not have a real ScreenCapturer test before. And after CL 2210443002, a new
> ScreenDrawer interface is added to the code base to draw various shapes on the
> screen. This change is to use ScreenDrawer to test ScreenCapturer. Besides test
> cases, some other changes are included,
>
> 1. A WaitForPendingPaintings() function in ScreenDrawer, to wait for a
> ScreenDrawer to finish all the pending draws. This function now only sleeps 50
> milliseconds on X11 and 100 milliseconds on Windows.
>
> 2. A Color structure to help handle a big-endian or little-endian safe color and
> provide functions to compare with DesktopFrame::data(). Both ScreenDrawer and
> DesktopFrameGenerator (in change 2202443002) can use this class to create colors
> and compare with or paint to a DesktopFrame.
>
> 3. ScreenDrawer now uses Color structure instead of uint32_t.
>
> BUG=314516
>
> TBR=kjellander@chromium.org
>
> Committed: https://crrev.com/9d1c54ace0dc9f68da0152aa1ded2a8dba0a43ae
> Cr-Commit-Position: refs/heads/master@{#14058}

TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,zijiehe@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=314516

Review-Url: https://codereview.webrtc.org/2310953002
Cr-Commit-Position: refs/heads/master@{#14071}
2016-09-05 13:55:26 +00:00
zijiehe
9d1c54ace0 [WebRTC] A real ScreenCapturer test
We do not have a real ScreenCapturer test before. And after CL 2210443002, a new
ScreenDrawer interface is added to the code base to draw various shapes on the
screen. This change is to use ScreenDrawer to test ScreenCapturer. Besides test
cases, some other changes are included,

1. A WaitForPendingPaintings() function in ScreenDrawer, to wait for a
ScreenDrawer to finish all the pending draws. This function now only sleeps 50
milliseconds on X11 and 100 milliseconds on Windows.

2. A Color structure to help handle a big-endian or little-endian safe color and
provide functions to compare with DesktopFrame::data(). Both ScreenDrawer and
DesktopFrameGenerator (in change 2202443002) can use this class to create colors
and compare with or paint to a DesktopFrame.

3. ScreenDrawer now uses Color structure instead of uint32_t.

BUG=314516

TBR=kjellander@chromium.org

Review-Url: https://codereview.webrtc.org/2268093002
Cr-Commit-Position: refs/heads/master@{#14058}
2016-09-03 02:10:42 +00:00
zijiehe
49c01d7f34 Currently there is not way to programmically test whether a ScreenCapturer
implementation can accurately capture updated regions. Especially in
ScreenCapturerWinDirectx, which has a specific updated region spreading logic
and cannot be tested through regular code path. So we need a controllable
ScreenDrawer to draw some basic shapes on the screen. And a platform independent
test case can use the ScreenDrawer to test a ScreenCapturer.

So this change addes a ScreenDrawer virtual class, and its Windows
implementation ScreenDrawerWin. A disabled gtest ScreenDrawerTest.DrawRectangles
is also added to manually test whether ScreenDrawer can work on a certain
platform.

BUG=314516

TBR=kjellander@webrtc.org

Review-Url: https://codereview.webrtc.org/2210443002
Cr-Commit-Position: refs/heads/master@{#13788}
2016-08-17 00:34:00 +00:00