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

Side by Side Diff: LayoutTests/fast/storage/resources/serialized-script-value.js

Issue 23992003: blob hacking webcore style (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 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
1 function expectBufferValue(bytesPerElement, expectedValues, buffer) { 1 function expectBufferValue(bytesPerElement, expectedValues, buffer) {
2 expectedBufferValues = expectedValues; 2 expectedBufferValues = expectedValues;
3 var arrayClass; 3 var arrayClass;
4 if (bytesPerElement == 1) 4 if (bytesPerElement == 1)
5 arrayClass = Uint8Array; 5 arrayClass = Uint8Array;
6 else 6 else
7 arrayClass = Uint16Array; 7 arrayClass = Uint16Array;
8 bufferView = new arrayClass(buffer); 8 bufferView = new arrayClass(buffer);
9 shouldBe("bufferView.length", "expectedBufferValues.length"); 9 shouldBe("bufferView.length", "expectedBufferValues.length");
10 var success = (bufferView.length == expectedBufferValues.length); 10 var success = (bufferView.length == expectedBufferValues.length);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 return; 86 return;
87 } else { 87 } else {
88 self.thrownException = e; 88 self.thrownException = e;
89 self.expectedException = serializeExceptionValue; 89 self.expectedException = serializeExceptionValue;
90 shouldBe("thrownException.code", "expectedException"); 90 shouldBe("thrownException.code", "expectedException");
91 return; 91 return;
92 } 92 }
93 } 93 }
94 expectBufferValue(bytesPerElement, values, serialized); 94 expectBufferValue(bytesPerElement, values, serialized);
95 } 95 }
96
97 function testBlobSerialization() {
98 debug("");
99 self.blobObj1 = new Blob(['Hi'], {type: 'text/plain'});
100 self.blobObj2 = internals.deserializeBuffer(internals.serializeObject(blobOb j1));
101 shouldBeTrue("areValuesIdentical(blobObj1, blobObj2)");
102 self.dictionaryWithBlob1 = {blob: blobObj1, string: 'stringValue'};
103 self.dictionaryWithBlob2 = internals.deserializeBuffer(internals.serializeOb ject(dictionaryWithBlob1));
104 shouldBeTrue("areValuesIdentical(dictionaryWithBlob1, dictionaryWithBlob2)") ;
105
106 // Compare contents too.
107 var xhr1 = new XMLHttpRequest();
108 xhr1.open("GET", URL.createObjectURL(self.blobObj1), false);
109 xhr1.send();
110 self.blobContent1 = xhr1.response;
111 var xhr2 = new XMLHttpRequest();
112 xhr2.open("GET", URL.createObjectURL(self.blobObj2), false);
113 xhr2.send();
114 self.blobContent2 = xhr2.response;
115 shouldBe("self.blobContent1", "self.blobContent2");
116 }
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/storage/serialized-script-value.html » ('j') | public/web/WebBlob.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698