Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-convertToBlob-exceptions.html

Issue 2695343002: Handle OffscreenCanvas.convertToBlob exceptions: EncodingError & InvalidStateError (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script> 2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script> 3 <script src="../../resources/testharnessreport.js"></script>
4 <script id="myWorker" type="text/worker"> 4 <script id="myWorker" type="text/worker">
5 self.onmessage = function(e) { 5 self.onmessage = function(e) {
6 }; 6 };
7 </script> 7 </script>
8 <script> 8 <script>
9 9
10 function makeWorker(script) 10 function makeWorker(script)
(...skipping 15 matching lines...) Expand all
26 }, "Test that call convertToBlob on a detached OffscreenCanvas throws exception" ); 26 }, "Test that call convertToBlob on a detached OffscreenCanvas throws exception" );
27 27
28 async_test(function(t) { 28 async_test(function(t) {
29 var offscreenCanvas = new OffscreenCanvas(0, 0); 29 var offscreenCanvas = new OffscreenCanvas(0, 0);
30 offscreenCanvas.convertToBlob().then(t.step_func_done(function() { 30 offscreenCanvas.convertToBlob().then(t.step_func_done(function() {
31 assert_false("convertToBlob didn't throw, but should be"); 31 assert_false("convertToBlob didn't throw, but should be");
32 }), t.step_func_done(function(e) { 32 }), t.step_func_done(function(e) {
33 assert_true(e instanceof DOMException); 33 assert_true(e instanceof DOMException);
34 assert_equals(e.name, "IndexSizeError"); 34 assert_equals(e.name, "IndexSizeError");
35 })); 35 }));
36 }, "Test that call convertToBlob on a OffscreenCanvas with size 0 throws excepti on"); 36 }, "Test that call convertToBlob on an OffscreenCanvas with size 0 throws except ion");
37
38 async_test(function(t) {
39 var webp_max_dimension = 16383; // Based on WEBPImageEncoder.cpp?l=52
40 var offscreenCanvas = new OffscreenCanvas(10, webp_max_dimension + 1);
41 var ctx = offscreenCanvas.getContext("2d");
42 offscreenCanvas.convertToBlob({type: "image/webp"}).then(t.step_func_done(fu nction() {
43 assert_false("convertToBlob didn't throw, but should be");
44 }), t.step_func_done(function(e) {
45 assert_true(e instanceof DOMException);
46 assert_equals(e.name, "EncodingError");
47 }));
48 }, "Test that call convertToBlob throws EncodingError exception when encoding fa ils");
49
50 async_test(function(t) {
51 var offscreenCanvas = new OffscreenCanvas(10, 10);
52 offscreenCanvas.convertToBlob().then(t.step_func_done(function() {
53 assert_false("convertToBlob didn't throw, but should be");
54 }), t.step_func_done(function(e) {
55 assert_true(e instanceof DOMException);
56 assert_equals(e.name, "InvalidStateError");
57 }));
58 }, "Test that call convertToBlob on an OffscreenCanvas without contexts throws e xception");
37 59
38 </script> 60 </script>
39 61
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698