| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 usage.impl_test; | 5 library usage.impl_test; |
| 6 | 6 |
| 7 import 'package:unittest/unittest.dart'; | 7 import 'package:test/test.dart'; |
| 8 import 'package:usage/src/usage_impl.dart'; | 8 import 'package:usage/src/usage_impl.dart'; |
| 9 | 9 |
| 10 import 'src/common.dart'; | 10 import 'src/common.dart'; |
| 11 | 11 |
| 12 main() => defineTests(); |
| 13 |
| 12 void defineTests() { | 14 void defineTests() { |
| 13 group('ThrottlingBucket', () { | 15 group('ThrottlingBucket', () { |
| 14 test('can send', () { | 16 test('can send', () { |
| 15 ThrottlingBucket bucket = new ThrottlingBucket(20); | 17 ThrottlingBucket bucket = new ThrottlingBucket(20); |
| 16 expect(bucket.removeDrop(), true); | 18 expect(bucket.removeDrop(), true); |
| 17 }); | 19 }); |
| 18 | 20 |
| 19 test('doesn\'t send too many', () { | 21 test('doesn\'t send too many', () { |
| 20 ThrottlingBucket bucket = new ThrottlingBucket(20); | 22 ThrottlingBucket bucket = new ThrottlingBucket(20); |
| 21 for (int i = 0; i < 20; i++) { | 23 for (int i = 0; i < 20; i++) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 AnalyticsImplMock mock = createMock(); | 59 AnalyticsImplMock mock = createMock(); |
| 58 mock.sendScreenView('foo'); | 60 mock.sendScreenView('foo'); |
| 59 mock.sendScreenView('bar'); | 61 mock.sendScreenView('bar'); |
| 60 mock.sendScreenView('baz'); | 62 mock.sendScreenView('baz'); |
| 61 return mock.waitForLastPing(timeout: new Duration(milliseconds: 100)); | 63 return mock.waitForLastPing(timeout: new Duration(milliseconds: 100)); |
| 62 }); | 64 }); |
| 63 }); | 65 }); |
| 64 | 66 |
| 65 group('postEncode', () { | 67 group('postEncode', () { |
| 66 test('simple', () { | 68 test('simple', () { |
| 67 Map map = {'foo': 'bar', 'baz': 'qux norf'}; | 69 Map<String, dynamic> map = {'foo': 'bar', 'baz': 'qux norf'}; |
| 68 expect(postEncode(map), 'foo=bar&baz=qux%20norf'); | 70 expect(postEncode(map), 'foo=bar&baz=qux%20norf'); |
| 69 }); | 71 }); |
| 70 }); | 72 }); |
| 71 } | 73 } |
| OLD | NEW |