Files
servo/tests/wpt/web-platform-tests/FileAPI/url/url_createobjecturl_file-manual.html
Ms2ger 296fa2512b Update web-platform-tests and CSS tests.
- Update CSS tests to revision e05bfd5e30ed662c2f8a353577003f8eed230180.
- Update web-platform-tests to revision a052787dd5c069a340031011196b73affbd68cd9.
2017-02-06 22:38:29 +01:00

46 lines
1.3 KiB
HTML

<!DOCTYPE html>
<meta charset="utf-8">
<title>FileAPI Test: Creating Blob URL with File</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="author" title="JunChen Xia" href="mailto:xjconlyme@gmail.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<meta name="timeout" content="long">
<div>
<p>Test steps:</p>
<ol>
<li>Download <a href="/images/blue96x96.png">blue96x96.png</a> to local.</li>
<li>Select the local file (blue96x96.png) to run the test.</li>
</ol>
</div>
<form name="uploadData">
<input type="file" id="fileChooser">
</form>
<div id="log"></div>
<script>
async_test(function(t) {
var fileInput = document.querySelector('#fileChooser');
fileInput.onchange = t.step_func(function(e) {
var blobURL, file = fileInput.files[0];
test(function() {
assert_true(file instanceof File, "FileList contains File");
}, "Check if FileList contains File");
test(function() {
blobURL = window.URL.createObjectURL(file);
assert_equals(typeof blobURL, "string", "Blob URL is type of string");
assert_equals(blobURL.indexOf("blob"), 0, "Blob URL's scheme is blob");
}, "Check if URL.createObjectURL(File) returns a Blob URL");
t.done();
});
});
</script>