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