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

Side by Side Diff: LayoutTests/accessibility/div-within-anchors-causes-crash.html

Issue 876003003: Extract buildAccessibilityTree() from the individual layout test. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated some tests and added rolesToIgnore param to helper function. Created 5 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script> 4 <!-- <script>
5 5
6 function buildAccessibilityTree(accessibilityObject, indent) { 6 function buildAccessibilityTree(accessibilityObject, indent) {
7 var str = ""; 7 var str = "";
8 for (var i = 0; i < indent; i++) 8 for (var i = 0; i < indent; i++)
9 str += " "; 9 str += " ";
10 str += accessibilityObject.role; 10 str += accessibilityObject.role;
11 str += " " + accessibilityObject.stringValue; 11 str += " " + accessibilityObject.stringValue;
12 str += "\n"; 12 str += "\n";
13 document.getElementById("tree").innerText += str; 13 document.getElementById("tree").innerText += str;
14 14
15 if (accessibilityObject.stringValue.indexOf('End of test') >= 0) 15 if (accessibilityObject.stringValue.indexOf('End of test') >= 0)
16 return false; 16 return false;
17 17
18 var count = accessibilityObject.childrenCount; 18 var count = accessibilityObject.childrenCount;
19 for (var i = 0; i < count; ++i) { 19 for (var i = 0; i < count; ++i) {
20 if (!buildAccessibilityTree(accessibilityObject.childAtIndex(i), ind ent + 1)) 20 if (!buildAccessibilityTree(accessibilityObject.childAtIndex(i), ind ent + 1))
21 return false; 21 return false;
22 } 22 }
23 23
24 return true; 24 return true;
25 } 25 }
26 </script> 26 </script> -->
27 <script src="../resources/js-test.js"></script> 27 <script src="../resources/js-test.js"></script>
28 <script src="../resources/accessibility-helper.js"></script>
28 </head> 29 </head>
29 <body> 30 <body>
30 31
31 <a><div></div></a> 32 <a><div></div></a>
32 33
33 <a><div></div></a> 34 <a><div></div></a>
34 35
35 <a href="about:blank"><div></div></a> 36 <a href="about:blank"><div></div></a>
36 37
37 <div>End of test</div> 38 <div>End of test</div>
38 39
39 <pre id="tree"></pre>
40
41 <p id="description"></p> 40 <p id="description"></p>
42 <div id="console"></div> 41 <div id="console"></div>
43 42
44 <script> 43 <script>
45 description("This can cause a crash."); 44 description("This can cause a crash.");
46 45
47 if (window.accessibilityController) { 46 if (window.accessibilityController) {
48 // First build up full accessibility tree. 47 // First build up full accessibility tree.
49 document.getElementById("tree").innerText += "Before:\n"; 48 document.getElementById("console").innerText += "Before:\n";
50 document.body.focus(); 49 document.body.focus();
51 buildAccessibilityTree(accessibilityController.focusedElement, 0); 50 buildAccessibilityTree(accessibilityController.focusedElement, 0);
52 51
53 // Remove anchor that causes debug assert in AccessibilityRenderObject:: addChildren 52 // Remove anchor that causes debug assert in AccessibilityRenderObject:: addChildren
54 document.body.removeChild(document.body.children[2]) 53 document.body.removeChild(document.body.children[2])
55 54
56 // Build up full accessibility tree again. 55 // Build up full accessibility tree again.
57 document.getElementById("tree").innerText += "After:\n"; 56 document.getElementById("console").innerText += "After:\n";
58 document.body.focus(); 57 document.body.focus();
59 buildAccessibilityTree(accessibilityController.focusedElement, 0); 58 buildAccessibilityTree(accessibilityController.focusedElement, 0);
60 } 59 }
61 60
62 </script> 61 </script>
63 62
64 </body> 63 </body>
65 </html> 64 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698