| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:collection'; | 5 import 'dart:collection'; |
| 6 | 6 |
| 7 import 'package:boolean_selector/boolean_selector.dart'; | 7 import 'package:boolean_selector/boolean_selector.dart'; |
| 8 import 'package:collection/collection.dart'; | 8 import 'package:collection/collection.dart'; |
| 9 | 9 |
| 10 import '../frontend/skip.dart'; | 10 import '../frontend/skip.dart'; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 /// | 51 /// |
| 52 /// This is guaranteed not to have any keys that match [tags]; those are | 52 /// This is guaranteed not to have any keys that match [tags]; those are |
| 53 /// resolved when the metadata is constructed. | 53 /// resolved when the metadata is constructed. |
| 54 final Map<BooleanSelector, Metadata> forTag; | 54 final Map<BooleanSelector, Metadata> forTag; |
| 55 | 55 |
| 56 /// Parses a user-provided map into the value for [onPlatform]. | 56 /// Parses a user-provided map into the value for [onPlatform]. |
| 57 static Map<PlatformSelector, Metadata> _parseOnPlatform( | 57 static Map<PlatformSelector, Metadata> _parseOnPlatform( |
| 58 Map<String, dynamic> onPlatform) { | 58 Map<String, dynamic> onPlatform) { |
| 59 if (onPlatform == null) return {}; | 59 if (onPlatform == null) return {}; |
| 60 | 60 |
| 61 var result = {}; | 61 var result = <PlatformSelector, Metadata>{}; |
| 62 onPlatform.forEach((platform, metadata) { | 62 onPlatform.forEach((platform, metadata) { |
| 63 if (metadata is Timeout || metadata is Skip) { | 63 if (metadata is Timeout || metadata is Skip) { |
| 64 metadata = [metadata]; | 64 metadata = [metadata]; |
| 65 } else if (metadata is! List) { | 65 } else if (metadata is! List) { |
| 66 throw new ArgumentError('Metadata for platform "$platform" must be a ' | 66 throw new ArgumentError('Metadata for platform "$platform" must be a ' |
| 67 'Timeout, Skip, or List of those; was "$metadata".'); | 67 'Timeout, Skip, or List of those; was "$metadata".'); |
| 68 } | 68 } |
| 69 | 69 |
| 70 var selector = new PlatformSelector.parse(platform); | 70 var selector = new PlatformSelector.parse(platform); |
| 71 | 71 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 _serializeTimeout(Timeout timeout) { | 316 _serializeTimeout(Timeout timeout) { |
| 317 if (timeout == Timeout.none) return 'none'; | 317 if (timeout == Timeout.none) return 'none'; |
| 318 return { | 318 return { |
| 319 'duration': timeout.duration == null | 319 'duration': timeout.duration == null |
| 320 ? null | 320 ? null |
| 321 : timeout.duration.inMicroseconds, | 321 : timeout.duration.inMicroseconds, |
| 322 'scaleFactor': timeout.scaleFactor | 322 'scaleFactor': timeout.scaleFactor |
| 323 }; | 323 }; |
| 324 } | 324 } |
| 325 } | 325 } |
| OLD | NEW |