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

Side by Side Diff: samples/third_party/dromaeo/tests/dom-traverse-htmlidiomatic.dart

Issue 12086028: Fix up dromaeo after lib v2 merge and add Dromaeo smoketest to prevent future (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 dromaeo;
2 import 'dart:html';
3 import '../common/common.dart';
4 import 'dart:math' as Math;
5 part 'Common.dart';
6 part 'RunnerSuite.dart';
7
8 void main() {
9 final int num = 40;
10
11 // Try to force real results.
12 var ret;
13
14 String html = document.body.innerHtml;
15
16 new Suite(window, 'dom-traverse')
17 .prep(() {
18 html = BenchUtil.replaceAll(html, 'id="test(\\w).*?"', (Match match) {
19 final group = match.group(1);
20 return 'id="test${group}${num}"';
21 });
22 html = BenchUtil.replaceAll(html, 'name="test.*?"', (Match match) {
23 return 'name="test${num}"';
24 });
25 html = BenchUtil.replaceAll(html, 'class="foo.*?"', (Match match) {
26 return 'class="foo test${num} bar"';
27 });
28
29 final div = new Element.tag('div');
30 div.innerHtml = html;
31 document.body.nodes.add(div);
32 })
33 .test('firstChild', () {
34 final nodes = document.body.nodes;
35 final nl = nodes.length;
36
37 for (int i = 0; i < num; i++) {
38 for (int j = 0; j < nl; j++) {
39 Node cur = nodes[j];
40 while (cur != null) {
41 cur = cur.nodes.first;
42 }
43 ret = cur;
44 }
45 }
46 })
47 .test('lastChild', () {
48 final nodes = document.body.nodes;
49 final nl = nodes.length;
50
51 for (int i = 0; i < num; i++) {
52 for (int j = 0; j < nl; j++) {
53 Node cur = nodes[j];
54 while (cur != null) {
55 cur = cur.nodes.last;
56 }
57 ret = cur;
58 }
59 }
60 })
61 .test('nextSibling', () {
62 for (int i = 0; i < num * 2; i++) {
63 Node cur = document.body.nodes.first;
64 while (cur != null) {
65 cur = cur.nextNode;
66 }
67 ret = cur;
68 }
69 })
70 .test('previousSibling', () {
71 for (int i = 0; i < num * 2; i++) {
72 Node cur = document.body.nodes.last;
73 while (cur != null) {
74 cur = cur.previousNode;
75 }
76 ret = cur;
77 }
78 })
79 .test('childNodes', () {
80 for (int i = 0; i < num; i++) {
81 final nodes = document.body.nodes;
82 for (int j = 0; j < nodes.length; j++) {
83 ret = nodes[j];
84 }
85 }
86 })
87 .end();
88 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698