dom/media/tests/mochitest/test_peerConnection_toJSON.html

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:96c307094f38
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=872377
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title>Test for Bug 872377 and Bug 928304</title>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
10 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
11 <script type="application/javascript" src="head.js"></script>
12 </head>
13 <body>
14 <pre id="test">
15 <script type="application/javascript">
16 createHTML({
17 bug: "928304",
18 title: "test toJSON() on mozRTCSessionDescription and mozRTCIceCandidate"
19 });
20
21 runTest(function () {
22 /** Test for Bug 872377 **/
23
24 var rtcSession = new mozRTCSessionDescription({ sdp: "Picklechips!",
25 type: "offer" });
26 var jsonCopy = JSON.parse(JSON.stringify(rtcSession));
27 for (key in rtcSession) {
28 if (typeof(rtcSession[key]) == "function") continue;
29 is(rtcSession[key], jsonCopy[key], "key " + key + " should match.");
30 }
31
32 /** Test for Bug 928304 **/
33
34 var rtcIceCandidate = new mozRTCIceCandidate({ candidate: "dummy",
35 sdpMid: "test",
36 sdpMLineIndex: 3 });
37 jsonCopy = JSON.parse(JSON.stringify(rtcIceCandidate));
38 for (key in rtcIceCandidate) {
39 if (typeof(rtcIceCandidate[key]) == "function") continue;
40 is(rtcIceCandidate[key], jsonCopy[key], "key " + key + " should match.");
41 }
42 SimpleTest.finish();
43 });
44 </script>
45 </pre>
46 </body>
47 </html>

mercurial