Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / accessibility / canvas-accessibilitynodeobject.html
blobe624cb0583ec77e087c4bdcbde30d59225739e32
1 <!DOCTYPE HTML>
2 <html>
3 <body>
4 <script src="../resources/js-test.js"></script>
6 <div id="myContainer" tabindex="-1">
7 <a href="#">Link</a>
8 <button>Button</button>
9 <input type="text">
10 <input type="checkbox">
11 <input type="radio">
12 <input type="submit">
13 <select><option>1<option>2</select>
14 <span tabindex="0" role="button">ARIA button</span>
15 <span tabindex="0" role="link">ARIA link</span>
16 </div>
18 <canvas id="myCanvas" width="300" height="300" tabindex="-1">
19 <a href="#">Link</a>
20 <button>Button</button>
21 <input type="text">
22 <input type="checkbox">
23 <input type="radio">
24 <input type="submit">
25 <select><option>1<option>2</select>
26 <span tabindex="0" role="button">ARIA button</span>
27 <span tabindex="0" role="link">ARIA link</span>
28 </canvas>
30 <div id="console"></div>
31 <script>
32 description("This test makes sure that AccessibilityNodeObjects are created for elements in a canvas subtree.");
34 if (window.testRunner && window.accessibilityController) {
35 window.testRunner.dumpAsText();
37 function appendFocusableDescendants(axObject, axFocusableList) {
38 for (var i = 0; i < axObject.childrenCount; i++) {
39 var axChild = axObject.childAtIndex(i);
40 if (axChild.isFocusable)
41 axFocusableList.push(axChild);
42 appendFocusableDescendants(axChild, axFocusableList);
46 var container = document.getElementById("myContainer");
47 container.focus();
48 var axContainer = accessibilityController.focusedElement;
50 var canvas = document.getElementById("myCanvas");
51 canvas.focus();
52 var axCanvas = accessibilityController.focusedElement;
54 var axLayoutObjects = [];
55 var axNodeObjects = [];
57 appendFocusableDescendants(axContainer, axLayoutObjects);
58 appendFocusableDescendants(axCanvas, axNodeObjects);
60 shouldBe("axLayoutObjects.length", "axNodeObjects.length");
62 for (var i = 0; i < axLayoutObjects.length; i++) {
63 var axLayoutObject = axLayoutObjects[i];
64 var axNodeObject = axNodeObjects[i];
65 shouldBe("i == " + i + "; axLayoutObject.role == axNodeObject.role", "true");
69 </script>
71 </body>
72 </html>