| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 * A unit test library for running groups of tests in a browser, instead of the | 6 * A unit test library for running groups of tests in a browser, instead of the |
| 7 * entire test file. This is especially used for large tests files that have | 7 * entire test file. This is especially used for large tests files that have |
| 8 * many subtests, so we can mark groups as failing at a finer granularity than | 8 * many subtests, so we can mark groups as failing at a finer granularity than |
| 9 * the entire test file. | 9 * the entire test file. |
| 10 * | 10 * |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class HtmlIndividualConfiguration extends htmlconfig.HtmlConfiguration { | 21 class HtmlIndividualConfiguration extends htmlconfig.HtmlConfiguration { |
| 22 HtmlIndividualConfiguration(bool isLayoutTest): super(isLayoutTest); | 22 HtmlIndividualConfiguration(bool isLayoutTest): super(isLayoutTest); |
| 23 | 23 |
| 24 void onStart() { | 24 void onStart() { |
| 25 var search = window.location.search; | 25 var search = window.location.search; |
| 26 if (search != '') { | 26 if (search != '') { |
| 27 var groups = search.substring(1).split('&') | 27 var groups = search.substring(1).split('&') |
| 28 .where((p) => p.startsWith('group=')) | 28 .where((p) => p.startsWith('group=')) |
| 29 .toList(); | 29 .toList(); |
| 30 | 30 |
| 31 if(!groups.isEmpty) { | 31 if (!groups.isEmpty) { |
| 32 if(groups.length > 1) { | 32 if (groups.length > 1) { |
| 33 throw new ArgumentError('More than one "group" parameter provided.'); | 33 throw new ArgumentError('More than one "group" parameter provided.'); |
| 34 } | 34 } |
| 35 | 35 |
| 36 var testGroupName = groups.single.split('=')[1]; | 36 var testGroupName = groups.single.split('=')[1]; |
| 37 var startsWith = "$testGroupName${unittest.groupSep}"; | 37 var startsWith = "$testGroupName${unittest.groupSep}"; |
| 38 unittest.filterTests((unittest.TestCase tc) => | 38 unittest.filterTests((unittest.TestCase tc) => |
| 39 tc.description.startsWith(startsWith)); | 39 tc.description.startsWith(startsWith)); |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 super.onStart(); | 42 super.onStart(); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 void useHtmlIndividualConfiguration([bool isLayoutTest = false]) { | 46 void useHtmlIndividualConfiguration([bool isLayoutTest = false]) { |
| 47 unittest.unittestConfiguration = isLayoutTest ? _singletonLayout : _singletonN
otLayout; | 47 unittest.unittestConfiguration = isLayoutTest ? _singletonLayout : _singletonN
otLayout; |
| 48 } | 48 } |
| 49 | 49 |
| 50 final _singletonLayout = new HtmlIndividualConfiguration(true); | 50 final _singletonLayout = new HtmlIndividualConfiguration(true); |
| 51 final _singletonNotLayout = new HtmlIndividualConfiguration(false); | 51 final _singletonNotLayout = new HtmlIndividualConfiguration(false); |
| OLD | NEW |