Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-accessibility-test.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-accessibility-test.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-accessibility-test.html |
| index 5696062f1e287c32ed3fee200045737952d199f6..7e7899dd347f921fffbf9008233251fb23a2a793 100644 |
| --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-accessibility-test.html |
| +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-accessibility-test.html |
| @@ -1,8 +1,6 @@ |
| -<!DOCTYPE HTML> |
| <head> |
| -<title>Canvas Hit Regions: accessibility test</title> |
| -<script src="../../resources/js-test.js"></script> |
| -</head> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| <body> |
| <canvas id="canvas"> |
| <button id="button1"></button> |
| @@ -21,33 +19,34 @@ |
| <div id="console"></div> |
| <script> |
| - var canvas = document.getElementById("canvas"); |
| - var context = canvas.getContext("2d"); |
| +var canvas = document.getElementById("canvas"); |
| +var context = canvas.getContext("2d"); |
| - function drawRectAndAddHitRegion(control, x, y, width, height) { |
| - if (window.accessibilityController) |
| - window["ax" + control] = accessibilityController.accessibleElementById(control); |
| +function drawRectAndAddHitRegion(control, x, y, width, height) { |
| + if (window.accessibilityController) |
| + window["ax" + control] = accessibilityController.accessibleElementById(control); |
| - context.beginPath(); |
| - context.rect(x, y, width, height); |
| - context.fill(); |
| - context.addHitRegion({ |
| - id : control, |
| - control : document.getElementById(control) |
| - }); |
| - } |
| + context.beginPath(); |
| + context.rect(x, y, width, height); |
| + context.fill(); |
| + context.addHitRegion({ |
| + id : control, |
| + control : document.getElementById(control) |
| + }); |
| +} |
| - function testAccessibilityRect(control, x, y, width, height) { |
| +function testAccessibilityRect(control, x, y, width, height) { |
| - if (window.accessibilityController && !window["ax" + control]) |
| - window["ax" + control] = accessibilityController.accessibleElementById(control); |
| + if (window.accessibilityController && !window["ax" + control]) |
| + window["ax" + control] = accessibilityController.accessibleElementById(control); |
| - shouldBe("ax" + control + ".x", x.toString()); |
| - shouldBe("ax" + control + ".y", y.toString()); |
| - shouldBe("ax" + control + ".width", width.toString()); |
| - shouldBe("ax" + control + ".height", height.toString()); |
| - } |
| + assert_equals(eval("ax" + control + ".x"), x); |
| + assert_equals(eval("ax" + control + ".y"), y); |
| + assert_equals(eval("ax" + control + ".width"), width); |
| + assert_equals(eval("ax" + control + ".height"), height); |
| +} |
| +test(function(t) { |
|
Justin Novosad
2017/02/09 20:37:19
should use generate_tests here
zakerinasab
2017/02/13 17:06:10
Done.
|
| drawRectAndAddHitRegion("button1", 0, 0, 200, 200); |
| drawRectAndAddHitRegion("button2", 0, 0, 100, 50); |
| drawRectAndAddHitRegion("button3", 40, 20, 50, 70); |
| @@ -55,30 +54,25 @@ |
| drawRectAndAddHitRegion("button5", 40, 20, 50, 70); |
| drawRectAndAddHitRegion("button6", 20, 10, 140, 30); |
| drawRectAndAddHitRegion("button7", 0, 0, 200, 200); |
| - |
| - debug("Just one button tests."); |
| + |
| + // Just one button tests. |
| testAccessibilityRect("button1", 8, 8, 200, 200); |
| - debug(""); |
| - |
| - debug("The container1 has two buttons."); |
| + |
| + // The container1 has two buttons. |
| testAccessibilityRect("button2", 8, 8, 100, 50); |
| testAccessibilityRect("button3", 48, 28, 50, 70); |
| testAccessibilityRect("container1", 8, 8, 100, 90); |
| - debug(""); |
| - |
| - debug("Remove the button2 from the container1."); |
| + |
| + // Remove the button2 from the container1. |
| document.getElementById("container1").removeChild(document.getElementById("button2")); |
| testAccessibilityRect("container1", 48, 28, 50, 70); |
| - debug(""); |
| - |
| - debug("Depth-two container tests."); |
| + |
| + // Depth-two container tests. |
| testAccessibilityRect("button4", 8, 8, 100, 50); |
| testAccessibilityRect("button5", 48, 28, 50, 70); |
| testAccessibilityRect("button6", 28, 18, 140, 30); |
| testAccessibilityRect("container2", 8, 8, 160, 90); |
| testAccessibilityRect("container3", 8, 8, 100, 90); |
| - debug(""); |
| - |
| +}, 'Test canvas hit regions (accessibility test).'); |
| </script> |
| </body> |
| -</html> |