| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:math' as math; | 6 import 'dart:math' as math; |
| 7 | 7 |
| 8 import 'package:scheduled_test/scheduled_test.dart'; | 8 import 'package:scheduled_test/scheduled_test.dart'; |
| 9 | 9 |
| 10 import '../../../pub/entrypoint.dart'; | 10 import '../../../pub/entrypoint.dart'; |
| 11 import '../../../pub/validator.dart'; | 11 import '../../../pub/validator.dart'; |
| 12 import '../../../pub/validator/size.dart'; | 12 import '../../../pub/validator/size.dart'; |
| 13 import '../descriptor.dart' as d; | 13 import '../descriptor.dart' as d; |
| 14 import '../test_pub.dart'; | 14 import '../test_pub.dart'; |
| 15 import 'utils.dart'; | 15 import 'utils.dart'; |
| 16 | 16 |
| 17 Function size(int size) { | 17 Function size(int size) { |
| 18 return (entrypoint) => | 18 return (entrypoint) => |
| 19 new SizeValidator(entrypoint, new Future.immediate(size)); | 19 new SizeValidator(entrypoint, new Future.value(size)); |
| 20 } | 20 } |
| 21 | 21 |
| 22 main() { | 22 main() { |
| 23 initConfig(); | 23 initConfig(); |
| 24 | 24 |
| 25 setUp(d.validPackage.create); | 25 setUp(d.validPackage.create); |
| 26 | 26 |
| 27 integration('should consider a package valid if it is <= 10 MB', () { | 27 integration('should consider a package valid if it is <= 10 MB', () { |
| 28 expectNoValidationError(size(100)); | 28 expectNoValidationError(size(100)); |
| 29 expectNoValidationError(size(10 * math.pow(2, 20))); | 29 expectNoValidationError(size(10 * math.pow(2, 20))); |
| 30 }); | 30 }); |
| 31 | 31 |
| 32 integration('should consider a package invalid if it is more than 10 MB', () { | 32 integration('should consider a package invalid if it is more than 10 MB', () { |
| 33 expectValidationError(size(10 * math.pow(2, 20) + 1)); | 33 expectValidationError(size(10 * math.pow(2, 20) + 1)); |
| 34 }); | 34 }); |
| 35 } | 35 } |
| OLD | NEW |