mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 14:32:49 +00:00
b8f4b252ef
Change-Id: I75130cc8d5964ef0f95a672858da8bbce8ffd78c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200520 Commit-Queue: Devon Carew <devoncarew@google.com> Reviewed-by: Phil Quitslund <pquitslund@google.com>
24 lines
754 B
Dart
24 lines
754 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 = ThrottlingBucket(10, Duration(minutes: 1));
|
|
expect(bucket.removeDrop(), true);
|
|
});
|
|
|
|
test("doesn't send too many", () {
|
|
ThrottlingBucket bucket = ThrottlingBucket(10, Duration(minutes: 1));
|
|
for (int i = 0; i < 10; i++) {
|
|
expect(bucket.removeDrop(), true);
|
|
}
|
|
expect(bucket.removeDrop(), false);
|
|
});
|
|
});
|
|
}
|