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

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

Issue 11184007: Support new named arguments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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) 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 #import('../../pkg/unittest/unittest.dart'); 6 #import('../../pkg/unittest/unittest.dart');
7 #import('../../pkg/unittest/html_config.dart'); 7 #import('../../pkg/unittest/html_config.dart');
8 #import('dart:html'); 8 #import('dart:html');
9 9
10 main() { 10 main() {
11 useHtmlConfiguration(); 11 useHtmlConfiguration();
12 12
13 test('basic', () { 13 test('basic', () {
14 var b = new Blob([]); 14 var b = new Blob([]);
15 expect(b.size, 0); 15 expect(b.size, 0);
16 }); 16 });
17 17
18 test('type1', () { 18 test('type1', () {
19 var b = new Blob(['Harry'], type: 'text'); 19 // OPTIONALS var b = new Blob(['Harry'], type: 'text');
20 var b = new Blob(['Harry'], 'text');
20 expect(b.size, 5); 21 expect(b.size, 5);
21 expect(b.type, 'text'); 22 expect(b.type, 'text');
22 }); 23 });
23 24
24 test('endings1', () { 25 test('endings1', () {
25 var b = new Blob(['A\nB\n'], endings: 'transparent'); 26 // OPTIONALS var b = new Blob(['A\nB\n'], endings: 'transparent');
27 var b = new Blob(['A\nB\n'], null, 'transparent');
26 expect(b.size, 4); 28 expect(b.size, 4);
27 }); 29 });
28 30
29 test('endings2', () { 31 test('endings2', () {
30 var b = new Blob(['A\nB\n'], endings: 'native'); 32 // OPTIONALS var b = new Blob(['A\nB\n'], endings: 'native');
33 var b = new Blob(['A\nB\n'], null, 'native');
31 expect(b.size, (x) => x == 4 || x == 6); 34 expect(b.size, (x) => x == 4 || x == 6);
32 }); 35 });
33 36
34 test('twoStrings', () { 37 test('twoStrings', () {
35 var b = new Blob(['123', 'xyz'], type: 'text/plain;charset=UTF-8'); 38 // OPTIONALS var b = new Blob(['123', 'xyz'], type: 'text/plain;charset=UT F-8');
39 var b = new Blob(['123', 'xyz'], 'text/plain;charset=UTF-8');
36 expect(b.size, 6); 40 expect(b.size, 6);
37 }); 41 });
38 42
39 test('fromBlob1', () { 43 test('fromBlob1', () {
40 var b1 = new Blob([]); 44 var b1 = new Blob([]);
41 var b2 = new Blob([b1]); 45 var b2 = new Blob([b1]);
42 expect(b2.size, 0); 46 expect(b2.size, 0);
43 }); 47 });
44 48
45 test('fromBlob2', () { 49 test('fromBlob2', () {
46 var b1 = new Blob(['x']); 50 var b1 = new Blob(['x']);
47 var b2 = new Blob([b1, b1]); 51 var b2 = new Blob([b1, b1]);
48 expect(b1.size, 1); 52 expect(b1.size, 1);
49 expect(b2.size, 2); 53 expect(b2.size, 2);
50 }); 54 });
51 55
52 test('fromArrayBuffer', () { 56 test('fromArrayBuffer', () {
53 var a = new Uint8Array(100).buffer; // i.e. new ArrayBuffer(100); 57 var a = new Uint8Array(100).buffer; // i.e. new ArrayBuffer(100);
54 var b = new Blob([a, a]); 58 var b = new Blob([a, a]);
55 expect(b.size, 200); 59 expect(b.size, 200);
56 }); 60 });
57 } 61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698