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

Side by Side Diff: test/codegen/lib/html/serialized_script_value_test.dart

Issue 1930043002: Add all dart:html tests from the sdk to test/codegen. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: ptal Created 4 years, 7 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
(Empty)
1 library SerializedScriptValueTest;
2 import 'package:unittest/unittest.dart';
3 import 'package:unittest/html_config.dart';
4 import 'dart:html';
5 import 'utils.dart';
6
7 serializationTest(name, value) => test(name, () {
8 // To check how value is serialized and deserialized, we create a
9 // MessageEvent.
10 final event =
11 new MessageEvent('', data: value, origin: '', lastEventId: '');
12 verifyGraph(value, event.data);
13 });
14
15
16 main() {
17 useHtmlConfiguration();
18
19 serializationTest('null', null);
20 serializationTest('int', 1);
21 serializationTest('double', 2.39);
22 serializationTest('string', 'hey!');
23
24 final simpleMap = {'a': 100, 'b': 's'};
25 final dagMap = { 'x': simpleMap, 'y': simpleMap };
26 final cyclicMap = { 'b': dagMap };
27 cyclicMap['a'] = cyclicMap;
28 serializationTest('simple map', simpleMap);
29 serializationTest('dag map', dagMap);
30 serializationTest('cyclic map', cyclicMap);
31
32 final simpleList = [ 100, 's'];
33 final dagList = [ simpleList, simpleList ];
34 final cyclicList = [ dagList ];
35 cyclicList.add(cyclicList);
36 serializationTest('simple list', simpleList);
37 serializationTest('dag list', dagList);
38 serializationTest('cyclic list', cyclicList);
39
40 serializationTest('datetime', [new DateTime.now()]);
41
42 var blob = new Blob(
43 ['Indescribable... Indestructible! Nothing can stop it!'],
44 'text/plain');
45 serializationTest('blob', [blob]);
46
47 var canvas = new CanvasElement();
48 canvas.width = 100;
49 canvas.height = 100;
50 var imageData = canvas.context2D.getImageData(0, 0, 1, 1);
51 serializationTest('imagedata', [imageData]);
52 }
OLDNEW
« no previous file with comments | « test/codegen/lib/html/selectelement_test.dart ('k') | test/codegen/lib/html/shadow_dom_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698