Chromium Code Reviews| 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:io'; | 6 import 'dart:io'; |
| 7 | 7 |
| 8 import "package:async_helper/async_helper.dart"; | 8 import "package:async_helper/async_helper.dart"; |
| 9 import "package:expect/expect.dart"; | 9 import "package:expect/expect.dart"; |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 | 25 |
| 26 void testZLibDeflateEmptyGzip() { | 26 void testZLibDeflateEmptyGzip() { |
| 27 asyncStart(); | 27 asyncStart(); |
| 28 var controller = new StreamController(sync: true); | 28 var controller = new StreamController(sync: true); |
| 29 controller.stream.transform(new ZLibEncoder(gzip: true, level: 6)) | 29 controller.stream.transform(new ZLibEncoder(gzip: true, level: 6)) |
| 30 .fold([], (buffer, data) { | 30 .fold([], (buffer, data) { |
| 31 buffer.addAll(data); | 31 buffer.addAll(data); |
| 32 return buffer; | 32 return buffer; |
| 33 }) | 33 }) |
| 34 .then((data) { | 34 .then((data) { |
| 35 Expect.listEquals([31, 139, 8, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, | 35 Expect.listEquals([], new ZLibDecoder().convert(data)); |
| 36 0, 0, 0], data); | |
| 37 asyncEnd(); | 36 asyncEnd(); |
| 38 }); | 37 }); |
| 39 controller.close(); | 38 controller.close(); |
| 40 } | 39 } |
| 41 | 40 |
| 42 void testZLibDeflate() { | 41 void testZLibDeflate() { |
| 43 asyncStart(); | 42 asyncStart(); |
| 44 var data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; | 43 var data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; |
| 45 var controller = new StreamController(sync: true); | 44 var controller = new StreamController(sync: true); |
| 46 controller.stream.transform(new ZLibEncoder(gzip: false, level: 6)) | 45 controller.stream.transform(new ZLibEncoder(gzip: false, level: 6)) |
| 47 .fold([], (buffer, data) { | 46 .fold([], (buffer, data) { |
| 48 buffer.addAll(data); | 47 buffer.addAll(data); |
| 49 return buffer; | 48 return buffer; |
| 50 }) | 49 }) |
| 51 .then((data) { | 50 .then((data) { |
| 51 Expect.isTrue(data.length > 0); | |
|
Lasse Reichstein Nielsen
2014/03/03 12:24:22
Move where it belongs.
Anders Johnsen
2014/03/03 12:24:59
Done.
| |
| 52 Expect.listEquals( | 52 Expect.listEquals( |
| 53 [120, 156, 99, 96, 100, 98, 102, 97, 101, 99, 231, 224, 4, 0, 0, | 53 [120, 156, 99, 96, 100, 98, 102, 97, 101, 99, 231, 224, 4, 0, 0, |
| 54 175, 0, 46], | 54 175, 0, 46], |
| 55 data); | 55 data); |
| 56 asyncEnd(); | 56 asyncEnd(); |
| 57 }); | 57 }); |
| 58 controller.add(data); | 58 controller.add(data); |
| 59 controller.close(); | 59 controller.close(); |
| 60 } | 60 } |
| 61 | 61 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 testZLibDeflateInvalidLevel(); | 229 testZLibDeflateInvalidLevel(); |
| 230 testZLibInflate(); | 230 testZLibInflate(); |
| 231 testZLibInflateSync(); | 231 testZLibInflateSync(); |
| 232 testZlibInflateThrowsWithSmallerWindow(); | 232 testZlibInflateThrowsWithSmallerWindow(); |
| 233 testZlibInflateWithLargerWindow(); | 233 testZlibInflateWithLargerWindow(); |
| 234 testZLibDeflateRaw(); | 234 testZLibDeflateRaw(); |
| 235 testZLibInflateRaw(); | 235 testZLibInflateRaw(); |
| 236 testZlibWithDictionary(); | 236 testZlibWithDictionary(); |
| 237 asyncEnd(); | 237 asyncEnd(); |
| 238 } | 238 } |
| OLD | NEW |