OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * This configuration can be used to rerun selected tests, as well | 6 * This configuration can be used to rerun selected tests, as well |
7 * as see diagnostic output from tests. It runs each test in its own | 7 * as see diagnostic output from tests. It runs each test in its own |
8 * IFrame, so the configuration consists of two parts - a 'parent' | 8 * IFrame, so the configuration consists of two parts - a 'parent' |
9 * config that manages all the tests, and a 'child' config for the | 9 * config that manages all the tests, and a 'child' config for the |
10 * IFrame that runs the individual tests. | 10 * IFrame that runs the individual tests. |
(...skipping 25 matching lines...) Expand all Loading... |
36 [int elapsed = 0, String body = '']) => | 36 [int elapsed = 0, String body = '']) => |
37 '$messageType $elapsed $body'; | 37 '$messageType $elapsed $body'; |
38 | 38 |
39 _Message(this.messageType, [this.elapsed = 0, this.body = '']); | 39 _Message(this.messageType, [this.elapsed = 0, this.body = '']); |
40 | 40 |
41 _Message.fromString(String msg) { | 41 _Message.fromString(String msg) { |
42 int idx = msg.indexOf(' '); | 42 int idx = msg.indexOf(' '); |
43 messageType = msg.substring(0, idx); | 43 messageType = msg.substring(0, idx); |
44 ++idx; | 44 ++idx; |
45 int idx2 = msg.indexOf(' ', idx); | 45 int idx2 = msg.indexOf(' ', idx); |
46 elapsed = parseInt(msg.substring(idx, idx2)); | 46 elapsed = int.parse(msg.substring(idx, idx2)); |
47 ++idx2; | 47 ++idx2; |
48 body = msg.substring(idx2); | 48 body = msg.substring(idx2); |
49 } | 49 } |
50 | 50 |
51 String toString() => text(messageType, elapsed, body); | 51 String toString() => text(messageType, elapsed, body); |
52 } | 52 } |
53 | 53 |
54 /** | 54 /** |
55 * The child configuration that is used to run individual tests in | 55 * The child configuration that is used to run individual tests in |
56 * an IFrame and post the results back to the parent. In principle | 56 * an IFrame and post the results back to the parent. In principle |
(...skipping 27 matching lines...) Expand all Loading... |
84 * IFrame URL, sets that as a solo test and starts test execution. | 84 * IFrame URL, sets that as a solo test and starts test execution. |
85 */ | 85 */ |
86 window.on.message.add((MessageEvent e) { | 86 window.on.message.add((MessageEvent e) { |
87 // Get the result, do any logging, then do a pass/fail. | 87 // Get the result, do any logging, then do a pass/fail. |
88 var m = new _Message.fromString(e.data); | 88 var m = new _Message.fromString(e.data); |
89 if (m.messageType == _Message.START) { | 89 if (m.messageType == _Message.START) { |
90 parentWindow = e.source; | 90 parentWindow = e.source; |
91 String search = window.location.search; | 91 String search = window.location.search; |
92 int pos = search.indexOf('t='); | 92 int pos = search.indexOf('t='); |
93 String ids = search.substring(pos+2); | 93 String ids = search.substring(pos+2); |
94 int id = parseInt(ids); | 94 int id = int.parse(ids); |
95 setSoloTest(id); | 95 setSoloTest(id); |
96 runTests(); | 96 runTests(); |
97 } | 97 } |
98 }); | 98 }); |
99 } | 99 } |
100 | 100 |
101 void onStart() { | 101 void onStart() { |
102 // Listen for uncaught errors. | 102 // Listen for uncaught errors. |
103 window.on.error.add(_onErrorClosure); | 103 window.on.error.add(_onErrorClosure); |
104 } | 104 } |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 </div>"""); | 281 </div>"""); |
282 document.query('#group-divs').nodes.add(groupDiv); | 282 document.query('#group-divs').nodes.add(groupDiv); |
283 groupDiv.query('.groupselect').on.click.add((e) { | 283 groupDiv.query('.groupselect').on.click.add((e) { |
284 var parent = document.query('#$groupId'); | 284 var parent = document.query('#$groupId'); |
285 InputElement cb = parent.query('.groupselect'); | 285 InputElement cb = parent.query('.groupselect'); |
286 var state = cb.checked; | 286 var state = cb.checked; |
287 var tests = parent.query('.tests'); | 287 var tests = parent.query('.tests'); |
288 for (Element t in tests.elements) { | 288 for (Element t in tests.elements) { |
289 cb = t.query('.testselect') as InputElement; | 289 cb = t.query('.testselect') as InputElement; |
290 cb.checked = state; | 290 cb.checked = state; |
291 var testId = parseInt(t.id.substring(_testIdPrefix.length)); | 291 var testId = int.parse(t.id.substring(_testIdPrefix.length)); |
292 if (state) { | 292 if (state) { |
293 enableTest(testId); | 293 enableTest(testId); |
294 } else { | 294 } else { |
295 disableTest(testId); | 295 disableTest(testId); |
296 } | 296 } |
297 } | 297 } |
298 }); | 298 }); |
299 } | 299 } |
300 var list = groupDiv.query('.tests'); | 300 var list = groupDiv.query('.tests'); |
301 var testItem = list.query('#$_testIdPrefix$id'); | 301 var testItem = list.query('#$_testIdPrefix$id'); |
302 if (testItem == null) { | 302 if (testItem == null) { |
303 // Create the li element for the test. | 303 // Create the li element for the test. |
304 testItem = new Element.html(""" | 304 testItem = new Element.html(""" |
305 <li id='$_testIdPrefix$id' class='test-it status-pending'> | 305 <li id='$_testIdPrefix$id' class='test-it status-pending'> |
306 <div class='test-info'> | 306 <div class='test-info'> |
307 <p class='test-title'> | 307 <p class='test-title'> |
308 <input type='checkbox' checked='true' class='testselect' | 308 <input type='checkbox' checked='true' class='testselect' |
309 id='$_selectedIdPrefix$id'> | 309 id='$_selectedIdPrefix$id'> |
310 <span class='test-label'> | 310 <span class='test-label'> |
311 <span class='timer-result test-timer-result'></span> | 311 <span class='timer-result test-timer-result'></span> |
312 <span class='test-name closed'>${testCase.description}</span> | 312 <span class='test-name closed'>${testCase.description}</span> |
313 </span> | 313 </span> |
314 </p> | 314 </p> |
315 </div> | 315 </div> |
316 <div class='scrollpane'> | 316 <div class='scrollpane'> |
317 <ol class='test-actions' id='$_actionIdPrefix$id'></ol> | 317 <ol class='test-actions' id='$_actionIdPrefix$id'></ol> |
318 </div> | 318 </div> |
319 </li>"""); | 319 </li>"""); |
320 list.nodes.add(testItem); | 320 list.nodes.add(testItem); |
321 testItem.query('#$_selectedIdPrefix$id').on.change.add((e) { | 321 testItem.query('#$_selectedIdPrefix$id').on.change.add((e) { |
322 InputElement cb = testItem.query('#$_selectedIdPrefix$id'); | 322 InputElement cb = testItem.query('#$_selectedIdPrefix$id'); |
323 testCase.enabled = cb.checked; | 323 testCase.enabled = cb.checked; |
324 }); | 324 }); |
325 testItem.query('.test-label').on.click.add((e) { | 325 testItem.query('.test-label').on.click.add((e) { |
326 var _testItem = document.query('#$_testIdPrefix$id'); | 326 var _testItem = document.query('#$_testIdPrefix$id'); |
327 var _actions = _testItem.query('#$_actionIdPrefix$id'); | 327 var _actions = _testItem.query('#$_actionIdPrefix$id'); |
328 var _label = _testItem.query('.test-name'); | 328 var _label = _testItem.query('.test-name'); |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 display: block; | 649 display: block; |
650 list-style-type: disc; | 650 list-style-type: disc; |
651 -webkit-margin-before: 1em; | 651 -webkit-margin-before: 1em; |
652 -webkit-margin-after: 1em; | 652 -webkit-margin-after: 1em; |
653 -webkit-margin-start: 0px; | 653 -webkit-margin-start: 0px; |
654 -webkit-margin-end: 0px; | 654 -webkit-margin-end: 0px; |
655 -webkit-padding-start: 40px; | 655 -webkit-padding-start: 40px; |
656 } | 656 } |
657 | 657 |
658 """; | 658 """; |
OLD | NEW |