Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2647)

Unified Diff: content/test/data/media/peerconnection-call.html

Issue 120773003: Ported media stream track enable-disable test to content module. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/test/data/media/peerconnection-call.html
diff --git a/content/test/data/media/peerconnection-call.html b/content/test/data/media/peerconnection-call.html
index afd8b0318795ca2a962104034c842b913431fccf..8c22c169370e91ac5fb61cf5724e055c6cf2b8a2 100644
--- a/content/test/data/media/peerconnection-call.html
+++ b/content/test/data/media/peerconnection-call.html
@@ -55,11 +55,12 @@
function callEmptyThenAddOneStreamAndRenegotiate(constraints) {
createConnections(null);
negotiate();
- waitForConnectionToStabilize(gFirstConnection);
- navigator.webkitGetUserMedia(constraints,
- addStreamToTheFirstConnectionAndNegotiate, printGetUserMediaError);
- // Only the first connection is sending here.
- waitForVideo('remote-view-2');
+ waitForConnectionToStabilize(gFirstConnection, function() {
+ navigator.webkitGetUserMedia(constraints,
+ addStreamToTheFirstConnectionAndNegotiate, printGetUserMediaError);
+ // Only the first connection is sending here.
+ waitForVideo('remote-view-2');
+ });
}
// First makes a call between pc1 and pc2, and then makes a call between pc3
@@ -259,6 +260,18 @@
return sdp;
}
+ function enableRemoteVideo(peerConnection, enabled) {
+ remoteStream = gSecondConnection.getRemoteStreams()[0];
perkj_chrome 2014/01/07 06:51:26 peerConnection ?
phoglund_chromium 2014/01/07 14:41:59 Good catch, done
+ remoteVideoTrack = remoteStream.getVideoTracks()[0];
+ remoteVideoTrack.enabled = enabled;
+ }
+
+ function enableRemoteAudio(peerConnection, enabled) {
+ remoteStream = gSecondConnection.getRemoteStreams()[0];
perkj_chrome 2014/01/07 06:51:26 peerConnection?
phoglund_chromium 2014/01/07 14:41:59 Done.
+ remoteAudioTrack = remoteStream.getAudioTracks()[0];
+ remoteAudioTrack.enabled = enabled;
+ }
+
function callAndEnsureAudioIsPlaying(force_isac_16k) {
if (force_isac_16k)
transformSdp = forceIsac16k_;
@@ -274,20 +287,21 @@
verifyAudioIsPlaying(samples);
eventOccured();
});
+
+ // (Also, ensure video muting doesn't affect audio).
+ enableRemoteVideo(gSecondConnection, false);
};
detectVideoPlaying('remote-view-2', onCallEstablished);
}
perkj_chrome 2014/01/07 06:51:26 nit: remove extra blank
phoglund_chromium 2014/01/07 14:41:59 Done.
+
function callAndEnsureAudioMutingWorks(force_isac_16k) {
callAndEnsureAudioIsPlaying(force_isac_16k);
setAllEventsOccuredHandler(function() {
- var audioTrack =
- gSecondConnection.getRemoteStreams()[0].getAudioTracks()[0];
-
// Call is up, now mute the track and check everything goes silent (give
// it a small delay though, we don't expect it to happen instantly).
- audioTrack.enabled = false;
+ enableRemoteAudio(gSecondConnection, false);
setTimeout(function() {
gatherAudioLevelSamples(gSecondConnection, 200, 100, function(samples) {
@@ -298,6 +312,26 @@
});
}
+ function callAndEnsureVideoMutingWorks() {
+ createConnections(null);
+ navigator.webkitGetUserMedia({audio: true, video: true},
+ addStreamToBothConnectionsAndNegotiate, printGetUserMediaError);
+
+ addExpectedEvent();
+ detectVideoPlaying('remote-view-2', function() {
+ // Disable the receiver's remote media stream. Video should stop.
+ // (Also, ensure muting audio doesn't affect video).
+ enableRemoteVideo(gSecondConnection, false);
+ enableRemoteAudio(gSecondConnection, false);
+
+ detectVideoStopped('remote-view-2', function() {
+ // Video has stopped: unmute and succeed if it starts playing again.
+ enableRemoteVideo(gSecondConnection, true);
+ detectVideoPlaying('remote-view-2', eventOccured);
+ })
+ });
+ }
+
// Test call with a new Video MediaStream that has been created based on a
// stream generated by getUserMedia.
function callWithNewVideoMediaStream() {

Powered by Google App Engine
This is Rietveld 408576698