Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: tests/lib_strong/async/slow_consumer3_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/lib_strong/async/slow_consumer3_test.dart
diff --git a/tests/lib_strong/async/slow_consumer3_test.dart b/tests/lib_strong/async/slow_consumer3_test.dart
index be12e12ef2418f81753e574e8d1805b4bd0e7018..96ff202fbdd01870504d7e4f03c89e146d40beac 100644
--- a/tests/lib_strong/async/slow_consumer3_test.dart
+++ b/tests/lib_strong/async/slow_consumer3_test.dart
@@ -31,29 +31,27 @@ class SlowConsumer extends StreamConsumer {
Future addStream(Stream stream) {
Completer result = new Completer();
var subscription;
- subscription = stream.listen(
- (List<int> data) {
- receivedCount += data.length;
- usedBufferSize += data.length;
- bufferedData.add(data);
- int currentBufferedDataLength = bufferedData.length;
- if (usedBufferSize > bufferSize) {
- subscription.pause();
- usedBufferSize = 0;
- int ms = data.length * 1000 ~/ bytesPerSecond;
- Duration duration = new Duration(milliseconds: ms);
- new Timer(duration, () {
- for (int i = 0; i < currentBufferedDataLength; i++) {
- bufferedData[i] = null;
- }
- subscription.resume();
- });
- }
- },
- onDone: () {
- finalCount = receivedCount;
- result.complete(receivedCount);
- });
+ subscription = stream.listen((List<int> data) {
+ receivedCount += data.length;
+ usedBufferSize += data.length;
+ bufferedData.add(data);
+ int currentBufferedDataLength = bufferedData.length;
+ if (usedBufferSize > bufferSize) {
+ subscription.pause();
+ usedBufferSize = 0;
+ int ms = data.length * 1000 ~/ bytesPerSecond;
+ Duration duration = new Duration(milliseconds: ms);
+ new Timer(duration, () {
+ for (int i = 0; i < currentBufferedDataLength; i++) {
+ bufferedData[i] = null;
+ }
+ subscription.resume();
+ });
+ }
+ }, onDone: () {
+ finalCount = receivedCount;
+ result.complete(receivedCount);
+ });
return result.future;
}
@@ -86,9 +84,9 @@ main() {
// heap-space.
dataGenerator(100 * MB, 512 * KB)
- .pipe(new SlowConsumer(200 * MB, 3 * MB))
- .then((count) {
- Expect.equals(100 * MB, count);
- asyncEnd();
- });
+ .pipe(new SlowConsumer(200 * MB, 3 * MB))
+ .then((count) {
+ Expect.equals(100 * MB, count);
+ asyncEnd();
+ });
}

Powered by Google App Engine
This is Rietveld 408576698