summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-05-21 16:53:46 +0100
committerKristian Monsen <kristianm@google.com>2010-05-25 10:24:15 +0100
commit6c2af9490927c3c5959b5cb07461b646f8b32f6c (patch)
treef7111b9b22befab472616c1d50ec94eb50f1ec8c /LayoutTests/storage
parenta149172322a9067c14e8b474a53e63649aa17cad (diff)
downloadexternal_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.zip
external_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.tar.gz
external_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.tar.bz2
Merge WebKit at r59636: Initial merge by git
Change-Id: I59b289c4e6b18425f06ce41cc9d34c522515de91
Diffstat (limited to 'LayoutTests/storage')
-rw-r--r--LayoutTests/storage/change-version-handle-reuse-expected.txt2
-rw-r--r--LayoutTests/storage/change-version-handle-reuse.html61
-rw-r--r--LayoutTests/storage/change-version-handle-reuse.js46
-rw-r--r--LayoutTests/storage/domstorage/quota-expected.txt2
-rw-r--r--LayoutTests/storage/domstorage/script-tests/quota.js6
-rw-r--r--LayoutTests/storage/execute-sql-args.html91
-rw-r--r--LayoutTests/storage/execute-sql-args.js86
7 files changed, 154 insertions, 140 deletions
diff --git a/LayoutTests/storage/change-version-handle-reuse-expected.txt b/LayoutTests/storage/change-version-handle-reuse-expected.txt
index 805c9fb..d0c3444 100644
--- a/LayoutTests/storage/change-version-handle-reuse-expected.txt
+++ b/LayoutTests/storage/change-version-handle-reuse-expected.txt
@@ -1,4 +1,4 @@
-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.
+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.
changeVersion: transaction callback
changeVersion: success callback
transaction: statement error callback: no such table: FooBar
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>
diff --git a/LayoutTests/storage/change-version-handle-reuse.js b/LayoutTests/storage/change-version-handle-reuse.js
new file mode 100644
index 0000000..e948614
--- /dev/null
+++ b/LayoutTests/storage/change-version-handle-reuse.js
@@ -0,0 +1,46 @@
+function finishTest()
+{
+ log("TEST COMPLETE.");
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function runTest()
+{
+ try {
+ db = openDatabase("ChangeVersion" + DB_TEST_SUFFIX, "", "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");
+ runTest2();
+ });
+
+ } 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();
+ }
+}
diff --git a/LayoutTests/storage/domstorage/quota-expected.txt b/LayoutTests/storage/domstorage/quota-expected.txt
index 248ff79..1836cc1 100644
--- a/LayoutTests/storage/domstorage/quota-expected.txt
+++ b/LayoutTests/storage/domstorage/quota-expected.txt
@@ -8,7 +8,7 @@ storage.clear()
PASS storage.length is 0
Creating 'data' which contains 64K of data
PASS data.length is 65536
-Putting 'data' into 40 sessionStorage buckets.
+Putting 'data' into 39 sessionStorage buckets.
Putting 'data' into another bucket.h
PASS Insertion worked.
diff --git a/LayoutTests/storage/domstorage/script-tests/quota.js b/LayoutTests/storage/domstorage/script-tests/quota.js
index ad9afe9..21f3e39 100644
--- a/LayoutTests/storage/domstorage/script-tests/quota.js
+++ b/LayoutTests/storage/domstorage/script-tests/quota.js
@@ -65,13 +65,13 @@ function testNoQuota(storageString)
data += data;
shouldBe("data.length", "65536");
- debug("Putting 'data' into 40 " + storageString + " buckets.");
- for (var i=0; i<40; i++)
+ debug("Putting 'data' into 39 " + storageString + " buckets.");
+ for (var i=0; i<39; i++)
storage[i] = data;
debug("Putting 'data' into another bucket.h");
try {
- storage[40] = data;
+ storage[39] = data;
testPassed("Insertion worked.");
} catch (e) {
testFailed("Exception: " + e);
diff --git a/LayoutTests/storage/execute-sql-args.html b/LayoutTests/storage/execute-sql-args.html
index 43814c6..8a36a7a 100644
--- a/LayoutTests/storage/execute-sql-args.html
+++ b/LayoutTests/storage/execute-sql-args.html
@@ -1,108 +1,29 @@
<html>
<head>
+<script src="execute-sql-args.js"></script>
<script>
-var throwOnToStringObject = { };
-throwOnToStringObject.toString = function () { throw "Cannot call toString on this object." };
+var DB_TEST_SUFFIX = "_dom";
-var throwOnGetLengthObject = { };
-throwOnGetLengthObject.__defineGetter__("length", function () { throw "Cannot get length of this object."; });
-
-var throwOnGetZeroObject = { length: 1 };
-throwOnGetZeroObject.__defineGetter__("0", function () { throw "Cannot get 0 property of this object."; });
-
-var expectNoException = [
- 'null',
- 'undefined',
- '0',
- '""',
- '"", null',
- '"", undefined',
- '"", []',
- '"", [ "arg0" ]',
- '"", { }',
- '"", { length: 0 }',
- '"", { length: 1, 0: "arg0" }',
- '"", null, null',
- '"", null, undefined',
- '"", null, { }',
- '"", null, null, null',
- '"", null, null, undefined',
- '"", null, null, { }',
-];
-
-var expectException = [
- '',
- 'throwOnToStringObject',
- '"", throwOnGetLengthObject',
- '"", throwOnGetZeroObject',
- '"", [ throwOnToStringObject ]',
- '"", 0',
- '"", ""',
- '"", null, 0',
- '"", null, ""',
- '"", null, null, 0',
- '"", null, null, ""',
-];
-
-function writeMessageToLog(message)
+function log(message)
{
document.getElementById("console").innerText += message + "\n";
}
-function tryExecuteSql(transaction, parameterList)
-{
- try {
- eval('transaction.executeSql(' + parameterList + ')');
- return null;
- } catch (exception) {
- return exception;
- }
-}
-
-function runTransactionTest(transaction, parameterList, expectException)
-{
- var exception = tryExecuteSql(transaction, parameterList);
- if (expectException) {
- if (exception)
- writeMessageToLog("PASS. executeSql(" + parameterList + ") threw an exception as expected.");
- else
- writeMessageToLog("*FAIL*. executeSql(" + parameterList + ") did not throw an exception");
- } else {
- if (exception)
- writeMessageToLog("*FAIL*. executeSql(" + parameterList + ") threw an exception: " + exception);
- else
- writeMessageToLog("PASS. executeSql(" + parameterList + ") did not throw an exception");
- }
-}
-
-function runTransactionTests(transaction)
-{
- for (i in expectNoException)
- runTransactionTest(transaction, expectNoException[i], false);
- for (i in expectException)
- runTransactionTest(transaction, expectException[i], true);
-
- if (window.layoutTestController)
- layoutTestController.notifyDone();
-}
-
-function runTest()
+function setupAndRunTest()
{
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
-
- var db = openDatabase("ExecuteSQLArgsTest", "1.0", "Test of handling of the arguments to SQLTransaction.executeSql", 1);
- db.transaction(runTransactionTests);
+ runTest();
}
</script>
</head>
-<body onload="runTest()">
+<body onload="setupAndRunTest()">
<pre id="console"></pre>
</body>
diff --git a/LayoutTests/storage/execute-sql-args.js b/LayoutTests/storage/execute-sql-args.js
new file mode 100644
index 0000000..babeb5d
--- /dev/null
+++ b/LayoutTests/storage/execute-sql-args.js
@@ -0,0 +1,86 @@
+var throwOnToStringObject = { };
+throwOnToStringObject.toString = function () { throw "Cannot call toString on this object." };
+
+var throwOnGetLengthObject = { };
+throwOnGetLengthObject.__defineGetter__("length", function () { throw "Cannot get length of this object."; });
+
+var throwOnGetZeroObject = { length: 1 };
+throwOnGetZeroObject.__defineGetter__("0", function () { throw "Cannot get 0 property of this object."; });
+
+var expectNoException = [
+ 'null',
+ 'undefined',
+ '0',
+ '""',
+ '"", null',
+ '"", undefined',
+ '"", []',
+ '"", [ "arg0" ]',
+ '"", { }',
+ '"", { length: 0 }',
+ '"", { length: 1, 0: "arg0" }',
+ '"", null, null',
+ '"", null, undefined',
+ '"", null, { }',
+ '"", null, null, null',
+ '"", null, null, undefined',
+ '"", null, null, { }',
+];
+
+var expectException = [
+ '',
+ 'throwOnToStringObject',
+ '"", throwOnGetLengthObject',
+ '"", throwOnGetZeroObject',
+ '"", [ throwOnToStringObject ]',
+ '"", 0',
+ '"", ""',
+ '"", null, 0',
+ '"", null, ""',
+ '"", null, null, 0',
+ '"", null, null, ""',
+];
+
+function tryExecuteSql(transaction, parameterList)
+{
+ try {
+ eval('transaction.executeSql(' + parameterList + ')');
+ return null;
+ } catch (exception) {
+ return exception;
+ }
+}
+
+function runTransactionTest(transaction, parameterList, expectException)
+{
+ var exception = tryExecuteSql(transaction, parameterList);
+ if (expectException) {
+ if (exception)
+ log("PASS. executeSql(" + parameterList + ") threw an exception as expected.");
+ else
+ log("*FAIL*. executeSql(" + parameterList + ") did not throw an exception");
+ } else {
+ if (exception)
+ log("*FAIL*. executeSql(" + parameterList + ") threw an exception: " + exception);
+ else
+ log("PASS. executeSql(" + parameterList + ") did not throw an exception");
+ }
+}
+
+function runTransactionTests(transaction)
+{
+ for (i in expectNoException)
+ runTransactionTest(transaction, expectNoException[i], false);
+ for (i in expectException)
+ runTransactionTest(transaction, expectException[i], true);
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function runTest()
+{
+
+ var db = openDatabase("ExecuteSQLArgsTest" + DB_TEST_SUFFIX, "1.0", "Test of handling of the arguments to SQLTransaction.executeSql", 1);
+ db.transaction(runTransactionTests);
+}