Chromium Code Reviews| Index: content/test/data/indexeddb/blob_did_ack_prefetch.html |
| diff --git a/content/test/data/indexeddb/blob_did_ack_prefetch.html b/content/test/data/indexeddb/blob_did_ack_prefetch.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0df6a8c62bf0f3d04b46a0784dfddf8b6ac684df |
| --- /dev/null |
| +++ b/content/test/data/indexeddb/blob_did_ack_prefetch.html |
| @@ -0,0 +1,56 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<!-- |
| + Copyright 2015 The Chromium Authors. All rights reserved. |
| + Use of this source code is governed by a BSD-style license that can be |
| + found in the LICENSE file. |
| +--> |
| +<head> |
| +<title>IDB Test that unused cursor prefetches are acked back to browser process</title> |
| +<script src="common.js"></script> |
| +<script> |
| + |
| +// Constants. |
| +var store_name = 'blobs_ack'; |
|
cmumford
2015/02/17 18:13:49
Are we guaranteed this name won't collide with the
jsbell
2015/02/17 18:15:11
We should not be preserving state across tests, bu
|
| +var kNumToFetch = 15; // Enough to trigger prefetch, but not on a batch boundary. |
| + |
| +// Shared variables. |
| +var db; |
| + |
| +function test() { |
| + indexedDBTest(prepareDatabase, iterateCursor); |
| +} |
| + |
| +function prepareDatabase() { |
| + db = event.target.result; |
| + var store = db.createObjectStore(store_name); |
| + for (var i = 0; i < kNumToFetch + 10; ++i) |
| + store.put(new Blob([String(i)]), i); |
| +} |
| + |
| +function iterateCursor() { |
| + var tx = db.transaction(store_name, 'readonly'); |
| + var count = kNumToFetch; |
| + var request = tx.objectStore(store_name).openCursor(); |
| + request.onerror = unexpectedErrorCallback; |
| + request.onsuccess = function() { |
| + if (--count > 0) |
| + request.result.continue(); |
| + }; |
| + tx.onabort = unexpectedAbortCallback; |
| + tx.oncomplete = onComplete; |
| +} |
| + |
| +function onComplete() { |
| + gc(); |
| + done(); |
| +} |
| + |
| +</script> |
| +</head> |
| +<body onLoad="test()"> |
| + <div id="status">Starting...<br> |
| + <p>Run this test with --js-flags=--expose-gc when run from Chrome.</p> |
| + </div> |
| +</body> |
| +</html> |