Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/external/wpt/IndexedDB/parallel-cursors-upgrade.html |
| diff --git a/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/parallel-cursors-upgrade.html b/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/parallel-cursors-upgrade.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5958d4e9e434cfdccb61c47987bb5d624b9f8178 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/external/wpt/IndexedDB/parallel-cursors-upgrade.html |
| @@ -0,0 +1,53 @@ |
| +<!doctype html> |
| +<meta charset="utf-8"> |
| +<meta name="timeout" content="long"> |
| +<title>IndexedDB: Parallel iteration of cursors in upgradeneeded</title> |
| +<link rel="author" href="pwnall@chromium.org" title="Victor Costan"> |
| +<link rel="help" href="http://crbug.com/705837"> |
| +<script src="/resources/testharness.js"></script> |
| +<script src="/resources/testharnessreport.js"></script> |
| +<script src="support-promises.js"></script> |
| +<script> |
| +'use strict'; |
| + |
| +for (let cursorCount of [2, 10, 100, 1000, 10000]) { |
| + promise_test(testCase => { |
|
dmurph
2017/03/29 23:36:34
Do we really need this many cursors to get it to w
pwnall
2017/03/29 23:49:07
Clusterfuzz used 10k (2x 5k). Also, this test inte
|
| + return createDatabase(testCase, (database, transaction) => { |
| + const store = database.createObjectStore('cache', { keyPath: 'key' }); |
| + store.put({ key: '42' }); |
| + |
| + const promises = []; |
| + |
| + for (let j = 0; j < 2; j += 1) { |
| + const promise = new Promise((resolve, reject) => { |
| + let request = null; |
| + for (let i = 0; i < cursorCount / 2; i += 1) { |
| + request = store.openCursor(); |
| + } |
| + |
| + let continued = false; |
| + request.onsuccess = testCase.step_func(() => { |
| + const cursor = request.result; |
| + |
| + if (!continued) { |
| + assert_equals(cursor.key, '42'); |
| + assert_equals(cursor.value.key, '42'); |
| + continued = true; |
| + cursor.continue(); |
| + } else { |
| + assert_equals(cusor, null); |
| + resolve(); |
| + } |
| + }); |
| + request.onerror = () => reject(request.error); |
| + }); |
| + promises.push(promise); |
| + } |
| + return Promise.all(promises); |
| + }).then(database => { |
| + database.close(); |
| + }); |
| + }, `${cursorCount} cursors`); |
| +} |
| + |
| +</script> |