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

Side by Side Diff: LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html

Issue 1257253004: [HTMLCanvasElement.toBlob] Default callback version without scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Modifications based on feedback from Patch Set 3 including Layout Tests and Rebaseline of Mac and Win Created 5 years, 4 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
OLDNEW
(Empty)
1 <script src = "../../resources/js-test.js"></script>
2 <script type = "text/javascript">
3 if (window.testRunner)
4 {
5 testRunner.dumpAsText();
6 testRunner.waitUntilDone();
7 }
8
9 description("Test that toBlob(mimeType) ignores the case of 'mimeType'.");
10
11 canvas = document.createElement('canvas');
12 var counter;
13
14 function tryMimeType(mimeType, expectedMimeType)
15 {
16 canvas.toBlob(function(blob) {
17 if (blob.type === expectedMimeType) {
18 testPassed("");
19 }
20 else {
21 testFailed(blob.type + " does not match " + expectedMimeType);
22 }
23 counter = counter + 1;
24 if (window.testRunner) {
25 if (counter == 8) {
Justin Novosad 2015/08/20 20:38:42 To make the test easier to extend, you should coun
xlai (Olivia) 2015/08/20 21:36:28 Doing that might result in a flaky test. If the bl
26 testRunner.notifyDone();
27 }
28 }
29 }, mimeType);
30 }
31
32 function startTest()
Justin Novosad 2015/08/20 20:38:42 This function does not really serve a purpose. It'
33 {
34 counter = 0;
Justin Novosad 2015/08/20 20:38:42 declaration and init can be on same line.
35
36 //Note that due to the async nature of toBlob, these callbacks may complete
37 // at random order but they will all print PASS when they pass.
38 tryMimeType("image/png", "image/png");
39 tryMimeType("iMAge/png", "image/png");
40 tryMimeType("image/PNG", "image/png");
Justin Novosad 2015/08/20 20:38:42 Just one test is enough to verify case insensitivi
xlai (Olivia) 2015/08/20 21:36:28 Acknowledged and elsewhere.
41
42 tryMimeType("image/jpeg", "image/jpeg");
43 tryMimeType("imaGE/jpEg", "image/jpeg");
44 tryMimeType("IMAGE/JPEG", "image/jpeg");
45
46 tryMimeType("image/webp", "image/webp");
47 tryMimeType("ImAgE/WeBp", "image/webp");
48 }
49
50 startTest();
51 </Script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698