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