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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-gradient-over-pattern.html

Issue 2673883002: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Addressing comments 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-gradient-over-pattern.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-gradient-over-pattern.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-gradient-over-pattern.html
index 104de61cfb2cc58ceffcd223326364bd2a2782ad..3b704c7b196116e18698232af0bfbdc96223a1f9 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-gradient-over-pattern.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-gradient-over-pattern.html
@@ -1,63 +1,29 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <script type="text/javascript">
- if (window.testRunner)
- testRunner.waitUntilDone();
- window.jsTestIsAsync = true
- </script>
-</head>
-<body>
- <script src="../../resources/js-test.js"></script>
- <script type="text/javascript" src="canvas-blending-helpers.js"></script>
- <script type="text/javascript">
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script type="text/javascript" src="canvas-blending-helpers.js"></script>
+<script>
+function drawElement(context, i) {
+ if (i >= blendModes.length)
+ return;
+ context.clearRect(0, 0, 10, 10);
+ context.save();
+ drawBackdropColorPatternInContext(context,
+ function() {
+ context.globalCompositeOperation = blendModes[i];
+ drawSourceColorGradientInContext(context);
+ checkBlendModeResult(i, context, 5);
+ context.restore();
+ drawElement(context, ++i);
+ });
+}
- description("Series of tests to ensure correct results on applying different blend modes when drawing a gradient on top of an pattern.");
+test(function(t) {
+ var canvas = document.createElement('canvas');
+ var sigma = 5;
+ canvas.width = 10;
+ canvas.height = 10;
+ context = canvas.getContext('2d');
+ drawElement(context, 0);
- var context;
- function actualColor(x, y) {
- return context.getImageData(x, y, 1, 1).data;
- }
-
- function checkBlendModeResult(i, context, sigma) {
- var expectedColor = blendColors([129 / 255, 1, 129 / 255, 1], [1, 129 / 255, 129 / 255, 1], i);
- var ac = "actualColor(0, 0)";
- shouldBeCloseTo(ac + "[0]", expectedColor[0], sigma);
- shouldBeCloseTo(ac + "[1]", expectedColor[1], sigma);
- shouldBeCloseTo(ac + "[2]", expectedColor[2], sigma);
- shouldBeCloseTo(ac + "[3]", expectedColor[3], sigma);
- }
-
- function drawElement(context, i) {
- if (i >= blendModes.length) {
- finishJSTest();
- return;
- }
- debug("Testing blend mode " + blendModes[i]);
-
- context.clearRect(0, 0, 10, 10);
- context.save();
- drawBackdropColorPatternInContext(context,
- function() {
- context.globalCompositeOperation = blendModes[i];
- drawSourceColorGradientInContext(context);
- checkBlendModeResult(i, context, 5);
- context.restore();
- debug('');
- drawElement(context, ++i);
- });
- }
-
- function runTest() {
- var canvas = document.createElement("canvas");
- var sigma = 5;
- canvas.width = 10;
- canvas.height = 10;
- context = canvas.getContext("2d");
- drawElement(context, 0);
- }
-
- runTest();
- </script>
-</body>
-</html>
+}, 'Series of tests to ensure correct results on applying different blend modes when drawing a gradient on top of an pattern.');
+</script>

Powered by Google App Engine
This is Rietveld 408576698