Backed out changeset 6ce08f664f9c (bug 1208328)

This commit is contained in:
Carsten "Tomcat" Book 2016-06-09 15:18:35 +02:00
Родитель c55a07994c
Коммит 27555764e7
3 изменённых файлов: 6 добавлений и 76 удалений

Просмотреть файл

@ -441,8 +441,8 @@ function checkMediaStreamTrackCloneAgainstOriginal(clone, original) {
/*** Utility methods */ /*** Utility methods */
/** The dreadful setTimeout, use sparingly */ /** The dreadful setTimeout, use sparingly */
function wait(time, message) { function wait(time) {
return new Promise(r => setTimeout(() => r(message), time)); return new Promise(r => setTimeout(r, time));
} }
/** The even more dreadful setInterval, use even more sparingly */ /** The even more dreadful setInterval, use even more sparingly */
@ -482,8 +482,8 @@ var addFinallyToPromise = promise => {
/** Use event listener to call passed-in function on fire until it returns true */ /** Use event listener to call passed-in function on fire until it returns true */
var listenUntil = (target, eventName, onFire) => { var listenUntil = (target, eventName, onFire) => {
return new Promise(resolve => target.addEventListener(eventName, return new Promise(resolve => target.addEventListener(eventName,
function callback(event) { function callback() {
var result = onFire(event); var result = onFire();
if (result) { if (result) {
target.removeEventListener(eventName, callback, false); target.removeEventListener(eventName, callback, false);
resolve(result); resolve(result);
@ -609,7 +609,8 @@ function haveEvent(target, name, cancelPromise) {
(cancelPromise || new Promise()).then(e => Promise.reject(e)), (cancelPromise || new Promise()).then(e => Promise.reject(e)),
new Promise(resolve => target.addEventListener(name, listener = resolve)) new Promise(resolve => target.addEventListener(name, listener = resolve))
]); ]);
return p.then(event => (target.removeEventListener(name, listener), event)); p.then(() => target.removeEventListener(name, listener));
return p;
}; };
/** /**

Просмотреть файл

@ -83,7 +83,6 @@ skip-if = (toolkit == 'gonk' || buildapp == 'mulet' && debug) # copied from basi
[test_getUserMedia_peerIdentity.html] [test_getUserMedia_peerIdentity.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g(Bug 1021776, too --ing slow on b2g) skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g(Bug 1021776, too --ing slow on b2g)
[test_peerConnection_addIceCandidate.html] [test_peerConnection_addIceCandidate.html]
[test_peerConnection_addtrack_removetrack_events.html]
[test_peerConnection_basicAudio.html] [test_peerConnection_basicAudio.html]
skip-if = toolkit == 'gonk' # B2G emulator is too slow to handle a two-way audio call reliably skip-if = toolkit == 'gonk' # B2G emulator is too slow to handle a two-way audio call reliably
[test_peerConnection_basicAudioNATSrflx.html] [test_peerConnection_basicAudioNATSrflx.html]

Просмотреть файл

@ -1,70 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript" src="pc.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
"use strict";
createHTML({
title: "MediaStream's 'addtrack' and 'removetrack' events with gUM",
bug: "1208328"
});
runNetworkTest(function (options) {
let test = new PeerConnectionTest(options);
let eventsPromise;
addRenegotiation(test.chain,
[
function PC_LOCAL_SWAP_VIDEO_TRACKS(test) {
return getUserMedia({video: true}).then(stream => {
let localStream = test.pcLocal._pc.getLocalStreams()[0];
let remoteStream = test.pcRemote._pc.getRemoteStreams()[0];
let newTrack = stream.getTracks()[0];
let videoSenderIndex =
test.pcLocal._pc.getSenders().findIndex(s => s.track.kind == "video");
isnot(videoSenderIndex, -1, "Should have video sender");
test.pcLocal.removeSender(videoSenderIndex);
test.pcLocal.attachLocalTrack(stream.getTracks()[0], localStream);
let onNextLoop = wait(0);
eventsPromise = haveEvent(remoteStream, "addtrack", wait(50000, "No addtrack event"))
.then(trackEvent => {
ok(trackEvent instanceof MediaStreamTrackEvent,
"Expected event to be instance of MediaStreamTrackEvent");
is(trackEvent.type, "addtrack",
"Expected addtrack event type");
is(trackEvent.track.id, newTrack.id, "Expected track in event");
is(trackEvent.track.readyState, "live",
"added track should be live");
})
.then(() => haveEvent(remoteStream, "addtrack", onNextLoop)
.then(() => Promise.reject("Unexpected addtrack event for remote stream " + remoteStream.id),
() => Promise.resolve())
);
remoteStream.addEventListener("removetrack",
function onRemovetrack(trackEvent) {
ok(false, "UA shouldn't raise 'removetrack' when receiving peer connection");
})
});
},
],
[
function PC_REMOTE_CHECK_EVENTS(test) {
return eventsPromise;
},
]
);
test.setMediaConstraints([{audio: true, video: true}], []);
test.run();
});
</script>
</pre>
</body>
</html>