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

Side by Side Diff: LayoutTests/fast/js/structured-clone.html

Issue 1185703009: Work In Progress: Handle Maps and Sets in Structured Clone (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
« no previous file with comments | « no previous file | Source/bindings/core/v8/ScriptValueSerializer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <script src="../../resources/testharness.js"></script> 2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script> 3 <script src="../../resources/testharnessreport.js"></script>
4 <script> 4 <script>
5 function promise_test(func, name, properties) { 5 function promise_test(func, name, properties) {
6 properties = properties || {}; 6 properties = properties || {};
7 var test = async_test(name, properties); 7 var test = async_test(name, properties);
8 Promise.resolve(test.step(func, test, test)) 8 Promise.resolve(test.step(func, test, test))
9 .then(function() { test.done(); }) 9 .then(function() { test.done(); })
10 .catch(test.step_func(function(value) { throw value; })); 10 .catch(test.step_func(function(value) { throw value; }));
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 assert_true(orig.hasOwnProperty(name)); 112 assert_true(orig.hasOwnProperty(name));
113 113
114 return structuredClone(orig).then(function(clone) { 114 return structuredClone(orig).then(function(clone) {
115 assert_true(Array.isArray(clone), 'Clone should be an Array'); 115 assert_true(Array.isArray(clone), 'Clone should be an Array');
116 assert_false(setter_called, 'Setter should not be called by cloning algo rithm.'); 116 assert_false(setter_called, 'Setter should not be called by cloning algo rithm.');
117 assert_true(clone.hasOwnProperty(name), 'Cloning algorithm should add an own property.') 117 assert_true(clone.hasOwnProperty(name), 'Cloning algorithm should add an own property.')
118 assert_equals(clone[name], orig[name], 'Property value should match'); 118 assert_equals(clone[name], orig[name], 'Property value should match');
119 }); 119 });
120 }, 'Verify: "Add a new property..." (dense arrays)'); 120 }, 'Verify: "Add a new property..." (dense arrays)');
121 121
122 promise_test(function() {
123 var orig = {
124 emptySet: new Set,
125 set: new Set([1, 2, 3]),
126 emptyMap: new Map,
127 map: new Map([[1, 2], [3, 4]])
128 };
129 return structuredClone(orig).then(function(clone) {
130 assert_true(clone.emptySet instanceof Set, 'Clone should be a Set');
131 assert_true(clone.emptyMap instanceof Map, 'Clone should be a Map');
132 assert_true(clone.set instanceof Set, 'Clone should be a Set');
133 assert_true(clone.map instanceof Map, 'Clone should be a Map');
134 assert_equals(clone.set.size, orig.set.size, 'Clone should be the same s ize');
135 assert_equals(clone.map.size, orig.map.size, 'Clone should be the same s ize');
136 });
137 }, 'Verify: "Maps and Sets are cloned..."');
138
122 </script> 139 </script>
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/ScriptValueSerializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698