Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/external/wpt/IndexedDB/interleaved-overlapping-cursors.html |
| diff --git a/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/interleaved-overlapping-cursors.html b/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/interleaved-overlapping-cursors.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1858499429d5eda32a36aa985c0f140349d25052 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/interleaved-overlapping-cursors.html |
| @@ -0,0 +1,53 @@ |
| +<!doctype html> |
| +<meta charset="utf-8"> |
| +<meta name="timeout" content="long"> |
| +<title>IndexedDB: Interleaved iteration of multiple overlapping cursors</title> |
|
dmurph
2017/03/29 23:35:20
How is this one different from the the one above?
jsbell
2017/04/04 22:59:41
+1
pwnall
2017/04/04 23:08:11
Done.
Thanks for the suggestion! I bet it will be
|
| +<link rel="author" href="pwnall@chromium.org" title="Victor Costan"> |
| +<script src="/resources/testharness.js"></script> |
| +<script src="/resources/testharnessreport.js"></script> |
| +<script src="support-promises.js"></script> |
| +<script src="interleaved-cursors-support.js"></script> |
| +<script> |
| +'use strict'; |
| + |
| +// Number of objects that each iterator goes over. |
| +const itemCount = 8; |
| + |
| +// Ratio of small objects to large objects. |
| +const largeObjectRatio = 5; |
| + |
| +function objectKey(cursorIndex, itemIndex) { |
| + const itemString = itemIndex.toString().padStart(5, '0'); |
| + return `key-${itemString}`; |
| +} |
| + |
| +function objectValue(cursorIndex, itemIndex) { |
| + if ((itemCount + itemIndex) % largeObjectRatio === 0) |
| + return largeObjectValue(0, itemIndex); |
| + return ['small', itemIndex]; |
| +} |
| + |
| +for (let cursorCount of [1, 10, 100, 1000]) { |
| + promise_test(testCase => { |
| + return createDatabase(testCase, (database, transaction) => { |
| + const store = database.createObjectStore('cache', { keyPath: 'key' }); |
| + }).then(database => { |
| + return populateTestStore(testCase, database, 1).then(() => database); |
| + }).then(database => { |
| + database.close(); |
| + }).then(() => { |
| + return openDatabase(testCase); |
| + }).then(database => { |
| + const transaction = database.transaction('cache', 'readonly'); |
| + transaction.onabort = () => { reject(transaction.error); }; |
| + |
| + const store = transaction.objectStore('cache'); |
| + return interleaveCursors(testCase, store, cursorCount, itemCount).then( |
| + () => database); |
| + }).then(database => { |
| + database.close(); |
| + }); |
| + }, `${cursorCount} cursors`); |
| +} |
| + |
| +</script> |