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

Side by Side Diff: LayoutTests/fast/storage/serialized-script-value-collections.html

Issue 1205973002: Support structured cloning of ES'15 Map and Set (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add new test for Map/Set serialization format Created 5 years, 6 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
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <script>
5 test(function() {
6 // Serialized version of Map([[1, 2], [3, 4]])
7 var versionNineSerialization = new Uint8Array([
8 0xff, 0x09, 0x3f, 0x00,
9 0x3b, 0x3f, 0x01, 0x49,
10 0x02, 0x3f, 0x01, 0x49,
11 0x04, 0x3f, 0x01, 0x49,
12 0x06, 0x3f, 0x01, 0x49,
13 0x08, 0x3a, 0x04, 0x00]);
14 var map = internals.deserializeBuffer(versionNineSerialization.buffer);
15 assert_true(map instanceof Map, 'Should be an instance of Map');
16 assert_equals(map.size, 2, 'Should have two elements');
17 assert_equals(map.get(1), 2, 'Should contain the pair [1, 2]');
18 assert_equals(map.get(3), 4, 'Should contain the number [3, 4]');
19 }, 'Should be able to deserialize a Map in version 9 format');
20
21 test(function() {
22 // Serialized version of Set([1, 2])
23 var versionNineSerialization = new Uint8Array([
24 0xff, 0x09, 0x3f, 0x00, 0x27,
25 0x3f, 0x01, 0x49, 0x02, 0x3f,
26 0x01, 0x49, 0x04, 0x2c, 0x02,
27 0x00]);
28 var set = internals.deserializeBuffer(versionNineSerialization.buffer);
29 assert_true(set instanceof Set, 'Should be an instance of Set');
30 assert_equals(set.size, 2, 'Should have two elements');
31 assert_true(set.has(1), 'Should contain the number 1');
32 assert_true(set.has(2), 'Should contain the number 2');
33 }, 'Should be able to deserialize a Set in version 9 format');
34 </script>
OLDNEW
« no previous file with comments | « LayoutTests/fast/storage/resources/serialized-script-value.js ('k') | Source/bindings/core/v8/ScriptValueSerializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698