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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support-promises.js

Issue 2822453003: Wrap large IndexedDB values into Blobs before writing to LevelDB. (Closed)
Patch Set: Addressed last round of feedback. Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support-promises.js
diff --git a/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support-promises.js b/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support-promises.js
index 0762a8d7e9c1a664d68b79e96b20fbafad883944..21e2163ec60eb3eee05269b83f583f77fad780eb 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support-promises.js
+++ b/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/support-promises.js
@@ -270,3 +270,23 @@ function checkTitleIndexContents(testCase, index, errorMessage) {
assert_equals(result.author, BOOKS_RECORD_DATA[2].author, errorMessage);
});
}
+
+// Returns an Uint8Array with pseudorandom data.
+//
+// The PRNG should be sufficient to defeat compression schemes, but it is not
+// cryptographically strong.
+function largeValue(size, seed) {
+ const buffer = new Uint8Array(size);
+
+ // 32-bit xorshift - the seed can't be zero
+ let state = 1000 + seed;
+
+ for (let i = 0; i < size; ++i) {
+ state ^= state << 13;
+ state ^= state >> 17;
+ state ^= state << 5;
+ buffer[i] = state & 0xff;
+ }
+
+ return buffer;
+}

Powered by Google App Engine
This is Rietveld 408576698