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

Side by Side Diff: LayoutTests/fast/canvas/webgl/script-tests/arraybuffer-transfer-of-control.js

Issue 114363002: Structured cloning: improve DataCloneError reporting. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased + reset V8TestInterfaceConstructor.cpp result Created 7 years 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
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Window/anonymous-slot-with-changes-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 window.jsTestIsAsync = true; 1 window.jsTestIsAsync = true;
2 2
3 description('Test transfer of control semantics for ArrayBuffers.'); 3 description('Test transfer of control semantics for ArrayBuffers.');
4 window.testsComplete = 0; 4 window.testsComplete = 0;
5 5
6 var arraySize = 40; 6 var arraySize = 40;
7 var arrayOffset = 8; 7 var arrayOffset = 8;
8 var arrayEffectiveSize = arraySize - arrayOffset; 8 var arrayEffectiveSize = arraySize - arrayOffset;
9 9
10 var basicBufferTypes = 10 var basicBufferTypes =
(...skipping 13 matching lines...) Expand all
24 [ 24 [
25 ["Int32", Int32Array, 4], 25 ["Int32", Int32Array, 4],
26 ["Uint32", Uint32Array, 4], 26 ["Uint32", Uint32Array, 4],
27 ["Int8", Int8Array, 1], 27 ["Int8", Int8Array, 1],
28 ["Uint8", Uint8Array, 1], 28 ["Uint8", Uint8Array, 1],
29 ["Uint8Clamped", Uint8ClampedArray, 1], 29 ["Uint8Clamped", Uint8ClampedArray, 1],
30 ["Int16", Int16Array, 2], 30 ["Int16", Int16Array, 2],
31 ["Uint16", Uint16Array, 2], 31 ["Uint16", Uint16Array, 2],
32 ["Float32", Float32Array, 4], 32 ["Float32", Float32Array, 4],
33 ["Float64", Float64Array, 8], 33 ["Float64", Float64Array, 8],
34 ["DataView", DataView, 1] 34 ["DataView", DataView, 1]
35 ]; 35 ];
36 36
37 function isTypedArray(view) 37 function isTypedArray(view)
38 { 38 {
39 for (var i = 0; i < basicBufferTypes.length; ++i) { 39 for (var i = 0; i < basicBufferTypes.length; ++i) {
40 var bufferType = basicBufferTypes[i]; 40 var bufferType = basicBufferTypes[i];
41 if (view instanceof bufferType[1]) { 41 if (view instanceof bufferType[1]) {
42 return true; 42 return true;
43 } 43 }
44 } 44 }
45 return false; 45 return false;
46 } 46 }
47 47
48 function isDataView(view) 48 function isDataView(view)
49 { 49 {
50 return (view instanceof DataView); 50 return (view instanceof DataView);
51 } 51 }
52 52
53 function isArrayBuffer(buffer) 53 function isArrayBuffer(buffer)
54 { 54 {
55 return (buffer instanceof ArrayBuffer); 55 return (buffer instanceof ArrayBuffer);
56 } 56 }
57 57
58 function isDataCloneError(e)
59 {
60 return (e.name === "DataCloneError");
61 }
62
58 function assertBufferClosed(testName, buffer) 63 function assertBufferClosed(testName, buffer)
59 { 64 {
60 if (buffer === null) { 65 if (buffer === null) {
61 return true; 66 return true;
62 } 67 }
63 if (!isArrayBuffer(buffer)) { 68 if (!isArrayBuffer(buffer)) {
64 testFailed(testName + ": not an array buffer (" + buffer + ")"); 69 testFailed(testName + ": not an array buffer (" + buffer + ")");
65 return false; 70 return false;
66 } 71 }
67 if (buffer.byteLength !== 0 || !(buffer.byteLength === 0)) { 72 if (buffer.byteLength !== 0 || !(buffer.byteLength === 0)) {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 return false; 255 return false;
251 } 256 }
252 return true; 257 return true;
253 } 258 }
254 259
255 function wrapFailSend(testName, message, xfer) 260 function wrapFailSend(testName, message, xfer)
256 { 261 {
257 try { 262 try {
258 window.postMessage(message, '*', xfer); 263 window.postMessage(message, '*', xfer);
259 } catch (e) { 264 } catch (e) {
265 if (!isDataCloneError(e)) {
266 testFailed(testName + ": expected postMessage to throw DataCloneErro r but it didn't.");
267 return false;
268 }
260 return true; 269 return true;
261 } 270 }
262 testFailed(testName + ": expected postMessage to fail but it didn't."); 271 testFailed(testName + ": expected postMessage to fail but it didn't.");
263 return false; 272 return false;
264 } 273 }
265 274
266 var testList = [{ 275 var testList = [{
267 name: "sanity check", 276 name: "sanity check",
268 send: function (name) { wrapSend(name, [], []); }, 277 send: function (name) { wrapSend(name, [], []); },
269 test: function (name, e) { return true; } 278 test: function (name, e) { return true; }
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 } 456 }
448 doneTest(); 457 doneTest();
449 } 458 }
450 459
451 window.addEventListener('message', windowHandleMessage); 460 window.addEventListener('message', windowHandleMessage);
452 window.testsComplete = -1; 461 window.testsComplete = -1;
453 doneTest(); 462 doneTest();
454 463
455 successfullyParsed = true; 464 successfullyParsed = true;
456 465
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Window/anonymous-slot-with-changes-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698