Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / storage / indexeddb / prefetch-invalidation.html
blobef2c84320037d9f0ce0cde7e87fe6fd5e3ddf041
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 write operations invalidate cursor prefetch caches");
8 indexedDBTest(prepareDatabase, onOpenSuccess);
9 function prepareDatabase(evt)
11 preamble(evt);
12 evalAndLog("db = event.target.result");
13 evalAndLog("store = db.createObjectStore('store')");
16 function onOpenSuccess(evt)
18 preamble(evt);
19 evalAndLog("db = event.target.result");
21 var steps = [
22 deleteRange,
23 clearStore
26 (function nextStep() {
27 var step = steps.shift();
28 if (step) {
29 doPrefetchInvalidationTest(step, nextStep);
30 } else {
31 finishJSTest();
32 return;
34 }());
37 function doPrefetchInvalidationTest(operation, callback)
39 debug("");
40 debug("-------------------------------------------");
41 preamble();
42 evalAndLog("store = db.transaction('store', 'readwrite').objectStore('store')");
43 debug("Populate the store with 200 records.");
44 for (var i = 0; i < 200; ++i)
45 store.put(i, i);
46 evalAndLog("cursorRequest = store.openCursor()");
47 continue100Times(operation, callback);
50 function continue100Times(operation, callback)
52 preamble();
53 var count = 0;
55 cursorRequest.onsuccess = function() {
56 var cursor = cursorRequest.result;
57 ++count;
58 if (count < 100) {
59 cursor.continue();
60 return;
62 shouldBeNonNull("cursorRequest.result");
63 doOperationAndContinue(operation, callback);
67 function doOperationAndContinue(operation, callback)
69 preamble();
70 operation();
71 evalAndLog("cursor = cursorRequest.result");
72 evalAndLog("cursor.continue()")
73 cursorRequest.onsuccess = function onContinueSuccess() {
74 preamble();
75 shouldBeNull("cursorRequest.result");
76 callback();
80 function deleteRange()
82 return evalAndLog("store.delete(IDBKeyRange.bound(-Infinity, +Infinity))");
85 function clearStore()
87 return evalAndLog("store.clear()");
90 </script>