summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage/private-browsing-readonly.html
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-02-25 10:58:37 +0000
committerSteve Block <steveblock@google.com>2010-02-25 11:17:52 +0000
commitcfb0617749a64f2e177386b030d46007b8c4b179 (patch)
tree033b0b4e1b1eaa96831b52fc1ec6675132f33035 /LayoutTests/storage/private-browsing-readonly.html
parent4175d59b46f96005f0c64978b1a94e3fe60f1e8e (diff)
downloadexternal_webkit-cfb0617749a64f2e177386b030d46007b8c4b179.zip
external_webkit-cfb0617749a64f2e177386b030d46007b8c4b179.tar.gz
external_webkit-cfb0617749a64f2e177386b030d46007b8c4b179.tar.bz2
Adds layout tests for HTML5 features
The following layout tests should all pass on Android, as they are for recently implemented HTML5 features ... - fast/dom/Geolocation - storage - http/tests/appcache This change adds these tests to the Android tree, at the current WebKit revision r54731. This is so that we can easily keep track of which tests should always be green, and so that we can add Android-specific test results. We also add the following paths ... - fast/js/resources - used by the Geolocation tests - http/conf - used by the Appcache tests Tests that are currently failing are added to the DumpRenderTree skipped list temporarily, to keep all tests green. Change-Id: Id96c05e3746ed64e4e4c40c99567b8def688f90a
Diffstat (limited to 'LayoutTests/storage/private-browsing-readonly.html')
-rw-r--r--LayoutTests/storage/private-browsing-readonly.html100
1 files changed, 100 insertions, 0 deletions
diff --git a/LayoutTests/storage/private-browsing-readonly.html b/LayoutTests/storage/private-browsing-readonly.html
new file mode 100644
index 0000000..70a209a
--- /dev/null
+++ b/LayoutTests/storage/private-browsing-readonly.html
@@ -0,0 +1,100 @@
+<html>
+<head>
+<script>
+
+function writeMessageToLog(message)
+{
+ document.getElementById("console").innerText += message + "\n";
+}
+
+var setupStatements = [
+ "CREATE TABLE IF NOT EXISTS PrivateTest1 (randomData)",
+ "INSERT INTO PrivateTest1 VALUES ('somedata')"
+];
+
+var privateBrowsingStatements = [
+ "CREATE TABLE IF NOT EXISTS PrivateTest2 (randomData)",
+ "DELETE FROM PrivateTest1",
+ "DROP TABLE PrivateTest1",
+ "INSERT INTO PrivateTest1 VALUES ('somedata')"
+];
+
+var completed = 0;
+var theTransaction;
+
+function setupSuccessFunction(tx, result)
+{
+ ++completed;
+ writeMessageToLog("Setup statement " + completed + " completed successfully");
+ checkSetupComplete();
+}
+
+function setupErrorFunction(tx, error)
+{
+ ++completed;
+ writeMessageToLog("Setup statement " + completed + " completed with an error\n" + error.message);
+ checkSetupComplete();
+}
+
+function privateBrowsingSuccessFunction(tx, result)
+{
+ ++completed;
+ writeMessageToLog("Private browsing statement " + completed + " completed successfully");
+}
+
+function privateBrowsingErrorFunction(tx, error)
+{
+ ++completed;
+ writeMessageToLog("Private browsing statement " + completed + " completed with an error\n" + error.message);
+}
+
+function runSetup(transaction)
+{
+ theTransaction = transaction;
+ for (i in setupStatements)
+ theTransaction.executeSql(setupStatements[i], [], setupSuccessFunction, setupErrorFunction);
+}
+
+function checkSetupComplete()
+{
+ if (completed == setupStatements.length)
+ runPrivateBrowsingTests();
+}
+
+function runPrivateBrowsingTests()
+{
+ completed = 0;
+
+ if (window.layoutTestController)
+ layoutTestController.setPrivateBrowsingEnabled(true);
+
+ for (i in privateBrowsingStatements)
+ theTransaction.executeSql(privateBrowsingStatements[i], [], privateBrowsingSuccessFunction, privateBrowsingErrorFunction);
+}
+
+function endTest()
+{
+ writeMessageToLog("Test ended");
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+function runTest()
+{
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ var database = openDatabase("PrivateBrowsingReadOnlyTest", "1.0", "Test private browsing read-only safety", 1);
+ database.transaction(runSetup, endTest, endTest);
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This test makes sure that attempts to change the database during private browsing fail.<br>
+<div id="console"></div>
+</body>
+</html>