diff options
-rw-r--r-- | content/browser/media/webrtc_browsertest.cc | 16 | ||||
-rw-r--r-- | content/test/data/media/peerconnection-call.html | 17 | ||||
-rw-r--r-- | content/test/data/media/webrtc_test_utilities.js | 12 |
3 files changed, 40 insertions, 5 deletions
diff --git a/content/browser/media/webrtc_browsertest.cc b/content/browser/media/webrtc_browsertest.cc index cec4227..8bda016 100644 --- a/content/browser/media/webrtc_browsertest.cc +++ b/content/browser/media/webrtc_browsertest.cc @@ -64,15 +64,23 @@ INSTANTIATE_TEST_CASE_P(WebRtcBrowserTests, #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) // Timing out on ARM linux bot: http://crbug.com/238490 -#define MAYBE_CanSetupVideoCall DISABLED_CanSetupVideoCall +#define MAYBE_CanSetupDefaultVideoCall DISABLED_CanSetupDefaultVideoCall #else -#define MAYBE_CanSetupVideoCall CanSetupVideoCall +#define MAYBE_CanSetupDefaultVideoCall CanSetupDefaultVideoCall #endif // These tests will make a complete PeerConnection-based call and verify that // video is playing for the call. -IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MAYBE_CanSetupVideoCall) { - MakeTypicalPeerConnectionCall("call({video: true});"); +IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest, MAYBE_CanSetupDefaultVideoCall) { + 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) diff --git a/content/test/data/media/peerconnection-call.html b/content/test/data/media/peerconnection-call.html index 29a23b8..2327647 100644 --- a/content/test/data/media/peerconnection-call.html +++ b/content/test/data/media/peerconnection-call.html @@ -63,6 +63,23 @@ 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 // 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 diff --git a/content/test/data/media/webrtc_test_utilities.js b/content/test/data/media/webrtc_test_utilities.js index c56953f..644a812 100644 --- a/content/test/data/media/webrtc_test_utilities.js +++ b/content/test/data/media/webrtc_test_utilities.js @@ -72,12 +72,22 @@ function detectVideo(videoElementName, predicate, callback) { predicate(pixels, oldPixels)) { console.log('Done looking at video in element ' + videoElementName); clearInterval(waitVideo); - callback(); + callback(videoElement.videoWidth, videoElement.videoHeight); } oldPixels = pixels; }, 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) { addExpectedEvent(); detectVideoPlaying(videoElement, function () { eventOccured(); }); |