summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage/change-version-handle-reuse.html
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/storage/change-version-handle-reuse.html')
-rw-r--r--LayoutTests/storage/change-version-handle-reuse.html61
1 files changed, 11 insertions, 50 deletions
diff --git a/LayoutTests/storage/change-version-handle-reuse.html b/LayoutTests/storage/change-version-handle-reuse.html
index de3a5f4..dd32198 100644
--- a/LayoutTests/storage/change-version-handle-reuse.html
+++ b/LayoutTests/storage/change-version-handle-reuse.html
@@ -1,70 +1,31 @@
<html>
<head>
+<script src="change-version-handle-reuse.js"></script>
<script>
-function log(message)
-{
- document.getElementById("result").innerText += message + "\n";
-}
-function finishTest()
-{
- log("TEST COMPLETE.");
+var DB_TEST_SUFFIX = "_dom";
- if (window.layoutTestController)
- layoutTestController.notifyDone();
+function log(message)
+{
+ document.getElementById("console").innerText += message + "\n";
}
-function runTest()
+function setupAndRunTest()
{
if (window.layoutTestController) {
layoutTestController.waitUntilDone();
layoutTestController.dumpAsText();
}
- document.getElementById("result").innerText = "";
+ document.getElementById("console").innerText = "";
- try {
- db = openDatabase("ChangeVersion", "", "Test that changing a database version doesn\'t kill our handle to it", 1);
- var version = db.version;
- var newVersion = version ? (parseInt(version) + 1).toString() : "1";
- db.changeVersion(version, newVersion, function(tx) {
- log("changeVersion: transaction callback");
- }, function(error) {
- log("changeVersion: error callback: " + error.message);
- }, function() {
- log("changeVersion: success callback");
- });
-
- setTimeout(runTest2, 1000);
-
- } catch (e) {
- log("changeVersion exception: " + e);
- finishTest();
- }
-}
-
-function runTest2()
-{
- try {
- db.transaction(function(tx) {
- tx.executeSql("SELECT * from FooBar", [], function(tx) {
- log("transaction: statement callback");
- finishTest();
- }, function(tx, error) {
- log("transaction: statement error callback: " + error.message);
- finishTest();
- });
- });
- } catch (e) {
- log("transaction exception: " + e);
- finishTest();
- }
+ runTest();
}
</script>
</head>
-<body onload="runTest()">
-<div>This tests that a database can be accessed after changing its version. You should see an error about FooBar table below, not about mismatching versions. Also, reloading the page should not cause an assertion failure.
-<pre id="result">
+<body onload="setupAndRunTest()">
+<div>This tests that a database can be accessed after changing its version. You should see an error about FooBar table below, not about mismatching versions.
+<pre id="console">
FAILURE: test didn't run.
</pre>
</body>