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

Side by Side Diff: tests/html/filereader_test.dart

Issue 218273002: Upgrading tests with unittest deprecations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 filereader_test; 5 library filereader_test;
6 import 'package:unittest/unittest.dart'; 6 import 'package:unittest/unittest.dart';
7 import 'package:unittest/html_config.dart'; 7 import 'package:unittest/html_config.dart';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'dart:typed_data'; 9 import 'dart:typed_data';
10 10
11 main() { 11 main() {
12 useHtmlConfiguration(); 12 useHtmlConfiguration();
13 13
14 test('readAsText', () { 14 test('readAsText', () {
15 var reader = new FileReader(); 15 var reader = new FileReader();
16 reader.onLoad.listen(expectAsync1((event) { 16 reader.onLoad.listen(expectAsync((event) {
17 var result = reader.result; 17 var result = reader.result;
18 expect(result, equals('hello world')); 18 expect(result, equals('hello world'));
19 })); 19 }));
20 reader.readAsText(new Blob(['hello ', 'world'])); 20 reader.readAsText(new Blob(['hello ', 'world']));
21 }); 21 });
22 22
23 test('readAsArrayBuffer', () { 23 test('readAsArrayBuffer', () {
24 var reader = new FileReader(); 24 var reader = new FileReader();
25 reader.onLoad.listen(expectAsync1((event) { 25 reader.onLoad.listen(expectAsync((event) {
26 var result = reader.result; 26 var result = reader.result;
27 expect(result is Uint8List, isTrue); 27 expect(result is Uint8List, isTrue);
28 expect(result, orderedEquals([65, 66, 67])); 28 expect(result, orderedEquals([65, 66, 67]));
29 })); 29 }));
30 reader.readAsArrayBuffer(new Blob(['ABC'])); 30 reader.readAsArrayBuffer(new Blob(['ABC']));
31 }); 31 });
32 32
33 test('readDataUrl', () { 33 test('readDataUrl', () {
34 var reader = new FileReader(); 34 var reader = new FileReader();
35 reader.onLoad.listen(expectAsync1((event) { 35 reader.onLoad.listen(expectAsync((event) {
36 var result = reader.result; 36 var result = reader.result;
37 expect(result is String, isTrue); 37 expect(result is String, isTrue);
38 expect(result.startsWith('data:'), isTrue); 38 expect(result.startsWith('data:'), isTrue);
39 })); 39 }));
40 reader.readAsDataUrl(new Blob(['ABC'])); 40 reader.readAsDataUrl(new Blob(['ABC']));
41 }); 41 });
42 42
43 } 43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698