OLD | NEW |
1 library SerializedScriptValueTest; | |
2 import 'package:unittest/unittest.dart'; | |
3 import 'package:unittest/html_config.dart'; | |
4 import 'dart:html'; | 1 import 'dart:html'; |
| 2 |
| 3 import 'package:expect/minitest.dart'; |
| 4 |
5 import 'utils.dart'; | 5 import 'utils.dart'; |
6 | 6 |
7 serializationTest(name, value) => test(name, () { | 7 serializationTest(name, value) { |
| 8 test(name, () { |
8 // To check how value is serialized and deserialized, we create a | 9 // To check how value is serialized and deserialized, we create a |
9 // MessageEvent. | 10 // MessageEvent. |
10 final event = | 11 final event = |
11 new MessageEvent('', data: value, origin: '', lastEventId: ''); | 12 new MessageEvent('', data: value, origin: '', lastEventId: ''); |
12 verifyGraph(value, event.data); | 13 verifyGraph(value, event.data); |
13 }); | 14 }); |
14 | 15 } |
15 | 16 |
16 main() { | 17 main() { |
17 useHtmlConfiguration(); | |
18 | |
19 serializationTest('null', null); | 18 serializationTest('null', null); |
20 serializationTest('int', 1); | 19 serializationTest('int', 1); |
21 serializationTest('double', 2.39); | 20 serializationTest('double', 2.39); |
22 serializationTest('string', 'hey!'); | 21 serializationTest('string', 'hey!'); |
23 | 22 |
24 final simpleMap = {'a': 100, 'b': 's'}; | 23 final simpleMap = {'a': 100, 'b': 's'}; |
25 final dagMap = { 'x': simpleMap, 'y': simpleMap }; | 24 final dagMap = { 'x': simpleMap, 'y': simpleMap }; |
26 final cyclicMap = { 'b': dagMap }; | 25 final cyclicMap = { 'b': dagMap }; |
27 cyclicMap['a'] = cyclicMap; | 26 cyclicMap['a'] = cyclicMap; |
28 serializationTest('simple map', simpleMap); | 27 serializationTest('simple map', simpleMap); |
(...skipping 14 matching lines...) Expand all Loading... |
43 ['Indescribable... Indestructible! Nothing can stop it!'], | 42 ['Indescribable... Indestructible! Nothing can stop it!'], |
44 'text/plain'); | 43 'text/plain'); |
45 serializationTest('blob', [blob]); | 44 serializationTest('blob', [blob]); |
46 | 45 |
47 var canvas = new CanvasElement(); | 46 var canvas = new CanvasElement(); |
48 canvas.width = 100; | 47 canvas.width = 100; |
49 canvas.height = 100; | 48 canvas.height = 100; |
50 var imageData = canvas.context2D.getImageData(0, 0, 1, 1); | 49 var imageData = canvas.context2D.getImageData(0, 0, 1, 1); |
51 serializationTest('imagedata', [imageData]); | 50 serializationTest('imagedata', [imageData]); |
52 } | 51 } |
OLD | NEW |