Skip to content

Commit

Permalink
Image Capture: enable content_browsertests in Linux/CrOs,
Browse files Browse the repository at this point in the history
This CL updates getUserMedia() constraint syntax, which
I suspect is part of the reason why sometimes these tests
have timed out (if the video resolution is too large, it
may very well jam the bot).

With that small update this CL enables the tests for
CrOs/Linux.

BUG=656810

Review-Url: https://codereview.chromium.org/2456193004
Cr-Commit-Position: refs/heads/master@{#428433}
  • Loading branch information
yellowdoge authored and Commit bot committed Oct 28, 2016
1 parent e5c0713 commit 92ebdcd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
8 changes: 7 additions & 1 deletion content/browser/webrtc/webrtc_image_capture_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ static const char kImageCaptureHtmlFile[] = "/media/image_capture_test.html";
// platforms where the ImageCaptureCode is landed, https://crbug.com/656810
static struct TargetCamera {
bool use_fake;
} const kTestParameters[] = {{true}};
} const kTestParameters[] = {
{true},
#if !defined(OS_LINUX)
{false}
#endif
};

} // namespace

Expand Down Expand Up @@ -100,6 +105,7 @@ class WebRtcImageCaptureBrowserTest
std::string result;
if (!ExecuteScriptAndExtractString(shell(), command, &result))
return false;
DLOG_IF(ERROR, result != "OK") << result;
return result == "OK";
}

Expand Down
23 changes: 5 additions & 18 deletions content/test/data/media/image_capture_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
<body>
<script type="text/javascript" src="webrtc_test_utilities.js"></script>
<script>
const HEIGHT = 180;
const WIDTH = 320;
/** @const */ var CONSTRAINTS = { width: { max : WIDTH } };

// Runs an ImageCapture.getPhotoCapabilities().
function testCreateAndGetCapabilities() {
const constraints = { mandatory: { maxHeight: HEIGHT, maxWidth: WIDTH } };
navigator.mediaDevices.getUserMedia({"video" : constraints})
navigator.mediaDevices.getUserMedia({"video" : CONSTRAINTS})
.then(stream => {
assertEquals('video', stream.getVideoTracks()[0].kind);
return new ImageCapture(stream.getVideoTracks()[0]);
Expand All @@ -21,16 +20,7 @@
return capturer.getPhotoCapabilities();
})
.then(capabilities => {
assertNotEquals(0, capabilities.imageHeight.min);
assertNotEquals(0, capabilities.imageHeight.current);
assertNotEquals(0, capabilities.imageHeight.max);
assertNotEquals(0, capabilities.imageWidth.min);
assertNotEquals(0, capabilities.imageWidth.current);
assertNotEquals(0, capabilities.imageWidth.max);
assertNotEquals(0, capabilities.zoom.min);
assertNotEquals(0, capabilities.zoom.current);
assertNotEquals(0, capabilities.zoom.max);

// There's nothing to check here since |capabilities| vary per device.
reportTestSuccess();
})
.catch(err => {
Expand All @@ -40,8 +30,7 @@

// Runs an ImageCapture.takePhoto().
function testCreateAndTakePhoto() {
const constraints = { mandatory: { maxHeight: HEIGHT, maxWidth: WIDTH } };
navigator.mediaDevices.getUserMedia({"video" : constraints})
navigator.mediaDevices.getUserMedia({"video" : CONSTRAINTS})
.then(stream => {
assertEquals('video', stream.getVideoTracks()[0].kind);
return new ImageCapture(stream.getVideoTracks()[0]);
Expand All @@ -62,8 +51,7 @@

// Runs an ImageCapture.grabFrame().
function testCreateAndGrabFrame() {
const constraints = { mandatory: { maxHeight: HEIGHT, maxWidth: WIDTH } };
navigator.mediaDevices.getUserMedia({"video" : constraints})
navigator.mediaDevices.getUserMedia({"video" : CONSTRAINTS})
.then(stream => {
assertEquals('video', stream.getVideoTracks()[0].kind);
return new ImageCapture(stream.getVideoTracks()[0]);
Expand All @@ -73,7 +61,6 @@
})
.then(imageBitmap => {
assertEquals(WIDTH, imageBitmap.width);
assertEquals(HEIGHT, imageBitmap.height);

reportTestSuccess();
})
Expand Down

0 comments on commit 92ebdcd

Please sign in to comment.