summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage/domstorage/localstorage/simple-usage.html
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/storage/domstorage/localstorage/simple-usage.html')
-rw-r--r--LayoutTests/storage/domstorage/localstorage/simple-usage.html49
1 files changed, 49 insertions, 0 deletions
diff --git a/LayoutTests/storage/domstorage/localstorage/simple-usage.html b/LayoutTests/storage/domstorage/localstorage/simple-usage.html
new file mode 100644
index 0000000..37592d0
--- /dev/null
+++ b/LayoutTests/storage/domstorage/localstorage/simple-usage.html
@@ -0,0 +1,49 @@
+<html>
+<head>
+<script src="resources/clearLocalStorage.js"></script>
+<script>
+
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+function log(a)
+{
+ document.getElementById("logger").innerHTML += a + "<br>";
+}
+
+function runTest()
+{
+ if (!window.localStorage) {
+ log("window.localStorage DOES NOT exist");
+ return;
+ }
+
+ log("Length is " + localStorage.length);
+ log("Value for FOO is " + localStorage.getItem("FOO"));
+
+ localStorage.setItem("FOO", "BAR");
+
+ log("Length is " + localStorage.length);
+ log("Value for FOO is " + localStorage.getItem("FOO"));
+ log("Key for index 0 is " + localStorage.key(0));
+ log("Key for index 1 is " + localStorage.key(1));
+ log("Key for index -1 is " + localStorage.key(-1));
+
+ localStorage.setItem("FOO", "BAZ");
+
+ log("Length is " + localStorage.length);
+ log("Value for FOO is " + localStorage.getItem("FOO"));
+
+ localStorage.removeItem("FOO");
+
+ log("Length is " + localStorage.length);
+ log("Value for FOO is " + localStorage.getItem("FOO"));
+}
+
+</script>
+</head>
+<body onload="runTest();">
+This test tries simple operations on localStorage<br>
+<div id="logger"></div>
+</body>
+</html>