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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/gradient-addColorStop-with-invalid-color.html

Issue 2703803002: 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/gradient-addColorStop-with-invalid-color.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/gradient-addColorStop-with-invalid-color.html b/third_party/WebKit/LayoutTests/fast/canvas/gradient-addColorStop-with-invalid-color.html
index 51eb48f2b86316d7cfc27b5861534a666a8b5a85..d731bc77ed6cce453b5c56f1066e43379be81c34 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/gradient-addColorStop-with-invalid-color.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/gradient-addColorStop-with-invalid-color.html
@@ -1,9 +1,17 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src="../../resources/js-test.js"></script>
-</head>
-<body>
-<script src="script-tests/gradient-addColorStop-with-invalid-color.js"></script>
-</body>
-</html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function(){
+
+ var gradient = document.createElement('canvas').getContext('2d').createLinearGradient(0, 0, 150, 0);
+
+ assert_throws(null, function(){gradient.addColorStop(0, '');}, '"SyntaxError: Failed to execute \'addColorStop\' on \'CanvasGradient\': The value provided (\'\') could not be parsed as a color."');
+
+ assert_throws(null, function(){gradient.addColorStop(0, '#cc');}, '"SyntaxError: Failed to execute \'addColorStop\' on \'CanvasGradient\': The value provided (\'#cc\') could not be parsed as a color."');
+
+ assert_throws(null, function(){gradient.addColorStop(0, 'rgb(257, 0)');}, '"SyntaxError: Failed to execute \'addColorStop\' on \'CanvasGradient\': The value provided (\'rgb(257, 0)\') could not be parsed as a color."');
+
+ assert_throws(null, function(){gradient.addColorStop(0, 'rgb(257, 0, 5, 0)');}, '"SyntaxError: Failed to execute \'addColorStop\' on \'CanvasGradient\': The value provided (\'rgb(257, 0, 5, 0)\') could not be parsed as a color."');
+
+}, 'This test checks invalid colors on gradients.');
+</script>

Powered by Google App Engine
This is Rietveld 408576698