Home | History | Annotate | Download | only in resources
      1 <html>
      2 <head>
      3 <script>
      4 var database;
      5 
      6 function log(message)
      7 {
      8     document.getElementById("console").innerHTML += message + "<br>";
      9 }
     10 
     11 function finishTest()
     12 {
     13     log("Test part 2 Complete");
     14     if (window.layoutTestController)
     15         layoutTestController.notifyDone();
     16 }
     17 
     18 function errorFunction(tx, error)
     19 {
     20     log("Test failed - " + error.message);
     21     finishTest();
     22 }
     23 
     24 function addData(db)
     25 {
     26     db.transaction(function(tx) { 
     27         log("Inserting some data");
     28 
     29         tx.executeSql("INSERT INTO DataTest (testData) VALUES (?)", ["A"], function(tx, result) { }, errorFunction);
     30     }, function(){}, function() { 
     31         finishTest();
     32     });
     33 }
     34 
     35 function runTest()
     36 {
     37     if (window.layoutTestController) {
     38         layoutTestController.dumpAsText();
     39         layoutTestController.waitUntilDone();
     40     }
     41     
     42     try {
     43         database = openDatabase("DatabaseLockTest", "1.0", "Test for database locking", 5242880);
     44         addData(database);
     45     } catch(e) {
     46         log("Error - could not open database");
     47         finishTest();
     48     }
     49 }
     50 
     51 </script>
     52 </head>
     53 
     54 <body onload="runTest()">
     55 <pre id="console">
     56 </pre>
     57 </body>
     58 
     59 </html>
     60