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

Side by Side 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, 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
OLDNEW
1 'use strict'; 1 'use strict';
2 2
3 // Returns an IndexedDB database name that is unique to the test case. 3 // Returns an IndexedDB database name that is unique to the test case.
4 function databaseName(testCase) { 4 function databaseName(testCase) {
5 return 'db' + self.location.pathname + '-' + testCase.name; 5 return 'db' + self.location.pathname + '-' + testCase.name;
6 } 6 }
7 7
8 // Creates an EventWatcher covering all the events that can be issued by 8 // Creates an EventWatcher covering all the events that can be issued by
9 // IndexedDB requests and transactions. 9 // IndexedDB requests and transactions.
10 function requestWatcher(testCase, request) { 10 function requestWatcher(testCase, request) {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // is using it incorrectly. 263 // is using it incorrectly.
264 function checkTitleIndexContents(testCase, index, errorMessage) { 264 function checkTitleIndexContents(testCase, index, errorMessage) {
265 const request = index.get(BOOKS_RECORD_DATA[2].title); 265 const request = index.get(BOOKS_RECORD_DATA[2].title);
266 const eventWatcher = requestWatcher(testCase, request); 266 const eventWatcher = requestWatcher(testCase, request);
267 return eventWatcher.wait_for('success').then(() => { 267 return eventWatcher.wait_for('success').then(() => {
268 const result = request.result; 268 const result = request.result;
269 assert_equals(result.isbn, BOOKS_RECORD_DATA[2].isbn, errorMessage); 269 assert_equals(result.isbn, BOOKS_RECORD_DATA[2].isbn, errorMessage);
270 assert_equals(result.author, BOOKS_RECORD_DATA[2].author, errorMessage); 270 assert_equals(result.author, BOOKS_RECORD_DATA[2].author, errorMessage);
271 }); 271 });
272 } 272 }
273
274 // Returns an Uint8Array with pseudorandom data.
275 //
276 // The PRNG should be sufficient to defeat compression schemes, but it is not
277 // cryptographically strong.
278 function largeValue(size, seed) {
279 const buffer = new Uint8Array(size);
280
281 // 32-bit xorshift - the seed can't be zero
282 let state = 1000 + seed;
283
284 for (let i = 0; i < size; ++i) {
285 state ^= state << 13;
286 state ^= state >> 17;
287 state ^= state << 5;
288 buffer[i] = state & 0xff;
289 }
290
291 return buffer;
292 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698