Commit a3cde697 authored by perkj's avatar perkj Committed by Commit bot

Refactored the test WebRtcBrowserTest.CanForwardRemoteStream

This test now only use 2 peerconnections. Furthermore, it only creates one mediastream that is sent from pc1 to pc2. When the stream is playing on pc2, it is cloned and sent back to pc1. The purpose of this refactoring is no reduce the CPU requirement and the number of streams sent to fix flakiness problems.

This cl removes the test CanForwardRemoteStream720 since it test the same thing as CanForwardRemoteStream but with a higher video resolution.

BUG=469819

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

Cr-Commit-Position: refs/heads/master@{#322362}
parent 55260270
......@@ -201,22 +201,11 @@ IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest,
kUseLenientAudioChecking));
}
// Below 2 test will make a complete PeerConnection-based call between pc1 and
// pc2, and then use the remote stream to setup a call between pc3 and pc4, and
// then verify that video is received on pc3 and pc4.
// The stream sent from pc3 to pc4 is the stream received on pc1.
// The stream sent from pc4 to pc3 is cloned from stream the stream received
// on pc2.
#if defined(THREAD_SANITIZER) || defined(OS_WIN)
// Flaky on TSAN v2. http://crbug.com/373637
// Flaky on Windows: http://crbug.com/469819
#define MAYBE_CanForwardRemoteStream DISABLED_CanForwardRemoteStream
#define MAYBE_CanForwardRemoteStream720p DISABLED_CanForwardRemoteStream720p
#else
#define MAYBE_CanForwardRemoteStream CanForwardRemoteStream
#define MAYBE_CanForwardRemoteStream720p CanForwardRemoteStream720p
#endif
IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, MAYBE_CanForwardRemoteStream) {
// This test makes a call between pc1 and pc2 where a video only stream is sent
// from pc1 to pc2. The stream sent from pc1 to pc2 is cloned from the stream
// received on pc2 to test that cloning of remote video tracks works as
// intended and is sent back to pc1.
IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, CanForwardRemoteStream) {
#if defined (OS_ANDROID)
// This test fails on Nexus 5 devices.
// TODO(henrika): see http://crbug.com/362437 and http://crbug.com/359389
......@@ -228,20 +217,6 @@ IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, MAYBE_CanForwardRemoteStream) {
"callAndForwardRemoteStream({video: true, audio: false});");
}
IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest,
MAYBE_CanForwardRemoteStream720p) {
#if defined (OS_ANDROID)
// This test fails on Nexus 5 devices.
// TODO(henrika): see http://crbug.com/362437 and http://crbug.com/359389
// for details.
base::CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kDisableWebRtcHWDecoding);
#endif
const std::string javascript = GenerateGetUserMediaCall(
"callAndForwardRemoteStream", 1280, 1280, 720, 720, 10, 30);
MakeTypicalPeerConnectionCall(javascript);
}
IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest,
NoCrashWhenConnectChromiumSinkToRemoteTrack) {
MakeTypicalPeerConnectionCall("ConnectChromiumSinkToRemoteAudioTrack();");
......
......@@ -156,50 +156,28 @@
});
}
// First makes a call between pc1 and pc2, and then makes a call between pc3
// and pc4. The stream sent from pc3 to pc4 is the stream received on pc1.
// The stream sent from pc4 to pc3 is cloned from the stream received on pc2
// to test that cloning of remote video tracks works as intended.
// First makes a call between pc1 and pc2 where a stream is sent from pc1 to
// pc2. The stream sent from pc1 to pc2 is cloned from the stream received on
// pc2 to test that cloning of remote video tracks works as intended and is
// sent back to pc1.
function callAndForwardRemoteStream(constraints) {
createConnections(null);
navigator.webkitGetUserMedia(constraints,
addStreamToBothConnectionsAndNegotiate,
addStreamToTheFirstConnectionAndNegotiate,
printGetUserMediaError);
var gotRemoteStream1 = false;
var gotRemoteStream2 = false;
var onRemoteStream1 = function() {
gotRemoteStream1 = true;
maybeCallEstablished();
}
var onRemoteStream2 = function() {
gotRemoteStream2 = true;
maybeCallEstablished();
}
var maybeCallEstablished = function() {
if (gotRemoteStream1 && gotRemoteStream2) {
onCallEstablished();
}
}
var onCallEstablished = function() {
thirdConnection = createConnection(null, 'remote-view-3');
thirdConnection.addStream(gRemoteStreams['remote-view-1']);
fourthConnection = createConnection(null, 'remote-view-4');
fourthConnection.addStream(gRemoteStreams['remote-view-2'].clone());
negotiateBetween(thirdConnection, fourthConnection);
waitForVideo('remote-view-3');
waitForVideo('remote-view-4');
// Video has been detected to be playing in pc2. Clone the received
// stream and send it back to pc1.
gSecondConnection.addStream(gRemoteStreams['remote-view-2'].clone());
negotiate();
}
// Do the forwarding after we have received video.
detectVideoPlaying('remote-view-1', onRemoteStream1);
// Wait for remove video to be playing in pc2. Once video is playing,
// forward the remove stream from pc2 to pc1.
detectVideoPlaying('remote-view-2', onRemoteStream2);
// Wait for video to be forwarded back to connection 1.
waitForVideo('remote-view-1');
}
// First makes a call between pc1 and pc2, and then construct a new media
......
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