| <!-- |
| This file is used as a control test to compare with the other Chrome Endure |
| tests in perf_endure.py. |
| |
| This file provides the ability to attach/detach a large DOM tree (also |
| containing event listeners) in the live document. It is meant to be the same |
| as endurance_control.html, except it provides buttons that can be clicked to |
| cause the DOM tree to be attached/detached. This allows a control scenario |
| to be driven by WebDriver, rather than being driven by the Javascript itself. |
| --> |
| |
| <html> |
| <head> |
| <script type='text/javascript'> |
| |
| function attach_dom_tree() { |
| var last_node = document.createElement('div'); |
| last_node.id = 'root_node'; |
| var root_node = last_node; |
| for (i = 0; i < 1000; ++i) { |
| var node = document.createElement('div'); |
| node.innerHTML = 'Node ' + i; |
| node.addEventListener('mousemove', mouse_move_callback, true); |
| last_node.appendChild(node); |
| last_node = node; |
| } |
| document.body.appendChild(root_node); |
| } |
| |
| function detach_dom_tree() { |
| var root_node = document.getElementById('root_node'); |
| document.body.removeChild(root_node); |
| } |
| |
| function mouse_move_callback(event) { |
| // Stub. |
| } |
| </script> |
| <title>Chrome Endure Control Test with WebDriver</title> |
| </head> |
| <body> |
| <input type="button" id="attach" value="attach" |
| onclick="attach_dom_tree();" /> |
| <input type="button" id="detach" value="detach" |
| onclick="detach_dom_tree();" /> |
| </body> |
| </html> |