| 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 '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('dart:math'); |
| 19 #import('unittest.dart'); | 19 #import('unittest.dart'); |
| 20 | 20 |
| 21 /** The messages exchanged between master and slave. */ | 21 /** The messages exchanged between master and slave. */ |
| 22 | 22 |
| 23 class _Message { | 23 class _Message { |
| 24 static final START = 'start'; | 24 static const START = 'start'; |
| 25 static final LOG = 'log'; | 25 static const LOG = 'log'; |
| 26 static final STACK = 'stack'; | 26 static const STACK = 'stack'; |
| 27 static final PASS = 'pass'; | 27 static const PASS = 'pass'; |
| 28 static final FAIL = 'fail'; | 28 static const FAIL = 'fail'; |
| 29 static final ERROR = 'error'; | 29 static const ERROR = 'error'; |
| 30 | 30 |
| 31 String messageType; | 31 String messageType; |
| 32 int elapsed; | 32 int elapsed; |
| 33 String body; | 33 String body; |
| 34 | 34 |
| 35 static String text(String messageType, | 35 static String text(String messageType, |
| 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 = '']); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 _doneWrap = true; | 236 _doneWrap = true; |
| 237 for (int i = 0; i < testCases.length; i++) { | 237 for (int i = 0; i < testCases.length; i++) { |
| 238 testCases[i].test = wrapTest(testCases[i]); | 238 testCases[i].test = wrapTest(testCases[i]); |
| 239 testCases[i].setUp = null; | 239 testCases[i].setUp = null; |
| 240 testCases[i].tearDown = null; | 240 testCases[i].tearDown = null; |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 window.on.message.add(_messageHandler); | 243 window.on.message.add(_messageHandler); |
| 244 } | 244 } |
| 245 | 245 |
| 246 static final _notAlphaNumeric = const RegExp('[^a-z0-9A-Z]'); | 246 static const _notAlphaNumeric = const RegExp('[^a-z0-9A-Z]'); |
| 247 | 247 |
| 248 String _stringToDomId(String s) { | 248 String _stringToDomId(String s) { |
| 249 if (s.length == 0) { | 249 if (s.length == 0) { |
| 250 return '-None-'; | 250 return '-None-'; |
| 251 } | 251 } |
| 252 return s.trim().replaceAll(_notAlphaNumeric, '-'); | 252 return s.trim().replaceAll(_notAlphaNumeric, '-'); |
| 253 } | 253 } |
| 254 | 254 |
| 255 // Used for DOM element IDs for tests result list entries. | 255 // Used for DOM element IDs for tests result list entries. |
| 256 static final _testIdPrefix = 'test-'; | 256 static const _testIdPrefix = 'test-'; |
| 257 // Used for DOM element IDs for test log message lists. | 257 // Used for DOM element IDs for test log message lists. |
| 258 static final _actionIdPrefix = 'act-'; | 258 static const _actionIdPrefix = 'act-'; |
| 259 // Used for DOM element IDs for test checkboxes. | 259 // Used for DOM element IDs for test checkboxes. |
| 260 static final _selectedIdPrefix = 'selected-'; | 260 static const _selectedIdPrefix = 'selected-'; |
| 261 | 261 |
| 262 void onTestStart(TestCase testCase) { | 262 void onTestStart(TestCase testCase) { |
| 263 var id = testCase.id; | 263 var id = testCase.id; |
| 264 _testStarts[testCase.id]= new Date.now(); | 264 _testStarts[testCase.id]= new Date.now(); |
| 265 super.onTestStart(testCase); | 265 super.onTestStart(testCase); |
| 266 _stack = null; | 266 _stack = null; |
| 267 // Convert the group name to a DOM id. | 267 // Convert the group name to a DOM id. |
| 268 String groupId = _stringToDomId(testCase.currentGroup); | 268 String groupId = _stringToDomId(testCase.currentGroup); |
| 269 // Get the div for the group. If it doesn't exist, | 269 // Get the div for the group. If it doesn't exist, |
| 270 // create it. | 270 // create it. |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 display: block; | 648 display: block; |
| 649 list-style-type: disc; | 649 list-style-type: disc; |
| 650 -webkit-margin-before: 1em; | 650 -webkit-margin-before: 1em; |
| 651 -webkit-margin-after: 1em; | 651 -webkit-margin-after: 1em; |
| 652 -webkit-margin-start: 0px; | 652 -webkit-margin-start: 0px; |
| 653 -webkit-margin-end: 0px; | 653 -webkit-margin-end: 0px; |
| 654 -webkit-padding-start: 40px; | 654 -webkit-padding-start: 40px; |
| 655 } | 655 } |
| 656 | 656 |
| 657 """; | 657 """; |
| OLD | NEW |