mediasource-worker-must-fail-if-unsupported.js (960B)
1 importScripts("/resources/testharness.js"); 2 3 test(t => { 4 // The Window test html conditionally fetches and runs these tests only if the 5 // implementation does not have a true-valued static 6 // canConstructInDedicatedWorker property on MediaSource in the Window 7 // context. So, the implementation must agree on lack of support here in the 8 // dedicated worker context. 9 10 // Ensure we're executing in a dedicated worker context. 11 assert_true(self instanceof DedicatedWorkerGlobalScope, "self instanceof DedicatedWorkerGlobalScope"); 12 assert_true(self.MediaSource === undefined, "MediaSource is undefined in DedicatedWorker"); 13 assert_throws_js(ReferenceError, 14 function() { var ms = new MediaSource(); }, 15 "MediaSource construction in DedicatedWorker throws exception"); 16 }, "MediaSource construction in DedicatedWorker context must fail if Window context did not claim MSE supported in DedicatedWorker"); 17 18 done();