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

Side by Side Diff: tests/html/blob_constructor_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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 blob_test; 5 library blob_test;
6
6 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
7 import 'package:unittest/html_config.dart'; 8 import 'package:unittest/html_config.dart';
8 import 'dart:html'; 9 import 'dart:html';
9 import 'dart:typed_data'; 10 import 'dart:typed_data';
10 11
11 main() { 12 main() {
12 useHtmlConfiguration(); 13 useHtmlConfiguration();
13 14
14 test('basic', () { 15 test('basic', () {
15 var b = new Blob([]); 16 var b = new Blob([]);
16 expect(b.size, isZero); 17 expect(b.size, isZero);
17 }); 18 });
18 19
19 test('type1', () { 20 test('type1', () {
20 // OPTIONALS var b = new Blob(['Harry'], type: 'text'); 21 // OPTIONALS var b = new Blob(['Harry'], type: 'text');
21 var b = new Blob(['Harry'], 'text'); 22 var b = new Blob(['Harry'], 'text');
22 expect(b.size, 5); 23 expect(b.size, 5);
23 expect(b.type, 'text'); 24 expect(b.type, 'text');
24 }); 25 });
25 26
26 test('endings1', () { 27 test('endings1', () {
27 // OPTIONALS var b = new Blob(['A\nB\n'], endings: 'transparent'); 28 // OPTIONALS var b = new Blob(['A\nB\n'], endings: 'transparent');
28 var b = new Blob(['A\nB\n'], null, 'transparent'); 29 var b = new Blob(['A\nB\n'], null, 'transparent');
29 expect(b.size, 4); 30 expect(b.size, 4);
30 }); 31 });
31 32
32 test('endings2', () { 33 test('endings2', () {
33 // OPTIONALS var b = new Blob(['A\nB\n'], endings: 'native'); 34 // OPTIONALS var b = new Blob(['A\nB\n'], endings: 'native');
34 var b = new Blob(['A\nB\n'], null, 'native'); 35 var b = new Blob(['A\nB\n'], null, 'native');
35 expect(b.size, (x) => x == 4 || x == 6, 36 expect(b.size, (x) => x == 4 || x == 6, reason: "b.size should be 4 or 6");
36 reason: "b.size should be 4 or 6"); 37 });
37 });
38 38
39 test('twoStrings', () { 39 test('twoStrings', () {
40 // OPTIONALS var b = new Blob(['123', 'xyz'], type: 'text/plain;charset=UT F-8'); 40 // OPTIONALS var b = new Blob(['123', 'xyz'], type: 'text/plain;charset=UTF- 8');
41 var b = new Blob(['123', 'xyz'], 'text/plain;charset=UTF-8'); 41 var b = new Blob(['123', 'xyz'], 'text/plain;charset=UTF-8');
42 expect(b.size, 6); 42 expect(b.size, 6);
43 }); 43 });
44 44
45 test('fromBlob1', () { 45 test('fromBlob1', () {
46 var b1 = new Blob([]); 46 var b1 = new Blob([]);
47 var b2 = new Blob([b1]); 47 var b2 = new Blob([b1]);
48 expect(b2.size, isZero); 48 expect(b2.size, isZero);
49 }); 49 });
50 50
51 test('fromBlob2', () { 51 test('fromBlob2', () {
52 var b1 = new Blob(['x']); 52 var b1 = new Blob(['x']);
53 var b2 = new Blob([b1, b1]); 53 var b2 = new Blob([b1, b1]);
54 expect(b1.size, 1); 54 expect(b1.size, 1);
55 expect(b2.size, 2); 55 expect(b2.size, 2);
56 }); 56 });
57 57
58 test('fromArrayBuffer', () { 58 test('fromArrayBuffer', () {
59 var a = new Uint8List(100).buffer; // i.e. new ArrayBuffer(100); 59 var a = new Uint8List(100).buffer; // i.e. new ArrayBuffer(100);
60 var b = new Blob([a, a]); 60 var b = new Blob([a, a]);
61 expect(b.size, 200); 61 expect(b.size, 200);
62 }); 62 });
63 } 63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698