diff options
Diffstat (limited to 'LayoutTests/storage/success-callback.html')
-rw-r--r-- | LayoutTests/storage/success-callback.html | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/LayoutTests/storage/success-callback.html b/LayoutTests/storage/success-callback.html new file mode 100644 index 0000000..c237aba --- /dev/null +++ b/LayoutTests/storage/success-callback.html @@ -0,0 +1,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> |