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

Side by Side Diff: client/dom/benchmarks/dromaeo/tests/dom-query.dart

Issue 9374026: Move dromaeo to third_party (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Moved Dromaeo to third party. Created 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 #library("dom-query.dart");
2 #import("dart:dom");
3 #import('../../common/common.dart');
4 #import('runner.dart');
5
6 void main() {
7 final int num = 40;
8
9 // Try to force real results.
10 var ret;
11
12 String html = document.body.innerHTML;
13
14 new Suite(window, 'dom-query')
15 .prep(() {
16 html = BenchUtil.replaceAll(html, 'id="test(\\w).*?"', (Match match) {
17 final group = match.group(1);
18 return 'id="test${group}${num}"';
19 });
20 html = BenchUtil.replaceAll(html, 'name="test.*?"', (Match match) {
21 return 'name="test${num}"';
22 });
23 html = BenchUtil.replaceAll(html, 'class="foo.*?"', (Match match) {
24 return 'class="foo test${num} bar"';
25 });
26 final div = document.createElement('div');
27 div.innerHTML = html;
28 document.body.appendChild(div);
29 })
30 .test('getElementById', () {
31 for (int i = 0; i < num * 30; i++) {
32 ret = document.getElementById('testA' + num).nodeType;
33 ret = document.getElementById('testB' + num).nodeType;
34 ret = document.getElementById('testC' + num).nodeType;
35 ret = document.getElementById('testD' + num).nodeType;
36 ret = document.getElementById('testE' + num).nodeType;
37 ret = document.getElementById('testF' + num).nodeType;
38 }
39 })
40 .test('getElementById (not in document)', () {
41 for (int i = 0; i < num * 30; i++) {
42 ret = document.getElementById('testA');
43 ret = document.getElementById('testB');
44 ret = document.getElementById('testC');
45 ret = document.getElementById('testD');
46 ret = document.getElementById('testE');
47 ret = document.getElementById('testF');
48 }
49 })
50 .test('getElementsByTagName(div)', () {
51 for (int i = 0; i < num; i++) {
52 var elems = document.getElementsByTagName('div');
53 ret = elems[elems.length-1].nodeType;
54 }
55 })
56 .test('getElementsByTagName(p)', () {
57 for (int i = 0; i < num; i++) {
58 final elems = document.getElementsByTagName('p');
59 ret = elems[elems.length-1].nodeType;
60 }
61 })
62 .test('getElementsByTagName(a)', () {
63 for (int i = 0; i < num; i++) {
64 var elems = document.getElementsByTagName('a');
65 ret = elems[elems.length-1].nodeType;
66 }
67 })
68 .test('getElementsByTagName(*)', () {
69 for (int i = 0; i < num; i++) {
70 var elems = document.getElementsByTagName('*');
71 ret = elems[elems.length-1].nodeType;
72 }
73 })
74 .test('getElementsByTagName (not in document)', () {
75 for (int i = 0; i < num; i++) {
76 var elems = document.getElementsByTagName('strong');
77 ret = elems.length == 0;
78 }
79 })
80 .test('getElementsByName', () {
81 for (int i = 0; i < num * 20; i++) {
82 var elems = document.getElementsByName('test' + num);
83 ret = elems[elems.length-1].nodeType;
84 elems = document.getElementsByName('test' + num);
85 ret = elems[elems.length-1].nodeType;
86 elems = document.getElementsByName('test' + num);
87 ret = elems[elems.length-1].nodeType;
88 elems = document.getElementsByName('test' + num);
89 ret = elems[elems.length-1].nodeType;
90 }
91 })
92 .test('getElementsByName (not in document)', () {
93 for (int i = 0; i < num * 20; i++) {
94 ret = document.getElementsByName('test').length == 0;
95 ret = document.getElementsByName('test').length == 0;
96 ret = document.getElementsByName('test').length == 0;
97 ret = document.getElementsByName('test').length == 0;
98 ret = document.getElementsByName('test').length == 0;
99 }
100 })
101 .end();
102 }
OLDNEW
« no previous file with comments | « client/dom/benchmarks/dromaeo/tests/dom-modify.html ('k') | client/dom/benchmarks/dromaeo/tests/dom-query.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698