1 <html> 2 <head> 3 <link rel="stylesheet" href="../../fast/js/resources/js-test-style.css"> 4 <script src="../../fast/js/resources/js-test-pre.js"></script> 5 <script src="../../fast/js/resources/js-test-post-function.js"></script> 6 <script src="resources/shared.js"></script> 7 </head> 8 <body> 9 <p id="description"></p> 10 <div id="console"></div> 11 <script> 12 13 description("Verify that queuing up several commands works (and they all fire)."); 14 if (window.layoutTestController) 15 layoutTestController.waitUntilDone(); 16 17 function test() 18 { 19 request = evalAndLog("webkitIndexedDB.open('queued-commands')"); 20 request.onsuccess = setVersion; 21 request.onerror = unexpectedErrorCallback; 22 } 23 24 function setVersion() 25 { 26 db = evalAndLog("db = event.target.result"); 27 28 request = evalAndLog("db.setVersion('new version')"); 29 request.onsuccess = deleteExisting; 30 request.onerror = unexpectedErrorCallback; 31 } 32 33 function deleteExisting() 34 { 35 debug("setVersionSuccess():"); 36 window.trans = evalAndLog("trans = event.target.result"); 37 shouldBeTrue("trans !== null"); 38 trans.onabort = unexpectedAbortCallback; 39 40 deleteAllObjectStores(db); 41 42 window.store = evalAndLog("db.createObjectStore('storeName')"); 43 window.indexObject = evalAndLog("store.createIndex('indexName', 'x')"); 44 45 request = evalAndLog("store.add({x: 'value', y: 'zzz'}, 'key')"); 46 request.onsuccess = function() { verifyAdd(0); }; 47 request.onerror = unexpectedErrorCallback; 48 49 request = evalAndLog("store.add({x: 'value2', y: 'zzz2'}, 'key2')"); 50 request.onsuccess = function() { verifyAdd(1); }; 51 request.onerror = unexpectedErrorCallback; 52 53 request = evalAndLog("store.put({x: 'valu2', y: 'zz2'}, 'ky2')"); 54 request.onsuccess = function() { verifyAdd(2); }; 55 request.onerror = unexpectedErrorCallback; 56 57 window.addCount = 0; 58 } 59 60 function verifyAdd(expected) 61 { 62 shouldBe("" + addCount++, "" + expected); 63 64 if (addCount == 3) 65 done(); 66 if (addCount > 3) 67 testFailed("Unexpected call to verifyAdd!"); 68 } 69 70 test(); 71 72 var successfullyParsed = true; 73 74 </script> 75 </body> 76 </html> 77