Files
sdk/pkg/telemetry/test/utils_test.dart
T
Devon Carew d355778418 [analyzer] rate limit the crash reports we send
Change-Id: I9f6af7fbcec653a2a9396d1098bea678777d4b3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124761
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2019-11-12 21:37:22 +00:00

24 lines
762 B
Dart

// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:telemetry/src/utils.dart';
import 'package:test/test.dart';
void main() {
group('ThrottlingBucket', () {
test('can send', () {
ThrottlingBucket bucket = new ThrottlingBucket(10, Duration(minutes: 1));
expect(bucket.removeDrop(), true);
});
test("doesn't send too many", () {
ThrottlingBucket bucket = new ThrottlingBucket(10, Duration(minutes: 1));
for (int i = 0; i < 10; i++) {
expect(bucket.removeDrop(), true);
}
expect(bucket.removeDrop(), false);
});
});
}