| 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 library test.backend.metadata; | 5 library test.backend.metadata; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import '../backend/operating_system.dart'; | 9 import '../backend/operating_system.dart'; |
| 10 import '../backend/test_platform.dart'; | 10 import '../backend/test_platform.dart'; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 if (skipReason == null) skipReason = this.skipReason; | 154 if (skipReason == null) skipReason = this.skipReason; |
| 155 if (onPlatform == null) onPlatform = this.onPlatform; | 155 if (onPlatform == null) onPlatform = this.onPlatform; |
| 156 return new Metadata(testOn: testOn, timeout: timeout, skip: skip, | 156 return new Metadata(testOn: testOn, timeout: timeout, skip: skip, |
| 157 verboseTrace: verboseTrace, skipReason: skipReason, | 157 verboseTrace: verboseTrace, skipReason: skipReason, |
| 158 onPlatform: onPlatform); | 158 onPlatform: onPlatform); |
| 159 } | 159 } |
| 160 | 160 |
| 161 /// Returns a copy of [this] with all platform-specific metadata from | 161 /// Returns a copy of [this] with all platform-specific metadata from |
| 162 /// [onPlatform] resolved. | 162 /// [onPlatform] resolved. |
| 163 Metadata forPlatform(TestPlatform platform, {OperatingSystem os}) { | 163 Metadata forPlatform(TestPlatform platform, {OperatingSystem os}) { |
| 164 if (onPlatform.isEmpty) return this; |
| 165 |
| 164 var metadata = this; | 166 var metadata = this; |
| 165 onPlatform.forEach((platformSelector, platformMetadata) { | 167 onPlatform.forEach((platformSelector, platformMetadata) { |
| 166 if (!platformSelector.evaluate(platform, os: os)) return; | 168 if (!platformSelector.evaluate(platform, os: os)) return; |
| 167 metadata = metadata.merge(platformMetadata); | 169 metadata = metadata.merge(platformMetadata); |
| 168 }); | 170 }); |
| 169 return metadata.change(onPlatform: {}); | 171 return metadata.change(onPlatform: {}); |
| 170 } | 172 } |
| 171 | 173 |
| 172 /// Serializes [this] into a JSON-safe object that can be deserialized using | 174 /// Serializes [this] into a JSON-safe object that can be deserialized using |
| 173 /// [new Metadata.deserialize]. | 175 /// [new Metadata.deserialize]. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 186 : timeout.duration.inMicroseconds, | 188 : timeout.duration.inMicroseconds, |
| 187 'scaleFactor': timeout.scaleFactor | 189 'scaleFactor': timeout.scaleFactor |
| 188 }, | 190 }, |
| 189 'skip': skip, | 191 'skip': skip, |
| 190 'skipReason': skipReason, | 192 'skipReason': skipReason, |
| 191 'verboseTrace': verboseTrace, | 193 'verboseTrace': verboseTrace, |
| 192 'onPlatform': serializedOnPlatform | 194 'onPlatform': serializedOnPlatform |
| 193 }; | 195 }; |
| 194 } | 196 } |
| 195 } | 197 } |
| OLD | NEW |