blob: c237aba82e30972481aabb7050d5a2146e25c3fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
<html>
<head>
<script>
function log(message)
{
document.getElementById("console").innerHTML += message + "<br>";
}
function finishTest()
{
log("Test Complete");
if (window.layoutTestController)
layoutTestController.notifyDone();
}
function errorFunction(error)
{
log("Test failed - " + error.message);
finishTest();
}
var successCount = 0;
function successFunction(message)
{
log("Transaction succeeded - " + message);
if (++successCount == 2)
finishTest();
}
function runTest()
{
if (window.layoutTestController) {
layoutTestController.clearAllDatabases();
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
var database = openDatabase("SuccessCallbackDatabase", "1.0", "Test for success callback <rdar://5737692>", 1);
database.transaction(function(tx) { tx.executeSql("CREATE TABLE IF NOT EXISTS SuccessCallbackTest (randomData)", []); }, errorFunction, function() { successFunction("Transaction with one statement"); });
database.transaction(function(tx) { }, errorFunction, function() { successFunction("Empty transaction"); });
}
</script>
</head>
<body onload="runTest()">
This test confirms that a successful transaction - both with and without a statement - receives its successCallback
<pre id="console">
</pre>
</body>
</html>
|