RTCConfiguration-helper.js (890B)
1 'use strict'; 2 3 // Run a test function as two test cases. 4 // The first test case test the configuration by passing a given config 5 // to the constructor. 6 // The second test case create an RTCPeerConnection object with default 7 // configuration, then call setConfiguration with the provided config. 8 // The test function is given a constructor function to create 9 // a new instance of RTCPeerConnection with given config, 10 // either directly as constructor parameter or through setConfiguration. 11 function config_test(test_func, desc) { 12 test(() => { 13 test_func(config => new RTCPeerConnection(config)); 14 }, `new RTCPeerConnection(config) - ${desc}`); 15 16 test(() => { 17 test_func(config => { 18 const pc = new RTCPeerConnection(); 19 assert_idl_attribute(pc, 'setConfiguration'); 20 pc.setConfiguration(config); 21 return pc; 22 }) 23 }, `setConfiguration(config) - ${desc}`); 24 }