Chromium Code Reviews| 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 /// A unit test library for running groups of tests in a browser, instead of the | 5 /// A unit test library for running groups of tests in a browser, instead of the |
| 6 /// entire test file. This is especially used for large tests files that have | 6 /// entire test file. This is especially used for large tests files that have |
| 7 /// many subtests, so we can mark groups as failing at a finer granularity than | 7 /// many subtests, so we can mark groups as failing at a finer granularity than |
| 8 /// the entire test file. | 8 /// the entire test file. |
| 9 /// | 9 /// |
| 10 /// To use, import this file, and call [useHtmlIndividualConfiguration] at the | 10 /// To use, import this file, and call [useHtmlIndividualConfiguration] at the |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 .split('&') | 27 .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 testGroupName = | |
| 38 testGroupName.replaceAll('+', ' ').replaceAll('%20', ' '); | |
|
nweiz
2015/05/07 01:41:53
We should use the Uri class to parse this rather t
kevmoo
2015/05/07 22:39:45
Done.
| |
| 37 var startsWith = "$testGroupName${unittest.groupSep}"; | 39 var startsWith = "$testGroupName${unittest.groupSep}"; |
| 38 unittest.filterTests( | 40 unittest.filterTests( |
| 39 (unittest.TestCase tc) => tc.description.startsWith(startsWith)); | 41 (unittest.TestCase tc) => tc.description.startsWith(startsWith)); |
| 40 } | 42 } |
| 41 } | 43 } |
| 42 super.onStart(); | 44 super.onStart(); |
| 43 } | 45 } |
| 44 } | 46 } |
| 45 | 47 |
| 46 void useHtmlIndividualConfiguration([bool isLayoutTest = false]) { | 48 void useHtmlIndividualConfiguration([bool isLayoutTest = false]) { |
| 47 unittest.unittestConfiguration = | 49 unittest.unittestConfiguration = |
| 48 isLayoutTest ? _singletonLayout : _singletonNotLayout; | 50 isLayoutTest ? _singletonLayout : _singletonNotLayout; |
| 49 } | 51 } |
| 50 | 52 |
| 51 final _singletonLayout = new HtmlIndividualConfiguration(true); | 53 final _singletonLayout = new HtmlIndividualConfiguration(true); |
| 52 final _singletonNotLayout = new HtmlIndividualConfiguration(false); | 54 final _singletonNotLayout = new HtmlIndividualConfiguration(false); |
| OLD | NEW |