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

Side by Side Diff: pkg/unittest/interactive_html_config.dart

Issue 10829459: Deprecate Math object in corelib in favor of dart:math library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 8 years, 4 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
« no previous file with comments | « pkg/intl/number_format.dart ('k') | runtime/bin/file_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 'master' 8 * IFrame, so the configuration consists of two parts - a 'master'
9 * config that manages all the tests, and a 'slave' config for the 9 * config that manages all the tests, and a 'slave' config for the
10 * IFrame that runs the individual tests. 10 * IFrame that runs the individual tests.
11 */ 11 */
12 #library('interactive_config'); 12 #library('interactive_config');
13 13
14 // TODO(gram) - add options for: remove IFrame on done/keep 14 // TODO(gram) - add options for: remove IFrame on done/keep
15 // IFrame for failed tests/keep IFrame for all tests. 15 // IFrame for failed tests/keep IFrame for all tests.
16 16
17 #import('dart:html'); 17 #import('dart:html');
18 #import('dart:math');
18 #import('unittest.dart'); 19 #import('unittest.dart');
19 20
20 /** The messages exchanged between master and slave. */ 21 /** The messages exchanged between master and slave. */
21 22
22 class _Message { 23 class _Message {
23 static final START = 'start'; 24 static final START = 'start';
24 static final LOG = 'log'; 25 static final LOG = 'log';
25 static final STACK = 'stack'; 26 static final STACK = 'stack';
26 static final PASS = 'pass'; 27 static final PASS = 'pass';
27 static final FAIL = 'fail'; 28 static final FAIL = 'fail';
28 static final ERROR = 'error'; 29 static final ERROR = 'error';
29 30
30 String messageType; 31 String messageType;
31 int elapsed; 32 int elapsed;
32 String body; 33 String body;
33 34
34 static String text(String messageType, 35 static String text(String messageType,
35 [int elapsed = 0, String body = '']) => 36 [int elapsed = 0, String body = '']) =>
36 '$messageType $elapsed $body'; 37 '$messageType $elapsed $body';
37 38
38 _Message(this.messageType, [this.elapsed = 0, this.body = '']); 39 _Message(this.messageType, [this.elapsed = 0, this.body = '']);
39 40
40 _Message.fromString(String msg) { 41 _Message.fromString(String msg) {
41 int idx = msg.indexOf(' '); 42 int idx = msg.indexOf(' ');
42 messageType = msg.substring(0, idx); 43 messageType = msg.substring(0, idx);
43 ++idx; 44 ++idx;
44 int idx2 = msg.indexOf(' ', idx); 45 int idx2 = msg.indexOf(' ', idx);
45 elapsed = Math.parseInt(msg.substring(idx, idx2)); 46 elapsed = parseInt(msg.substring(idx, idx2));
46 ++idx2; 47 ++idx2;
47 body = msg.substring(idx2); 48 body = msg.substring(idx2);
48 } 49 }
49 50
50 String toString() => text(messageType, elapsed, body); 51 String toString() => text(messageType, elapsed, body);
51 } 52 }
52 53
53 /** 54 /**
54 * The slave configuration that is used to run individual tests in 55 * The slave configuration that is used to run individual tests in
55 * an IFrame and post the results back to the master. In principle 56 * an IFrame and post the results back to the master. In principle
(...skipping 27 matching lines...) Expand all
83 * 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.
84 */ 85 */
85 window.on.message.add((MessageEvent e) { 86 window.on.message.add((MessageEvent e) {
86 // Get the result, do any logging, then do a pass/fail. 87 // Get the result, do any logging, then do a pass/fail.
87 var m = new _Message.fromString(e.data); 88 var m = new _Message.fromString(e.data);
88 if (m.messageType == _Message.START) { 89 if (m.messageType == _Message.START) {
89 masterWindow = e.source; 90 masterWindow = e.source;
90 String search = window.location.search; 91 String search = window.location.search;
91 int pos = search.indexOf('t='); 92 int pos = search.indexOf('t=');
92 String ids = search.substring(pos+2); 93 String ids = search.substring(pos+2);
93 int id = Math.parseInt(ids); 94 int id = parseInt(ids);
94 setSoloTest(id); 95 setSoloTest(id);
95 runTests(); 96 runTests();
96 } 97 }
97 }); 98 });
98 } 99 }
99 100
100 void onStart() { 101 void onStart() {
101 // Listen for uncaught errors. 102 // Listen for uncaught errors.
102 window.on.error.add(_onErrorClosure); 103 window.on.error.add(_onErrorClosure);
103 } 104 }
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 </div>"""); 281 </div>""");
281 document.query('#group-divs').nodes.add(groupDiv); 282 document.query('#group-divs').nodes.add(groupDiv);
282 groupDiv.query('.groupselect').on.click.add((e) { 283 groupDiv.query('.groupselect').on.click.add((e) {
283 var parent = document.query('#$groupId'); 284 var parent = document.query('#$groupId');
284 InputElement cb = parent.query('.groupselect'); 285 InputElement cb = parent.query('.groupselect');
285 var state = cb.checked; 286 var state = cb.checked;
286 var tests = parent.query('.tests'); 287 var tests = parent.query('.tests');
287 for (Element t in tests.elements) { 288 for (Element t in tests.elements) {
288 cb = t.query('.testselect'); 289 cb = t.query('.testselect');
289 cb.checked = state; 290 cb.checked = state;
290 var testId = Math.parseInt(t.id.substring(_testIdPrefix.length)); 291 var testId = parseInt(t.id.substring(_testIdPrefix.length));
291 if (state) { 292 if (state) {
292 enableTest(testId); 293 enableTest(testId);
293 } else { 294 } else {
294 disableTest(testId); 295 disableTest(testId);
295 } 296 }
296 } 297 }
297 }); 298 });
298 } 299 }
299 var list = groupDiv.query('.tests'); 300 var list = groupDiv.query('.tests');
300 var testItem = list.query('#$_testIdPrefix$id'); 301 var testItem = list.query('#$_testIdPrefix$id');
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 display: block; 648 display: block;
648 list-style-type: disc; 649 list-style-type: disc;
649 -webkit-margin-before: 1em; 650 -webkit-margin-before: 1em;
650 -webkit-margin-after: 1em; 651 -webkit-margin-after: 1em;
651 -webkit-margin-start: 0px; 652 -webkit-margin-start: 0px;
652 -webkit-margin-end: 0px; 653 -webkit-margin-end: 0px;
653 -webkit-padding-start: 40px; 654 -webkit-padding-start: 40px;
654 } 655 }
655 656
656 """; 657 """;
OLDNEW
« no previous file with comments | « pkg/intl/number_format.dart ('k') | runtime/bin/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698