Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html |
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html |
index dc48053196fb9abb1dbbb1d56c69c639e3a7075d..bbeead7519b66596b35c335df92b036667b355f1 100644 |
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html |
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html |
@@ -1,45 +1,24 @@ |
-<script src = "../../resources/js-test.js"></script> |
-<script type = "text/javascript"> |
-if (window.testRunner) |
-{ |
- testRunner.dumpAsText(); |
- testRunner.waitUntilDone(); |
-} |
- |
-description("Test that toBlob(mimeType) ignores the case of 'mimeType'."); |
- |
-canvas = document.createElement('canvas'); |
-var counter; |
- |
-function tryMimeType(mimeType, expectedMimeType) |
-{ |
- canvas.toBlob(function(blob) { |
- if (blob.type === expectedMimeType) { |
- testPassed(""); |
- } |
- else { |
- testFailed(blob.type + " does not match " + expectedMimeType); |
- } |
- counter = counter - 1; |
- if (window.testRunner) { |
- if (counter == 0) { |
- testRunner.notifyDone(); |
- } |
- } |
- }, mimeType); |
-} |
- |
-counter = 4; |
- |
-//Note that due to the async nature of toBlob, these callbacks may complete |
-// at random order but they will all print PASS when they pass. |
-tryMimeType("image/PNG", "image/png"); |
- |
-tryMimeType("imaGE/jpEg", "image/jpeg"); |
- |
-tryMimeType("ImAgE/WeBp", "image/webp"); |
- |
-//Unsupported mime type falls back to png |
-tryMimeType("image/bmp", "image/png"); |
- |
-</Script> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+ |
+<script> |
+async_test(function(t) { |
+ var counter = 4; |
+ canvas = document.createElement('canvas'); |
+ |
+ function tryMimeType(mimeType, expectedMimeType) |
+ { |
+ canvas.toBlob(function(blob) { |
+ assert_true(blob.type === expectedMimeType); |
Justin Novosad
2017/02/15 19:55:28
calls to assert* need to be inside t.step()
zakerinasab
2017/02/16 17:16:17
Done.
|
+ if (--counter == 0) |
+ t.done(); |
+ }, mimeType); |
+ } |
+ |
+ tryMimeType("image/PNG", "image/png"); |
Justin Novosad
2017/02/15 19:55:28
I know you can't use generate_tests for async, but
zakerinasab
2017/02/16 17:16:17
Done.
|
+ tryMimeType("imaGE/jpEg", "image/jpeg"); |
+ tryMimeType("ImAgE/WeBp", "image/webp"); |
+ //Unsupported mime type falls back to png |
+ tryMimeType("image/bmp", "image/png"); |
+}, "Test that toBlob(mimeType) ignores the case of 'mimeType'."); |
+</script> |