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

Unified Diff: third_party/WebKit/LayoutTests/fast/images/border.html

Issue 2228333003: Use testharness.js in fast/images/ for border/cmyk tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code changed as per comments. 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/images/border-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/images/border.html
diff --git a/third_party/WebKit/LayoutTests/fast/images/border.html b/third_party/WebKit/LayoutTests/fast/images/border.html
index dd83bcfc26b14b6fcbb5405340e7d80116acc8ac..999bc36b73c28cd99e10248901b6e32624ffb60c 100644
--- a/third_party/WebKit/LayoutTests/fast/images/border.html
+++ b/third_party/WebKit/LayoutTests/fast/images/border.html
@@ -1,9 +1,42 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src="../../resources/js-test.js"></script>
-</head>
+<title>This tests the HTMLImageElement border property.</title>
<body>
-<script src="script-tests/border.js"></script>
-</body>
-</html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script type="text/javascript">
+function imageBorderWidth(borderValue, style) {
+ var image = document.createElement("img");
+ if (borderValue !== undefined)
+ image.setAttribute("border", borderValue);
+ image.setAttribute("style", style);
+ image.setAttribute("width", "0");
+ document.body.appendChild(image);
+ var borderBoxWidth = image.offsetWidth;
+ document.body.removeChild(image);
+ return borderBoxWidth / 2;
+}
+
+test(function() {
+ assert_equals(imageBorderWidth(), 0);
+ assert_equals(imageBorderWidth(null), 0);
+ assert_equals(imageBorderWidth(''), 0);
+ assert_equals(imageBorderWidth(0), 0);
+ assert_equals(imageBorderWidth('x'), 0);
+ assert_equals(imageBorderWidth(undefined, 'border-width: 20px'), 0);
+
+ assert_equals(imageBorderWidth(null, 'border-width: 20px'), 20);
+ assert_equals(imageBorderWidth('', 'border-width: 20px'), 20);
+ assert_equals(imageBorderWidth('x', 'border-width: 20px'), 20);
+ assert_equals(imageBorderWidth(0, 'border-width: 20px'), 20);
+
+ assert_equals(imageBorderWidth(10), 10);
+ assert_equals(imageBorderWidth(' 10'), 10);
+ assert_equals(imageBorderWidth('10 '), 10);
+ assert_equals(imageBorderWidth(' 10 '), 10);
+ assert_equals(imageBorderWidth('10q'), 10);
+ assert_equals(imageBorderWidth(' 10q'), 10);
+ assert_equals(imageBorderWidth('10q '), 10);
+ assert_equals(imageBorderWidth(' 10q '), 10);
+});
+</script>
+
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/images/border-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698