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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/webgl/texImage-imageBitmap-from-canvas-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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/canvas/webgl/texImage-imageBitmap-from-canvas-resize.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/texImage-imageBitmap-from-canvas.html b/third_party/WebKit/LayoutTests/fast/canvas/webgl/texImage-imageBitmap-from-canvas-resize.html
similarity index 50%
copy from third_party/WebKit/LayoutTests/fast/canvas/webgl/texImage-imageBitmap-from-canvas.html
copy to third_party/WebKit/LayoutTests/fast/canvas/webgl/texImage-imageBitmap-from-canvas-resize.html
index e2e5fe13b30b9fc8fc710bb87b89a51eebebbcf9..257dc0d95eced4678697ced2e3546673c814abf2 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/texImage-imageBitmap-from-canvas.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/webgl/texImage-imageBitmap-from-canvas-resize.html
@@ -4,11 +4,10 @@
<script src="./resources/webgl-test-utils-full.js"></script>
<script src="./resources/tex-image-and-sub-image-utils.js"></script>
<script src="./resources/tex-image-and-sub-image-image-bitmap-utils.js"></script>
-<script src="../../../resources/js-test.js"></script>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<body>
<script>
-
-window.jsTestIsAsync = true;
-
var wtu = WebGLTestUtils;
var tiu = TexImageUtils;
var gl = null;
@@ -21,16 +20,6 @@ var blackColor = [0, 0, 0];
var darkRed = [26, 0, 0];
var darkGreen = [0, 26, 0];
-function promiseRejected()
-{
- document.getElementById("results").innerHTML = "Promise <span style='color:red'>REJECTED</span>";
-}
-
-function pass()
-{
- document.getElementById("results").innerHTML = "Test <span style='color:green'>PASSED</span>";
-}
-
function setCanvasToRedGreen(ctx) {
ctx.canvas.width = 2;
ctx.canvas.height = 2;
@@ -48,11 +37,13 @@ function setCanvasToRedGreen(ctx) {
ctx.fillRect(halfWidth, halfHeight, halfWidth, halfHeight);
}
-function generateTest()
-{
+promise_test(function() {
var bitmaps = [];
- var canvas = document.getElementById("example");
+ var canvas = document.createElement('canvas');
+ canvas.width = 32;
+ canvas.height = 32;
+ document.body.appendChild(canvas);
gl = canvas.getContext("webgl");
gl.clearColor(0,0,0,1);
@@ -62,41 +53,25 @@ function generateTest()
var ctx = testCanvas.getContext("2d");
setCanvasToRedGreen(ctx);
- var p1 = createImageBitmap(testCanvas).then(function(imageBitmap) { bitmaps.defaultOption = imageBitmap });
- var p2 = createImageBitmap(testCanvas, {imageOrientation: "none", premultiplyAlpha: "premultiply"}).then(function(imageBitmap) { bitmaps.noFlipYPremul = imageBitmap });
- var p3 = createImageBitmap(testCanvas, {imageOrientation: "none", premultiplyAlpha: "default"}).then(function(imageBitmap) { bitmaps.noFlipYDefault = imageBitmap });
- var p4 = createImageBitmap(testCanvas, {imageOrientation: "none", premultiplyAlpha: "none"}).then(function(imageBitmap) { bitmaps.noFlipYUnpremul = imageBitmap });
- var p5 = createImageBitmap(testCanvas, {imageOrientation: "flipY", premultiplyAlpha: "premultiply"}).then(function(imageBitmap) { bitmaps.flipYPremul = imageBitmap });
- var p6 = createImageBitmap(testCanvas, {imageOrientation: "flipY", premultiplyAlpha: "default"}).then(function(imageBitmap) { bitmaps.flipYDefault = imageBitmap });
- var p7 = createImageBitmap(testCanvas, {imageOrientation: "flipY", premultiplyAlpha: "none"}).then(function(imageBitmap) { bitmaps.flipYUnpremul = imageBitmap });
- var p8 = createImageBitmap(testCanvas).then(function(imageBitmap) { bitmaps.colorSpaceDef = imageBitmap });
- var p9 = createImageBitmap(testCanvas, {colorSpaceConversion: "none"}).then(function(imageBitmap) { bitmaps.colorSpaceNone = imageBitmap });
- var p10 = createImageBitmap(testCanvas, {colorSpaceConversion: "default"}).then(function(imageBitmap) { bitmaps.colorSpaceDefault = imageBitmap });
+ var p1 = createImageBitmap(testCanvas, {resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.defaultOption = imageBitmap });
+ var p2 = createImageBitmap(testCanvas, {imageOrientation: "none", premultiplyAlpha: "premultiply", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.noFlipYPremul = imageBitmap });
+ var p3 = createImageBitmap(testCanvas, {imageOrientation: "none", premultiplyAlpha: "default", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.noFlipYDefault = imageBitmap });
+ var p4 = createImageBitmap(testCanvas, {imageOrientation: "none", premultiplyAlpha: "none", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.noFlipYUnpremul = imageBitmap });
+ var p5 = createImageBitmap(testCanvas, {imageOrientation: "flipY", premultiplyAlpha: "premultiply", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.flipYPremul = imageBitmap });
+ var p6 = createImageBitmap(testCanvas, {imageOrientation: "flipY", premultiplyAlpha: "default", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.flipYDefault = imageBitmap });
+ var p7 = createImageBitmap(testCanvas, {imageOrientation: "flipY", premultiplyAlpha: "none", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.flipYUnpremul = imageBitmap });
+ var p8 = createImageBitmap(testCanvas, {resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.colorSpaceDef = imageBitmap });
+ var p9 = createImageBitmap(testCanvas, {colorSpaceConversion: "none", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.colorSpaceNone = imageBitmap });
+ var p10 = createImageBitmap(testCanvas, {colorSpaceConversion: "default", resizeWidth: 4, resizeHeight: 4, resizeQuality: "high"}).then(function(imageBitmap) { bitmaps.colorSpaceDefault = imageBitmap });
Promise.all([p1, p2, p3, p4, p5, p6, p7, p8, p9, p10]).then(function() {
var alphaVal = 0.5;
var testPassed = runTest(bitmaps, alphaVal, false);
- if (testPassed)
- pass();
- finishJSTest();
+ if (!testPassed)
+ assert_true(false, 'Test failed');
}, function() {
- promiseRejected();
- finishJSTest();
+ assert_true(false, 'Promise rejected');
});
-}
-
-function init()
-{
- if (window.testRunner) {
- testRunner.overridePreference("WebKitWebGLEnabled", "1");
- testRunner.dumpAsText();
- }
- generateTest();
-}
+}, 'createImageBitmap(HTMLCanvasElement) with resize and other options');
</script>
-</head>
-<body onload="init()">
-<canvas id="texcanvas" width="2" height="2"></canvas>
-<canvas id="example" width="32" height="32"></canvas>
-<div id="results">Test <span style="color:red">FAILED</span></div>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698