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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/webgl/texImage-imageBitmap-from-blob-resize.html

Issue 2218963002: Add more layout tests for createImageBitmap with resize options (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/webgl/texImage-imageBitmap-from-canvas-resize.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="./resources/webgl-test-utils-full.js"></script>
5 <script src="./resources/tex-image-and-sub-image-utils.js"></script>
6 <script src="./resources/tex-image-and-sub-image-image-bitmap-utils.js"></script >
7 <script src="../../../resources/testharness.js"></script>
8 <script src="../../../resources/testharnessreport.js"></script>
9 <body>
10 <script>
11 var wtu = WebGLTestUtils;
12 var tiu = TexImageUtils;
13 var gl = null;
14 var internalFormat = "RGBA";
15 var pixelFormat = "RGBA";
16 var pixelType = "UNSIGNED_BYTE";
17 var redColor = [255, 0, 0];
18 var greenColor = [0, 255, 0];
19 var blackColor = [0, 0, 0];
20 var darkRed = [26, 0, 0];
21 var darkGreen = [0, 26, 0];
22
23 var blob1 = null;
24 var blob2 = null;
25
26 function generateTest()
27 {
28 var bitmaps = [];
29
30 var canvas = document.createElement('canvas');
31 canvas.width = 32;
32 canvas.height = 32;
33 document.body.appendChild(canvas);
34 gl = canvas.getContext("webgl");
35
36 gl.clearColor(0,0,0,1);
37 gl.clearDepth(1);
38
39 var p1 = createImageBitmap(blob1, {resizeWidth: 4, resizeHeight: 4, resizeQu ality: "high"}).then(function(imageBitmap) { bitmaps.defaultOption = imageBitmap });
40 var p2 = createImageBitmap(blob1, {imageOrientation: "none", premultiplyAlph a: "premultiply", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then( function(imageBitmap) { bitmaps.noFlipYPremul = imageBitmap });
41 var p3 = createImageBitmap(blob1, {imageOrientation: "none", premultiplyAlph a: "default", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(func tion(imageBitmap) { bitmaps.noFlipYDefault = imageBitmap });
42 var p4 = createImageBitmap(blob1, {imageOrientation: "none", premultiplyAlph a: "none", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(functio n(imageBitmap) { bitmaps.noFlipYUnpremul = imageBitmap });
43 var p5 = createImageBitmap(blob1, {imageOrientation: "flipY", premultiplyAlp ha: "premultiply", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then (function(imageBitmap) { bitmaps.flipYPremul = imageBitmap });
44 var p6 = createImageBitmap(blob1, {imageOrientation: "flipY", premultiplyAlp ha: "default", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(fun ction(imageBitmap) { bitmaps.flipYDefault = imageBitmap });
45 var p7 = createImageBitmap(blob1, {imageOrientation: "flipY", premultiplyAlp ha: "none", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(functi on(imageBitmap) { bitmaps.flipYUnpremul = imageBitmap });
46 var p8 = createImageBitmap(blob2, {resizeWidth: 4, resizeHeight: 4, resizeQu ality: "high"}).then(function(imageBitmap) { bitmaps.colorSpaceDef = imageBitmap });
47 var p9 = createImageBitmap(blob2, {colorSpaceConversion: "none", resizeWidth : 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitma ps.colorSpaceNone = imageBitmap });
48 var p10 = createImageBitmap(blob2, {colorSpaceConversion: "default", resizeW idth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { b itmaps.colorSpaceDefault = imageBitmap });
49 return Promise.all([p1, p2, p3, p4, p5, p6, p7, p8, p9, p10]).then(function( ) {
50 var alphaVal = 0.5;
51 var testPassed = runTest(bitmaps, alphaVal, true);
52 if (!testPassed)
53 assert_true(false, 'Test failed');
54 }, function() {
55 assert_true(false, 'Promise rejected');
56 });
57 }
58
59 promise_test(function() {
60 var xhr1 = new XMLHttpRequest();
61 xhr1.open("GET", 'resources/red-green-semi-transparent.png');
62 xhr1.responseType = 'blob';
63 xhr1.send();
64 xhr1.onload = function() {
65 blob1 = xhr1.response;
66 var xhr2 = new XMLHttpRequest();
67 xhr2.open("GET", 'resources/square-with-colorspin-profile.png');
68 xhr2.responseType = 'blob';
69 xhr2.send();
70 xhr2.onload = function() {
71 blob2 = xhr2.response;
72 return generateTest();
73 }
74 }
75 }, 'createImageBitmap(Blob) with resize and other options');
76 </script>
77 </body>
78 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/webgl/texImage-imageBitmap-from-canvas-resize.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698