summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage/multiple-databases-garbage-collection.html
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/storage/multiple-databases-garbage-collection.html')
-rw-r--r--LayoutTests/storage/multiple-databases-garbage-collection.html77
1 files changed, 6 insertions, 71 deletions
diff --git a/LayoutTests/storage/multiple-databases-garbage-collection.html b/LayoutTests/storage/multiple-databases-garbage-collection.html
index 45246a9..8451acf 100644
--- a/LayoutTests/storage/multiple-databases-garbage-collection.html
+++ b/LayoutTests/storage/multiple-databases-garbage-collection.html
@@ -1,77 +1,12 @@
<html>
<head>
-<script>
-
-function log(message)
-{
- document.body.innerHTML += message + "<br>";
-}
-
-function GC()
-{
- // Force GC.
- if (window.GCController)
- GCController.collect();
- else {
- for (var i = 0; i < 10000; ++i) {
- ({ });
- }
- }
-}
-
-// Variable for the database that will never be forgotten
-var persistentDB = 0;
-// Variable for the forgotten database
-var forgottenDB = 0;
-
-var completed = 0;
-function checkCompletion()
-{
- if (++completed == 2 && window.layoutTestController)
- layoutTestController.notifyDone();
-}
-
-function runTest()
-{
- if (window.layoutTestController) {
- layoutTestController.dumpAsText();
- layoutTestController.waitUntilDone();
- }
-
- persistentDB = openDatabase("MultipleDatabasesTest1", "1.0", "Test one out of a set of databases being destroyed (1)", 32768);
- forgottenDB = openDatabase("MultipleDatabasesTest2", "1.0", "Test one out of a set of databases being destroyed (2)", 32768);
-
- persistentDB.transaction(function(tx) {
- tx.executeSql("CREATE TABLE IF NOT EXISTS DataTest (randomData)", [], function(tx, result) {
- for (var i = 0; i < 25; ++i)
- tx.executeSql("INSERT INTO DataTest (randomData) VALUES (1)", []);
- });
- }, function(err) {
- log("Persistent Database Transaction Errored - " + err);
- checkCompletion();
- }, function() {
- log("Persistent Database Transaction Complete");
- checkCompletion();
- });
-
- forgottenDB.transaction(function(tx) {
- tx.executeSql("CREATE TABLE IF NOT EXISTS EmptyTable (unimportantData)", []);
- }, function(err) {
- log("Forgotten Database Transaction Errored - " + err);
- forgottenDB = 0;
- GC();
- checkCompletion();
- }, function() {
- log("Forgotten Database Transaction Complete");
- forgottenDB = 0;
- GC();
- checkCompletion();
- });
-}
-
-</script>
-<body onload="runTest();">
+<script src="resources/database-common.js"></script>
+<script src="multiple-databases-garbage-collection.js"></script>
+<body onload="setupAndRunTest();">
This test opens two databases, queues up a series of operations on both, then "forgets" about one of them.
After forcing GC, resources associated with that database should be freed gracefully.<br>
+<pre id="console">
+FAILURE: test didn't run.
+</pre>
</body>
</html>