bug 837028 - Add logging statements for basic peer connection tests. r=jesup
authorJason Smith <jsmith@mozilla.com>
Thu, 31 Jan 2013 20:12:51 -0800
changeset 130430 4444d9e3af9a24af8f4081eacc3148756c76a802
parent 130429 aecf9fd2ea567f327a5828bac0e723493c54d80e
child 130431 703cfc2901995b2bb4eafc637e6ef664dcac48c6
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs837028
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 837028 - Add logging statements for basic peer connection tests. r=jesup
dom/media/tests/mochitest/pc.js
dom/media/tests/mochitest/test_peerConnection_basicAudio.html
dom/media/tests/mochitest/test_peerConnection_basicAudioVideo.html
dom/media/tests/mochitest/test_peerConnection_basicAudioVideoCombined.html
dom/media/tests/mochitest/test_peerConnection_basicVideo.html
--- a/dom/media/tests/mochitest/pc.js
+++ b/dom/media/tests/mochitest/pc.js
@@ -1,9 +1,9 @@
-/* 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/. */
 
 
 var PeerConnection = {
   pc1_offer : null,
   pc2_answer : null,
 
@@ -13,44 +13,50 @@ var PeerConnection = {
    * @param {object) aPCLocal Local client
    * @param {object} aPCRemote Remote client
    * @param {function} aSuccessCallback Method to call when the connection has been established
    */
   handShake: function PC_handShake(aPCLocal, aPCRemote, aSuccessCallback) {
 
     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);
     }
 
     function onSetRemoteDescriptionSuccess2() {
       aSuccessCallback();
     }
 
+    info("Calling createOffer on local peer connection");
     aPCLocal.createOffer(onCreateOfferSuccess, unexpectedCallbackAndFinish);
   },
 
   /**
    * Finds the given media stream in the list of available streams.
    *
    * This function is necessary because localStreams and remoteStreams don't have
    * an indexOf method.
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudio.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudio.html
@@ -1,9 +1,9 @@
-<!DOCTYPE HTML>
+<!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=796892
 -->
 <head>
   <meta charset="utf-8">
   <title>Basic audio-only peer connection</title>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
@@ -37,61 +37,68 @@ https://bugzilla.mozilla.org/show_bug.cg
     audioLocal = document.getElementById("audioLocal");
     audioPCLocal = document.getElementById("audioPCLocal");
     audioPCRemote = document.getElementById("audioPCRemote");
 
     pcLocal = new mozRTCPeerConnection();
     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;
       audioPCRemote.play();
     };
 
     pcRemote.onaddstream = function (aObj) {
+      info("Remote Peer Connection onaddstream has been called");
       test_data.pcRemote.push(aObj.stream);
 
       audioPCLocal.mozSrcObject = aObj.stream;
       audioPCLocal.play();
     };
 
     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");
           ok(PeerConnection.findStream(pcRemote.remoteStreams, test_data.pcRemote[0]) !== -1,
              "Remote audio stream for remote peer is accessible");
 
           info("For now simply disconnect. We will add checks for media in a follow-up bug");
           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)");
 
     SimpleTest.finish();
   }
 </script>
 </pre>
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudioVideo.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudioVideo.html
@@ -1,9 +1,9 @@
-<!DOCTYPE HTML>
+<!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=796890
 -->
 <head>
   <meta charset="utf-8">
   <title>Basic video-only peer connection</title>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
@@ -47,80 +47,90 @@ https://bugzilla.mozilla.org/show_bug.cg
     videoLocal = document.getElementById("videoLocal");
     videoPCLocal = document.getElementById("videoPCLocal");
     videoPCRemote = document.getElementById("videoPCRemote");
 
     pcLocal = new mozRTCPeerConnection();
     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;
       videoPCRemote.play();
     };
 
     pcRemote.onaddstream = function (aObj) {
+      info("Remote Peer Connection onaddstream has been called");
       test_data.pcRemote.push(aObj.stream);
 
       videoPCLocal.mozSrcObject = aObj.stream;
       videoPCLocal.play();
     };
 
     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;
       audioLocal.play();
 
       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;
         videoLocal.play();
 
         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,
                  "Two local local streams have been attached to the remote peer");
 
               is(test_data.pcLocal.length, 1,
                  "A remote stream has been attached to the local peer");
               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,
                  "Remote stream for remote peer is accessible");
 
               info("For now simply disconnect. We will add checks for media in a follow-up bug");
               disconnect();
             });
           }, unexpectedCallbackAndFinish);
         }, unexpectedCallbackAndFinish);
       }, 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)");
 
     SimpleTest.finish();
   }
 </script>
 </pre>
--- a/dom/media/tests/mochitest/test_peerConnection_basicAudioVideoCombined.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicAudioVideoCombined.html
@@ -1,9 +1,9 @@
-<!DOCTYPE HTML>
+<!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=796890
 -->
 <head>
   <meta charset="utf-8">
   <title>Basic video-only peer connection</title>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
@@ -41,68 +41,75 @@ https://bugzilla.mozilla.org/show_bug.cg
     videoLocal = document.getElementById("videoLocal");
     videoPCLocal = document.getElementById("videoPCLocal");
     videoPCRemote = document.getElementById("videoPCRemote");
 
     pcLocal = new mozRTCPeerConnection();
     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;
       videoPCRemote.play();
     };
 
     pcRemote.onaddstream = function (aObj) {
+      info("Remote Peer Connection onaddstream has been called");
       test_data.pcRemote.push(aObj.stream);
 
       videoPCLocal.mozSrcObject = aObj.stream;
       videoPCLocal.play();
     };
 
     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,
              "A single local stream has been attached to the remote peer");
 
           is(test_data.pcLocal.length, 1,
              "A remote stream has been attached to the local peer");
           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,
              "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)");
 
     SimpleTest.finish();
   }
 </script>
 </pre>
--- a/dom/media/tests/mochitest/test_peerConnection_basicVideo.html
+++ b/dom/media/tests/mochitest/test_peerConnection_basicVideo.html
@@ -1,9 +1,9 @@
-<!DOCTYPE HTML>
+<!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=796888
 -->
 <head>
   <meta charset="utf-8">
   <title>Basic video-only peer connection</title>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
@@ -37,61 +37,68 @@ https://bugzilla.mozilla.org/show_bug.cg
     videoLocal = document.getElementById("videoLocal");
     videoPCLocal = document.getElementById("videoPCLocal");
     videoPCRemote = document.getElementById("videoPCRemote");
 
     pcLocal = new mozRTCPeerConnection();
     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;
       videoPCRemote.play();
     };
 
     pcRemote.onaddstream = function (aObj) {
+      info("Remote Peer Connection onaddstream has been called");
       test_data.pcRemote.push(aObj.stream);
 
       videoPCLocal.mozSrcObject = aObj.stream;
       videoPCLocal.play();
     };
 
     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");
           ok(PeerConnection.findStream(pcRemote.remoteStreams, test_data.pcRemote[0]) !== -1,
              "Remote video stream for remote peer is accessible");
 
           info("For now simply disconnect. We will add checks for media in a follow-up bug");
           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)");
 
     SimpleTest.finish();
   }
 </script>
 </pre>