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

Unified Diff: content/test/data/blob_storage/blob_creation_and_slicing.html

Issue 2550113003: Revert of [BlobStorage] Implementing disk. (Closed)
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/test/BUILD.gn ('k') | content/test/data/blob_storage/common.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/data/blob_storage/blob_creation_and_slicing.html
diff --git a/content/test/data/blob_storage/blob_creation_and_slicing.html b/content/test/data/blob_storage/blob_creation_and_slicing.html
deleted file mode 100644
index e3f36c0b19c9e7286e3afe824f24aa05bf24b2f6..0000000000000000000000000000000000000000
--- a/content/test/data/blob_storage/blob_creation_and_slicing.html
+++ /dev/null
@@ -1,134 +0,0 @@
-<html>
- <head>
- <title>Blob Creation & Slicing</title>
- <script type="text/javascript" src="common.js"></script>
- <script type="text/javascript">
-// We create < 3000 bytes of data, as that is the max for the browsertest.
-var MAX_BYTES = 3000;
-
-// Number of blobs constructed with raw data.
-var NUM_RAW_BLOBS = 100;
-// Number of blobs we create by slicing the raw data blobs.
-var NUM_SLICES = 100;
-// Number of blobs we create by sandwiching sliced blobs in between new data.
-var NUM_SANDWICHES = 100;
-var totalSize = 0;
-
-var generatePsuedoRandomUint8Array = function(length) {
- var array = new Uint8Array(length);
- for (let i = 0; i < length; ++i) {
- array[i] = (17 + 23 * i) & 0xFF;
- }
- return array;
-}
-
-var test = function() {
- var blobs = [];
-
- // This should cause us to go straight to file.
- var savedToDiskDataSize = 190;
- var savedToDiskData = generatePsuedoRandomUint8Array(savedToDiskDataSize);
-
- // This should require multiple shared memory segments.
- var sharedMemoryDataSize = 15;
- var sharedMemoryData = generatePsuedoRandomUint8Array(sharedMemoryDataSize);
-
- var sandwichDataSize = 7;
-
- // This should fit in IPC.
- var ipcDataSize = 2;
- var ipcData = generatePsuedoRandomUint8Array(ipcDataSize);
-
- var expectedBlobData = [];
- for (let i = 0; i < NUM_RAW_BLOBS; ++i) {
- let data = [];
- if (i % 5 == 0) {
- data.push(sharedMemoryData);
- } else if (i % 13 == 0) {
- data.push(savedToDiskData);
- } else {
- data.push(ipcData);
- }
- expectedBlobData.push(data[data.length - 1]);
- let blob = new Blob(data, { content_type: "text/plain" });
- blobs.push(blob);
- totalSize += blob.size;
- }
-
- for (let i = 0; i < NUM_SLICES; ++i) {
- let origSize;
- let origData;
- let rawIndex = i % NUM_RAW_BLOBS;
- if (rawIndex % 5 == 0) {
- origSize = sharedMemoryDataSize;
- origData = sharedMemoryData;
- } else if (rawIndex % 13 == 0) {
- origSize = savedToDiskDataSize;
- origData = savedToDiskData;
- } else {
- origSize = ipcDataSize;
- origData = ipcData;
- }
- let blob;
- let expectedData;
- if (i % 2 == 0) {
- blob = blobs[i].slice(origSize / 2);
- expectedData = origData.slice(origSize / 2);
- } else {
- blob = blobs[i].slice(0, origSize / 2);
- expectedData = origData.slice(0, origSize / 2);
- }
- expectedBlobData.push(expectedData);
- blobs.push(blob);
- }
-
- var getBytes = function(string) {
- var bytes = [];
- for (let i = 0; i < string.length; ++i) {
- bytes.push(string.charCodeAt(i));
- }
- return bytes;
- }
-
- for (let i = 0; i < NUM_SANDWICHES; ++i) {
- let sliceIndex = NUM_RAW_BLOBS + (i % NUM_SLICES);
- let slicedDataSize = expectedBlobData[sliceIndex].length;
- blobs.push(new Blob(['pre', blobs[sliceIndex], 'post'], { content_type: "text/plain" }));
- totalSize += sandwichDataSize;
-
- let expectedData = new Uint8Array(sandwichDataSize + slicedDataSize);
- expectedData.set(getBytes("pre"), 0);
- expectedData.set(expectedBlobData[sliceIndex], 3);
- expectedData.set(getBytes("post"), 3 + slicedDataSize);
- expectedBlobData.push(expectedData);
- }
- shouldBeTrue("totalSize <= MAX_BYTES");
-
- var numRead = 0;
- for (let i = 0; i < blobs.length; i++) {
- (function(index, d) {
- var reader = new FileReader();
- reader.onloadend = function(e) {
- if (reader.error) {
- fail('Error when reading blob ' + index + ': ' + reader.error);
- return;
- }
- numRead++;
- debug('Finished reading blob ' + index);
- shouldBe('event.target.result.byteLength', d.length + '');
- shouldBe('new Uint8Array(event.target.result)',
- '[' + d + ']');
- if (numRead >= blobs.length) {
- done('Done!');
- }
- }
- return reader;
- })(i, expectedBlobData[i]).readAsArrayBuffer(blobs[i]);
- }
-};
- </script>
- </head>
- <body onLoad="test()">
- <div id="status">Starting...<br/></div>
- </body>
-</html>
« no previous file with comments | « content/test/BUILD.gn ('k') | content/test/data/blob_storage/common.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698