Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / indexeddb / prefetch-race.html
blobec1b7afe5d49a73be044f8d4ba346caf83dc2c96
1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script>
3 <script src="resources/shared.js"></script>
4 <script>
6 description("Ensure IndexedDB's cursor prefetch cache requests are invalidated");
8 indexedDBTest(prepareDatabase, onOpenSuccess);
9 function prepareDatabase(evt)
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);
19 function onOpenSuccess(evt)
21 preamble(evt);
22 evalAndLog("db = event.target.result");
24 evalAndLog("tx = db.transaction('store', 'readwrite')");
25 evalAndLog("store = tx.objectStore('store')");
26 evalAndLog("request = store.openCursor()");
28 kPrefetchThreshold = 3;
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;
39 expect = expected.shift();
40 shouldBe("cursor.key", expect);
41 evalAndLog("cursor.continue()");
43 if (continueCount === kPrefetchThreshold) {
44 debug("\nThat should have triggered a prefetch, injecting odd records...");
45 for (var i = 1; i < 10; i += 2)
46 store.put(i, i);
50 tx.oncomplete = function() {
51 shouldBe("continueCount", "7");
52 finishJSTest();
55 </script>