Commit 452d6fdd authored by perkj@chromium.org's avatar perkj@chromium.org

Add test for sending square resolution video on a PeerConnection.

Adds expectations for video resolution output on all tests that use peerconnection-call.html call.

BUG= 350538

Review URL: https://codereview.chromium.org/214663004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260179 0039d316-1c4b-4281-b951-d872f2087c98
parent 42e7514f
...@@ -64,15 +64,23 @@ INSTANTIATE_TEST_CASE_P(WebRtcBrowserTests, ...@@ -64,15 +64,23 @@ INSTANTIATE_TEST_CASE_P(WebRtcBrowserTests,
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
// Timing out on ARM linux bot: http://crbug.com/238490 // Timing out on ARM linux bot: http://crbug.com/238490
#define MAYBE_CanSetupVideoCall DISABLED_CanSetupVideoCall #define MAYBE_CanSetupDefaultVideoCall DISABLED_CanSetupDefaultVideoCall
#else #else
#define MAYBE_CanSetupVideoCall CanSetupVideoCall #define MAYBE_CanSetupDefaultVideoCall CanSetupDefaultVideoCall
#endif #endif
// These tests will make a complete PeerConnection-based call and verify that // These tests will make a complete PeerConnection-based call and verify that
// video is playing for the call. // video is playing for the call.
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MAYBE_CanSetupVideoCall) { IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MAYBE_CanSetupDefaultVideoCall) {
MakeTypicalPeerConnectionCall("call({video: true});"); MakeTypicalPeerConnectionCall(
"callAndExpectResolution({video: true}, 640, 480);");
}
IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, CanSetupVideoCallWith1To1AspecRatio) {
const std::string javascript =
"callAndExpectResolution({video: {mandatory: {minWidth: 320,"
" maxWidth: 320, minHeight: 320, maxHeight: 320}}}, 320, 320);";
MakeTypicalPeerConnectionCall(javascript);
} }
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
......
...@@ -63,6 +63,23 @@ ...@@ -63,6 +63,23 @@
waitForVideo('remote-view-2'); waitForVideo('remote-view-2');
} }
// Test that we can setup call with an audio and video track and check that
// the video resolution is as expected.
function callAndExpectResolution(constraints,
expected_width,
expected_height) {
createConnections(null);
navigator.webkitGetUserMedia(constraints,
addStreamToBothConnectionsAndNegotiate, printGetUserMediaError);
waitForVideoWithResolution('remote-view-1',
expected_width,
expected_height);
waitForVideoWithResolution('remote-view-2',
expected_width,
expected_height);
}
// First calls without streams on any connections, and then adds a stream // First calls without streams on any connections, and then adds a stream
// to peer connection 1 which gets sent to peer connection 2. We must wait // to peer connection 1 which gets sent to peer connection 2. We must wait
// for the first negotiation to complete before starting the second one, which // for the first negotiation to complete before starting the second one, which
......
...@@ -72,12 +72,22 @@ function detectVideo(videoElementName, predicate, callback) { ...@@ -72,12 +72,22 @@ function detectVideo(videoElementName, predicate, callback) {
predicate(pixels, oldPixels)) { predicate(pixels, oldPixels)) {
console.log('Done looking at video in element ' + videoElementName); console.log('Done looking at video in element ' + videoElementName);
clearInterval(waitVideo); clearInterval(waitVideo);
callback(); callback(videoElement.videoWidth, videoElement.videoHeight);
} }
oldPixels = pixels; oldPixels = pixels;
}, 200); }, 200);
} }
function waitForVideoWithResolution(element, expected_width, expected_height) {
addExpectedEvent();
detectVideoPlaying(element,
function (width, height) {
assertEquals(expected_width, width);
assertEquals(expected_height, height);
eventOccured();
});
}
function waitForVideo(videoElement) { function waitForVideo(videoElement) {
addExpectedEvent(); addExpectedEvent();
detectVideoPlaying(videoElement, function () { eventOccured(); }); detectVideoPlaying(videoElement, function () { eventOccured(); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment