|
Line 0
a/LayoutTests/imported/w3c/web-platform-tests/mediacapture-record/BlobEvent-constructor.html_sec1
|
|
|
1 |
<!doctype html> |
| 2 |
<title>BlobEvent constructor</title> |
| 3 |
<link rel="help" href="https://w3c.github.io/mediacapture-record/MediaRecorder.html#blob-event"> |
| 4 |
<script src="/resources/testharness.js"></script> |
| 5 |
<script src="/resources/testharnessreport.js"></script> |
| 6 |
<script> |
| 7 |
test(function() { |
| 8 |
assert_equals(BlobEvent.length, 2); |
| 9 |
assert_throws(new TypeError, function() { |
| 10 |
new BlobEvent("type"); |
| 11 |
}); |
| 12 |
assert_throws(new TypeError, function() { |
| 13 |
new BlobEvent("type", null); |
| 14 |
}); |
| 15 |
assert_throws(new TypeError, function() { |
| 16 |
new BlobEvent("type", undefined); |
| 17 |
}); |
| 18 |
}, "The BlobEventInit dictionary is required"); |
| 19 |
|
| 20 |
test(function() { |
| 21 |
assert_throws(new TypeError, function() { |
| 22 |
new BlobEvent("type", {}); |
| 23 |
}); |
| 24 |
assert_throws(new TypeError, function() { |
| 25 |
new BlobEvent("type", { data: null }); |
| 26 |
}); |
| 27 |
assert_throws(new TypeError, function() { |
| 28 |
new BlobEvent("type", { data: undefined }); |
| 29 |
}); |
| 30 |
}, "The BlobEventInit dictionary's data member is required."); |
| 31 |
|
| 32 |
test(function() { |
| 33 |
var blob = new Blob(); |
| 34 |
var event = new BlobEvent("type", { data: blob }); |
| 35 |
assert_equals(event.type, "type"); |
| 36 |
assert_equals(event.data, blob); |
| 37 |
}, "The BlobEvent instance's data attribute is set."); |
| 38 |
</script> |