mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 05:10:49 +00:00
bug 837028 - Add logging statements for basic peer connection tests. r=jesup
This commit is contained in:
parent
4e5c2a4b8a
commit
cd9c9246a2
@ -1,4 +1,4 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
@ -18,26 +18,31 @@ var PeerConnection = {
|
||||
|
||||
function onCreateOfferSuccess(aOffer) {
|
||||
pc1_offer = aOffer;
|
||||
info("Calling setLocalDescription on local peer connection");
|
||||
aPCLocal.setLocalDescription(aOffer, onSetLocalDescriptionSuccess1,
|
||||
unexpectedCallbackAndFinish);
|
||||
}
|
||||
|
||||
function onSetLocalDescriptionSuccess1() {
|
||||
info("Calling setRemoteDescription on remote peer connection");
|
||||
aPCRemote.setRemoteDescription(pc1_offer, onSetRemoteDescriptionSuccess1,
|
||||
unexpectedCallbackAndFinish);
|
||||
}
|
||||
|
||||
function onSetRemoteDescriptionSuccess1() {
|
||||
info("Calling createAnswer on remote peer connection");
|
||||
aPCRemote.createAnswer(onCreateAnswerSuccess, unexpectedCallbackAndFinish);
|
||||
}
|
||||
|
||||
function onCreateAnswerSuccess(aAnswer) {
|
||||
pc2_answer = aAnswer;
|
||||
info("Calling setLocalDescription on remote peer connection");
|
||||
aPCRemote.setLocalDescription(aAnswer, onSetLocalDescriptionSuccess2,
|
||||
unexpectedCallbackAndFinish);
|
||||
}
|
||||
|
||||
function onSetLocalDescriptionSuccess2() {
|
||||
info("Calling setRemoteDescription on local peer connection");
|
||||
aPCLocal.setRemoteDescription(pc2_answer, onSetRemoteDescriptionSuccess2,
|
||||
unexpectedCallbackAndFinish);
|
||||
}
|
||||
@ -46,6 +51,7 @@ var PeerConnection = {
|
||||
aSuccessCallback();
|
||||
}
|
||||
|
||||
info("Calling createOffer on local peer connection");
|
||||
aPCLocal.createOffer(onCreateOfferSuccess, unexpectedCallbackAndFinish);
|
||||
},
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE HTML>
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=796892
|
||||
@ -42,6 +42,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796892
|
||||
pcRemote = new mozRTCPeerConnection();
|
||||
|
||||
pcLocal.onaddstream = function (aObj) {
|
||||
info("Local Peer Connection onaddstream has been called");
|
||||
test_data.pcLocal.push(aObj.stream);
|
||||
|
||||
audioPCRemote.mozSrcObject = aObj.stream;
|
||||
@ -49,6 +50,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796892
|
||||
};
|
||||
|
||||
pcRemote.onaddstream = function (aObj) {
|
||||
info("Remote Peer Connection onaddstream has been called");
|
||||
test_data.pcRemote.push(aObj.stream);
|
||||
|
||||
audioPCLocal.mozSrcObject = aObj.stream;
|
||||
@ -56,22 +58,25 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796892
|
||||
};
|
||||
|
||||
navigator.mozGetUserMedia({audio: true, fake: true}, function onSuccess(aLocalInputStream) {
|
||||
info("Calling addStream on local peer connection");
|
||||
pcLocal.addStream(aLocalInputStream);
|
||||
|
||||
navigator.mozGetUserMedia({audio: true, fake: true}, function onSuccess(aRemoteInputStream) {
|
||||
info("Calling addStream on remote peer connection");
|
||||
pcRemote.addStream(aRemoteInputStream);
|
||||
|
||||
audioLocal.mozSrcObject = aLocalInputStream;
|
||||
audioLocal.play();
|
||||
|
||||
PeerConnection.handShake(pcLocal, pcRemote, function () {
|
||||
info("Finished peer connection handshake");
|
||||
is(pcLocal.localStreams.length, 1,
|
||||
"A single local stream has been attached to the local peer");
|
||||
is(pcRemote.localStreams.length, 1,
|
||||
"A single local stream has been attached to the remote peer");
|
||||
|
||||
// TODO: check that the streams are of the expected types.
|
||||
// Bug 834837.
|
||||
// Bug 834837.
|
||||
|
||||
ok(PeerConnection.findStream(pcLocal.remoteStreams, test_data.pcLocal[0]) !== -1,
|
||||
"Remote audio stream for local peer is accessible");
|
||||
@ -86,7 +91,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796892
|
||||
}, true);
|
||||
|
||||
function disconnect() {
|
||||
info("Calling close on the local peer connection");
|
||||
pcLocal.close();
|
||||
info("Calling close on the remote peer connection");
|
||||
pcRemote.close();
|
||||
|
||||
info("We can't run any checks and clean-up code due to a crash (see bug 820072)");
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE HTML>
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=796890
|
||||
@ -52,6 +52,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796890
|
||||
pcRemote = new mozRTCPeerConnection();
|
||||
|
||||
pcLocal.onaddstream = function (aObj) {
|
||||
info("Local Peer Connection onaddstream has been called");
|
||||
test_data.pcLocal.push(aObj.stream);
|
||||
|
||||
videoPCRemote.mozSrcObject = aObj.stream;
|
||||
@ -59,6 +60,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796890
|
||||
};
|
||||
|
||||
pcRemote.onaddstream = function (aObj) {
|
||||
info("Remote Peer Connection onaddstream has been called");
|
||||
test_data.pcRemote.push(aObj.stream);
|
||||
|
||||
videoPCLocal.mozSrcObject = aObj.stream;
|
||||
@ -67,6 +69,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796890
|
||||
|
||||
navigator.mozGetUserMedia({audio: true, fake: true},
|
||||
function onSuccess(aLocalAudioInputStream) {
|
||||
info("Calling addStream on local peer connection with audio stream");
|
||||
pcLocal.addStream(aLocalAudioInputStream);
|
||||
|
||||
audioLocal.mozSrcObject = aLocalAudioInputStream;
|
||||
@ -74,6 +77,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796890
|
||||
|
||||
navigator.mozGetUserMedia({video: true, fake: true},
|
||||
function onSuccess(aLocalVideoInputStream) {
|
||||
info("Calling addStream on local peer connection with video stream");
|
||||
pcLocal.addStream(aLocalVideoInputStream);
|
||||
|
||||
videoLocal.mozSrcObject = aLocalVideoInputStream;
|
||||
@ -81,13 +85,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796890
|
||||
|
||||
navigator.mozGetUserMedia({audio: true, fake: true},
|
||||
function onSuccess(aRemoteAudioInputStream) {
|
||||
info("Calling addStream on remote peer connection with audio stream");
|
||||
pcRemote.addStream(aRemoteAudioInputStream);
|
||||
|
||||
navigator.mozGetUserMedia({video: true, fake: true},
|
||||
function onSuccess(aRemoteVideoInputStream) {
|
||||
info("Calling addStream on remote peer connection with video stream");
|
||||
pcRemote.addStream(aRemoteVideoInputStream);
|
||||
|
||||
PeerConnection.handShake(pcLocal, pcRemote, function () {
|
||||
info("Finished peer connection handshake");
|
||||
is(pcLocal.localStreams.length, 2,
|
||||
"Two local streams have been attached to the local peer");
|
||||
is(pcRemote.localStreams.length, 2,
|
||||
@ -98,8 +105,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796890
|
||||
is(test_data.pcRemote.length, 1,
|
||||
"A remote stream has been attached to the remote peer");
|
||||
|
||||
// TODO: check that the streams are of the expected types.
|
||||
// Bug 834837.
|
||||
// TODO: check that the streams are of the expected types.
|
||||
// Bug 834837.
|
||||
|
||||
ok(PeerConnection.findStream(pcLocal.remoteStreams, test_data.pcLocal[0]) !== -1,
|
||||
"Remote stream for local peer is accessible");
|
||||
ok(PeerConnection.findStream(pcRemote.remoteStreams, test_data.pcRemote[0]) !== -1,
|
||||
@ -115,7 +123,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796890
|
||||
}, true);
|
||||
|
||||
function disconnect() {
|
||||
info("Calling close on the local peer connection");
|
||||
pcLocal.close();
|
||||
info("Calling close on the remote peer connection");
|
||||
pcRemote.close();
|
||||
|
||||
info("We can't run any checks and clean-up code due to a crash (see bug 820072)");
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE HTML>
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=796890
|
||||
@ -46,6 +46,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796890
|
||||
pcRemote = new mozRTCPeerConnection();
|
||||
|
||||
pcLocal.onaddstream = function (aObj) {
|
||||
info("Local Peer Connection onaddstream has been called");
|
||||
test_data.pcLocal.push(aObj.stream);
|
||||
|
||||
videoPCRemote.mozSrcObject = aObj.stream;
|
||||
@ -53,6 +54,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796890
|
||||
};
|
||||
|
||||
pcRemote.onaddstream = function (aObj) {
|
||||
info("Remote Peer Connection onaddstream has been called");
|
||||
test_data.pcRemote.push(aObj.stream);
|
||||
|
||||
videoPCLocal.mozSrcObject = aObj.stream;
|
||||
@ -61,16 +63,19 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796890
|
||||
|
||||
navigator.mozGetUserMedia({audio: true, video: true, fake: true},
|
||||
function onSuccess(aLocalInputStream) {
|
||||
info("Calling addStream on local peer connection");
|
||||
pcLocal.addStream(aLocalInputStream);
|
||||
|
||||
navigator.mozGetUserMedia({audio: true, video: true, fake: true},
|
||||
function onSuccess(aRemoteInputStream) {
|
||||
info("Calling addStream on remote peer connection");
|
||||
pcRemote.addStream(aRemoteInputStream);
|
||||
|
||||
videoLocal.mozSrcObject = aLocalInputStream;
|
||||
videoLocal.play();
|
||||
|
||||
PeerConnection.handShake(pcLocal, pcRemote, function () {
|
||||
info("Finished peer connection handshake");
|
||||
is(pcLocal.localStreams.length, 1,
|
||||
"A single local stream has been attached to the local peer");
|
||||
is(pcRemote.localStreams.length, 1,
|
||||
@ -81,8 +86,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796890
|
||||
is(test_data.pcRemote.length, 1,
|
||||
"A remote stream has been attached to the remote peer");
|
||||
|
||||
// TODO: check that the streams are of the expected types.
|
||||
// Bug 834837.
|
||||
// TODO: check that the streams are of the expected types.
|
||||
// Bug 834837.
|
||||
|
||||
ok(PeerConnection.findStream(pcLocal.remoteStreams, test_data.pcLocal[0]) !== -1,
|
||||
"Remote stream for local peer is accessible");
|
||||
@ -90,14 +95,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796890
|
||||
"Remote stream for remote peer is accessible");
|
||||
|
||||
info("For now simply disconnect. We will add checks for media in a follow-up bug");
|
||||
disconnect();
|
||||
disconnect();
|
||||
});
|
||||
}, unexpectedCallbackAndFinish);
|
||||
}, unexpectedCallbackAndFinish);
|
||||
}, true);
|
||||
|
||||
function disconnect() {
|
||||
info("Calling close on the local peer connection");
|
||||
pcLocal.close();
|
||||
info("Calling close on the remote peer connection");
|
||||
pcRemote.close();
|
||||
|
||||
info("We can't run any checks and clean-up code due to a crash (see bug 820072)");
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE HTML>
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=796888
|
||||
@ -42,6 +42,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796888
|
||||
pcRemote = new mozRTCPeerConnection();
|
||||
|
||||
pcLocal.onaddstream = function (aObj) {
|
||||
info("Local Peer Connection onaddstream has been called");
|
||||
test_data.pcLocal.push(aObj.stream);
|
||||
|
||||
videoPCRemote.mozSrcObject = aObj.stream;
|
||||
@ -49,6 +50,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796888
|
||||
};
|
||||
|
||||
pcRemote.onaddstream = function (aObj) {
|
||||
info("Remote Peer Connection onaddstream has been called");
|
||||
test_data.pcRemote.push(aObj.stream);
|
||||
|
||||
videoPCLocal.mozSrcObject = aObj.stream;
|
||||
@ -56,22 +58,25 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796888
|
||||
};
|
||||
|
||||
navigator.mozGetUserMedia({video: true, fake: true}, function onSuccess(aLocalInputStream) {
|
||||
info("Calling addStream on local peer connection");
|
||||
pcLocal.addStream(aLocalInputStream);
|
||||
|
||||
navigator.mozGetUserMedia({video: true, fake: true}, function onSuccess(aRemoteInputStream) {
|
||||
info("Calling addStream on remote peer connection");
|
||||
pcRemote.addStream(aRemoteInputStream);
|
||||
|
||||
videoLocal.mozSrcObject = aLocalInputStream;
|
||||
videoLocal.play();
|
||||
|
||||
PeerConnection.handShake(pcLocal, pcRemote, function () {
|
||||
info("Finished peer connection handshake");
|
||||
is(pcLocal.localStreams.length, 1,
|
||||
"A single local stream has been attached to the local peer");
|
||||
is(pcRemote.localStreams.length, 1,
|
||||
"A single local stream has been attached to the remote peer");
|
||||
|
||||
// TODO: check that the streams are of the expected types.
|
||||
// Bug 834837.
|
||||
// Bug 834837.
|
||||
|
||||
ok(PeerConnection.findStream(pcLocal.remoteStreams, test_data.pcLocal[0]) !== -1,
|
||||
"Remote video stream for local peer is accessible");
|
||||
@ -86,7 +91,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=796888
|
||||
}, true);
|
||||
|
||||
function disconnect() {
|
||||
info("Calling close on the local peer connection");
|
||||
pcLocal.close();
|
||||
info("Calling close on the remote peer connection");
|
||||
pcRemote.close();
|
||||
|
||||
info("We can't run any checks and clean-up code due to a crash (see bug 820072)");
|
||||
|
Loading…
x
Reference in New Issue
Block a user