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..57147e1789ca435d866ed25589781a2a67782359 |
--- /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 cursors over the same data</title> |
+<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> |