summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/FileAPI/reading-data-section/filereader_readAsDataURL.any.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/FileAPI/reading-data-section/filereader_readAsDataURL.any.js
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/FileAPI/reading-data-section/filereader_readAsDataURL.any.js')
-rw-r--r--testing/web-platform/tests/FileAPI/reading-data-section/filereader_readAsDataURL.any.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/testing/web-platform/tests/FileAPI/reading-data-section/filereader_readAsDataURL.any.js b/testing/web-platform/tests/FileAPI/reading-data-section/filereader_readAsDataURL.any.js
new file mode 100644
index 0000000000..d681212129
--- /dev/null
+++ b/testing/web-platform/tests/FileAPI/reading-data-section/filereader_readAsDataURL.any.js
@@ -0,0 +1,42 @@
+// META: title=FileAPI Test: FileReader.readAsDataURL
+
+async_test(function(testCase) {
+ var blob = new Blob(["TEST"]);
+ var reader = new FileReader();
+
+ reader.onload = this.step_func(function(evt) {
+ assert_equals(reader.readyState, reader.DONE);
+ testCase.done();
+ });
+ reader.onloadstart = this.step_func(function(evt) {
+ assert_equals(reader.readyState, reader.LOADING);
+ });
+ reader.onprogress = this.step_func(function(evt) {
+ assert_equals(reader.readyState, reader.LOADING);
+ });
+
+ reader.readAsDataURL(blob);
+}, 'FileReader readyState during readAsDataURL');
+
+async_test(function(testCase) {
+ var blob = new Blob(["TEST"], { type: 'text/plain' });
+ var reader = new FileReader();
+
+ reader.onload = this.step_func(function() {
+ assert_equals(reader.result, "data:text/plain;base64,VEVTVA==");
+ testCase.done();
+ });
+ reader.readAsDataURL(blob);
+}, 'readAsDataURL result for Blob with specified MIME type');
+
+async_test(function(testCase) {
+ var blob = new Blob(["TEST"]);
+ var reader = new FileReader();
+
+ reader.onload = this.step_func(function() {
+ assert_equals(reader.result,
+ "data:application/octet-stream;base64,VEVTVA==");
+ testCase.done();
+ });
+ reader.readAsDataURL(blob);
+}, 'readAsDataURL result for Blob with unspecified MIME type'); \ No newline at end of file