Home | History | Annotate | Download | only in storage
      1 <html>
      2 <head>
      3 <script>
      4 
      5 function log(message)
      6 {
      7     document.body.innerHTML += message + "<br>";
      8 }
      9 
     10 var complete = 0;
     11 
     12 function checkCompletion()
     13 {
     14     if (++complete == 2 && window.layoutTestController)
     15         layoutTestController.notifyDone();
     16 }
     17 
     18 function runTest()
     19 {
     20     if (window.layoutTestController) {
     21         layoutTestController.dumpAsText();
     22         layoutTestController.waitUntilDone();
     23     }
     24     
     25     var db = openDatabase("MultipleTransactionsTest", "1.0", "Test to make sure multiple transactions can be queued at once for an HTML5 database", 32768);
     26 
     27     db.transaction(function(tx) {
     28         log("Transaction 1 Started");
     29     }, function(err) {
     30         log("Transaction 1 Errored - " + err);
     31         checkCompletion();
     32     }, function() {
     33         log("Transaction 1 Succeeded");
     34         checkCompletion();
     35     });
     36 
     37     db.transaction(function(tx) {
     38         log("Transaction 2 Started");
     39     }, function(err) {
     40         log("Transaction 2 Errored - " + err);
     41         checkCompletion();
     42     }, function() {
     43         log("Transaction 2 Succeeded");
     44         checkCompletion();
     45     });
     46 }
     47 
     48 </script>
     49 <head>
     50 <body onload="runTest();">
     51 This is a test to see if the database API allows multiple transactions to be queued on the same database at once:<br>
     52 </body>
     53 </html>
     54