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

Side by Side Diff: LayoutTests/storage/indexeddb/prefetch-race.html

Issue 105213009: IndexedDB: Tests for cursor prefetch edge cases (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/storage/indexeddb/prefetch-race-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script>
3 <script src="resources/shared.js"></script>
4 <script>
5
6 description("Ensure IndexedDB's cursor prefetch cache requests are invalidated") ;
7
8 indexedDBTest(prepareDatabase, onOpenSuccess);
9 function prepareDatabase(evt)
10 {
11 preamble(evt);
12 evalAndLog("db = event.target.result");
13 evalAndLog("store = db.createObjectStore('store')");
14 debug("Populate with even records...");
15 for (var i = 0; i < 10; i += 2)
16 store.put(i, i);
17 }
18
19 function onOpenSuccess(evt)
20 {
21 preamble(evt);
22 evalAndLog("db = event.target.result");
23
24 evalAndLog("tx = db.transaction('store', 'readwrite')");
25 evalAndLog("store = tx.objectStore('store')");
26 evalAndLog("request = store.openCursor()");
27
28 kPrefetchThreshold = 3;
29
30 expected = ["0", "2", "4", "6", "7", "8", "9"];
31 continueCount = 0;
32 request.onsuccess = function cursorSuccess() {
33 preamble();
34 cursor = request.result;
35 if (!cursor)
36 return;
37 ++continueCount;
38
39 expect = expected.shift();
40 shouldBe("cursor.key", expect);
41 evalAndLog("cursor.continue()");
42
43 if (continueCount === kPrefetchThreshold) {
44 debug("\nThat should have triggered a prefetch, injecting odd record s...");
45 for (var i = 1; i < 10; i += 2)
46 store.put(i, i);
47 }
48 };
49
50 tx.oncomplete = function() {
51 shouldBe("continueCount", "7");
52 finishJSTest();
53 };
54 }
55 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/storage/indexeddb/prefetch-race-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698