- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / chrome_endure / endurance_control_webdriver.html
1 <!--
2   This file is used as a control test to compare with the other Chrome Endure
3   tests in perf_endure.py.
4
5   This file provides the ability to attach/detach a large DOM tree (also
6   containing event listeners) in the live document.  It is meant to be the same
7   as endurance_control.html, except it provides buttons that can be clicked to
8   cause the DOM tree to be attached/detached.  This allows a control scenario
9   to be driven by WebDriver, rather than being driven by the Javascript itself.
10 -->
11
12 <html>
13   <head>
14     <script type='text/javascript'>
15
16     function attach_dom_tree() {
17       var last_node = document.createElement('div');
18       last_node.id = 'root_node';
19       var root_node = last_node;
20       for (i = 0; i < 1000; ++i) {
21         var node = document.createElement('div');
22         node.innerHTML = 'Node ' + i;
23         node.addEventListener('mousemove', mouse_move_callback, true);
24         last_node.appendChild(node);
25         last_node = node;
26       }
27       document.body.appendChild(root_node);
28     }
29
30     function detach_dom_tree() {
31       var root_node = document.getElementById('root_node');
32       document.body.removeChild(root_node);
33     }
34
35     function mouse_move_callback(event) {
36       // Stub.
37     }
38     </script>
39     <title>Chrome Endure Control Test with WebDriver</title>
40   </head>
41   <body>
42     <input type="button" id="attach" value="attach"
43            onclick="attach_dom_tree();" />
44     <input type="button" id="detach" value="detach"
45            onclick="detach_dom_tree();" />
46   </body>
47 </html>