Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
5 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
6 <script type="application/javascript" src="head.js"></script>
7 </head>
8 <body>
9 <pre id="test">
10 <script type="application/javascript">
11 createHTML({
12 bug: "825703",
13 title: "PeerConnection.createOffer valid/invalid constraints permutations"
14 });
16 runTest(function () {
17 var pconnect = new mozRTCPeerConnection();
18 var pconnects = new mozRTCPeerConnection();
20 function step1(offer) {}
21 function failed(code) {}
23 var exception = null;
24 try { pconnects.createOffer(step1, failed); } catch (e) { exception = e; }
25 ok(!exception, "createOffer(step1, failed) succeeds");
26 exception = null;
27 try { pconnect.createOffer(step1, failed, 1); } catch (e) { exception = e; }
28 ok(exception, "createOffer(step1, failed, 1) throws");
29 exception = null;
30 try { pconnects.createOffer(step1, failed, {}); } catch (e) { exception = e; }
31 ok(!exception, "createOffer(step1, failed, {}) succeeds");
32 exception = null;
33 try {
34 pconnect.createOffer(step1, failed, { mandatory: { FooBar: true } });
35 } catch (e) {
36 ok(e.message.indexOf("FooBar") > 0, "createOffer has readable exceptions");
37 exception = e;
38 }
39 ok(exception, "createOffer(step1, failed, { mandatory: { FooBar: true } }) throws");
40 exception = null;
41 try { pconnects.createOffer(step1, failed, { optional: [] }); } catch (e) { exception = e; }
42 ok(!exception, "createOffer(step1, failed, { optional: [] }) succeeds");
43 exception = null;
44 try { pconnect.createOffer(step1, failed, { optional: [1] }); } catch (e) { exception = e; }
45 ok(exception, "createOffer(step1, failed, { optional: [1] }) throws");
46 exception = null;
47 try { pconnect.createOffer(step1, failed, { optional: [{ OfferToReceiveVideo: false, OfferToReceiveAudio: true, }] }); } catch (e) { exception = e; }
48 ok(exception, "createOffer(step1, failed, { optional: [{ OfferToReceiveVideo: false, OfferToReceiveAudio: true, }] }) throws");
49 exception = null;
50 try { pconnects.createOffer(step1, failed, { mandatory: { OfferToReceiveVideo: false, OfferToReceiveAudio: true, MozDontOfferDataChannel: true}, optional: [{ VoiceActivityDetection: true }, { FooBar: "42" }] }); } catch (e) { exception = e; }
51 ok(!exception, "createOffer(step1, failed, { mandatory: { OfferToReceiveVideo: false, OfferToReceiveAudio: true, MozDontOfferDataChannel: true}, optional: [{ VoiceActivityDetection: true }, { FooBar: \"42\" }] }) succeeds");
52 pconnect.close();
53 pconnects.close();
54 pconnect = null;
55 pconnects = null;
56 SimpleTest.finish();
57 });
58 </script>
59 </pre>
60 </body>
61 </html>