1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/media/tests/mochitest/test_peerConnection_bug835370.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,61 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<head> 1.7 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.8 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.9 + <script type="application/javascript" src="head.js"></script> 1.10 +</head> 1.11 +<body> 1.12 +<pre id="test"> 1.13 +<script type="application/javascript"> 1.14 + createHTML({ 1.15 + bug: "825703", 1.16 + title: "PeerConnection.createOffer valid/invalid constraints permutations" 1.17 + }); 1.18 + 1.19 + runTest(function () { 1.20 + var pconnect = new mozRTCPeerConnection(); 1.21 + var pconnects = new mozRTCPeerConnection(); 1.22 + 1.23 + function step1(offer) {} 1.24 + function failed(code) {} 1.25 + 1.26 + var exception = null; 1.27 + try { pconnects.createOffer(step1, failed); } catch (e) { exception = e; } 1.28 + ok(!exception, "createOffer(step1, failed) succeeds"); 1.29 + exception = null; 1.30 + try { pconnect.createOffer(step1, failed, 1); } catch (e) { exception = e; } 1.31 + ok(exception, "createOffer(step1, failed, 1) throws"); 1.32 + exception = null; 1.33 + try { pconnects.createOffer(step1, failed, {}); } catch (e) { exception = e; } 1.34 + ok(!exception, "createOffer(step1, failed, {}) succeeds"); 1.35 + exception = null; 1.36 + try { 1.37 + pconnect.createOffer(step1, failed, { mandatory: { FooBar: true } }); 1.38 + } catch (e) { 1.39 + ok(e.message.indexOf("FooBar") > 0, "createOffer has readable exceptions"); 1.40 + exception = e; 1.41 + } 1.42 + ok(exception, "createOffer(step1, failed, { mandatory: { FooBar: true } }) throws"); 1.43 + exception = null; 1.44 + try { pconnects.createOffer(step1, failed, { optional: [] }); } catch (e) { exception = e; } 1.45 + ok(!exception, "createOffer(step1, failed, { optional: [] }) succeeds"); 1.46 + exception = null; 1.47 + try { pconnect.createOffer(step1, failed, { optional: [1] }); } catch (e) { exception = e; } 1.48 + ok(exception, "createOffer(step1, failed, { optional: [1] }) throws"); 1.49 + exception = null; 1.50 + try { pconnect.createOffer(step1, failed, { optional: [{ OfferToReceiveVideo: false, OfferToReceiveAudio: true, }] }); } catch (e) { exception = e; } 1.51 + ok(exception, "createOffer(step1, failed, { optional: [{ OfferToReceiveVideo: false, OfferToReceiveAudio: true, }] }) throws"); 1.52 + exception = null; 1.53 + try { pconnects.createOffer(step1, failed, { mandatory: { OfferToReceiveVideo: false, OfferToReceiveAudio: true, MozDontOfferDataChannel: true}, optional: [{ VoiceActivityDetection: true }, { FooBar: "42" }] }); } catch (e) { exception = e; } 1.54 + ok(!exception, "createOffer(step1, failed, { mandatory: { OfferToReceiveVideo: false, OfferToReceiveAudio: true, MozDontOfferDataChannel: true}, optional: [{ VoiceActivityDetection: true }, { FooBar: \"42\" }] }) succeeds"); 1.55 + pconnect.close(); 1.56 + pconnects.close(); 1.57 + pconnect = null; 1.58 + pconnects = null; 1.59 + SimpleTest.finish(); 1.60 + }); 1.61 +</script> 1.62 +</pre> 1.63 +</body> 1.64 +</html>