webapps

changeset 719:ad44919e3519

Improve storage_* WebStorage tests.
author Ms2ger <ms2ger@gmail.com>
date Sat, 24 Mar 2012 14:08:30 +0100
parents 49a8151e6234
children d17c04fbcf23
files WebStorage/tests/submissions/Infraware/MANIFEST WebStorage/tests/submissions/Infraware/storage_local_clear.html WebStorage/tests/submissions/Infraware/storage_local_getitem.html WebStorage/tests/submissions/Infraware/storage_local_getitem_null.html WebStorage/tests/submissions/Infraware/storage_local_key.html WebStorage/tests/submissions/Infraware/storage_local_key_null.html WebStorage/tests/submissions/Infraware/storage_local_length.html WebStorage/tests/submissions/Infraware/storage_local_removeitem.html WebStorage/tests/submissions/Infraware/storage_local_setitem.html WebStorage/tests/submissions/Infraware/storage_local_setitem_quotaexceedederr.html WebStorage/tests/submissions/Infraware/storage_session_clear.html WebStorage/tests/submissions/Infraware/storage_session_getitem.html WebStorage/tests/submissions/Infraware/storage_session_getitem_null.html WebStorage/tests/submissions/Infraware/storage_session_key.html WebStorage/tests/submissions/Infraware/storage_session_key_null.html WebStorage/tests/submissions/Infraware/storage_session_length.html WebStorage/tests/submissions/Infraware/storage_session_removeitem.html WebStorage/tests/submissions/Infraware/storage_session_setitem.html WebStorage/tests/submissions/Infraware/storage_session_setitem_quotaexceedederr.html
diffstat 19 files changed, 220 insertions(+), 757 deletions(-) [+]
line diff
     1.1 --- a/WebStorage/tests/submissions/Infraware/MANIFEST	Fri Mar 23 22:57:42 2012 +0100
     1.2 +++ b/WebStorage/tests/submissions/Infraware/MANIFEST	Sat Mar 24 14:08:30 2012 +0100
     1.3 @@ -15,17 +15,13 @@
     1.4  dir iframe
     1.5  storage_local_clear.html
     1.6  storage_local_getitem.html
     1.7 -storage_local_getitem_null.html
     1.8  storage_local_key.html
     1.9 -storage_local_key_null.html
    1.10  storage_local_length.html
    1.11  storage_local_removeitem.html
    1.12  storage_local_setitem.html
    1.13  storage_session_clear.html
    1.14  storage_session_getitem.html
    1.15 -storage_session_getitem_null.html
    1.16  storage_session_key.html
    1.17 -storage_session_key_null.html
    1.18  storage_session_length.html
    1.19  storage_session_removeitem.html
    1.20  storage_session_setitem.html
     2.1 --- a/WebStorage/tests/submissions/Infraware/storage_local_clear.html	Fri Mar 23 22:57:42 2012 +0100
     2.2 +++ b/WebStorage/tests/submissions/Infraware/storage_local_clear.html	Sat Mar 24 14:08:30 2012 +0100
     2.3 @@ -6,52 +6,20 @@
     2.4    <script src="/resources/testharnessreport.js"></script>
     2.5   </head>
     2.6   <body>
     2.7 -	<p>
     2.8 -		<h3>storage_local_clear</h3>
     2.9 -	</p>
    2.10 +    <h1>storage_local_clear</h1>
    2.11 +    <div id="log"></div>
    2.12 +    <script>
    2.13 +        test(function() {
    2.14 +            localStorage.clear();
    2.15 +            localStorage.setItem("name", "user1");
    2.16  
    2.17 -	<hr>
    2.18 +            assert_not_equals(localStorage.getItem("name"), null);
    2.19 +            assert_equals(localStorage.length, 1);
    2.20  
    2.21 -	<div id="log"></div>
    2.22 -	
    2.23 -	<script>
    2.24 -
    2.25 -		if (('localStorage' in window) && window.localStorage !== null){
    2.26 -			localStorage.clear();
    2.27 -			localStorage.setItem("name", "user1");
    2.28 -
    2.29 -			if (localStorage.getItem("name") != null && localStorage.length == 1)
    2.30 -			{
    2.31 -				try {
    2.32 -					localStorage.clear();
    2.33 -				} catch (e) {
    2.34 -					test(function()
    2.35 -					{
    2.36 -						assert_unreached("clear method is failed.");
    2.37 -					}, "clear method test")
    2.38 -				}
    2.39 -
    2.40 -				test(function() {
    2.41 -					assert_equals(localStorage.getItem("name"), null, "localStorage.getItem('name')")
    2.42 -				}, "result test of clear method (item)")
    2.43 -
    2.44 -				test(function() {
    2.45 -					assert_equals(localStorage.length, 0, "localStorage.length")
    2.46 -				}, "result test of clear method (length)")
    2.47 -
    2.48 -			} else {
    2.49 -				test(function() {
    2.50 -					assert_unreached("'name' item is not exist.");
    2.51 -				}, "item existence test")
    2.52 -			}
    2.53 -		} else {
    2.54 -			test(function()
    2.55 -			{
    2.56 -				assert_unreached("localStorage is not supported.");
    2.57 -			}, "localStorage support test")
    2.58 -		}
    2.59 -
    2.60 -	</script>
    2.61 -
    2.62 +            localStorage.clear();
    2.63 +            assert_equals(localStorage.getItem("name"), null, "localStorage.getItem('name')")
    2.64 +            assert_equals(localStorage.length, 0, "localStorage.length")
    2.65 +        });
    2.66 +    </script>
    2.67   </body>
    2.68 -</html>
    2.69 \ No newline at end of file
    2.70 +</html>
     3.1 --- a/WebStorage/tests/submissions/Infraware/storage_local_getitem.html	Fri Mar 23 22:57:42 2012 +0100
     3.2 +++ b/WebStorage/tests/submissions/Infraware/storage_local_getitem.html	Sat Mar 24 14:08:30 2012 +0100
     3.3 @@ -6,38 +6,18 @@
     3.4    <script src="/resources/testharnessreport.js"></script>
     3.5   </head>
     3.6   <body>
     3.7 -	<p>
     3.8 -		<h3>storage_local_getItem</h3>
     3.9 -	</p>
    3.10 -	
    3.11 -	<hr>
    3.12 -
    3.13 -	<div id="log"></div>
    3.14 -
    3.15 -	<script>
    3.16 -
    3.17 -		if (('localStorage' in window) && window.localStorage !== null){
    3.18 -			localStorage.clear();
    3.19 -			localStorage.setItem("name", "user1");
    3.20 -			localStorage.setItem("age", "20");
    3.21 -
    3.22 -			try {
    3.23 -				test(function() {
    3.24 -					assert_equals(localStorage.getItem("name"), "user1", "localStorage.getItem('name')")
    3.25 -				}, "getItem method test")
    3.26 -			} catch (e) {
    3.27 -				test(function()
    3.28 -				{
    3.29 -					assert_unreached("getItem method is failed.");
    3.30 -				}, "getItem method test")
    3.31 -			}
    3.32 -		} else {
    3.33 -			test(function()
    3.34 -			{
    3.35 -				assert_unreached("localStorage is not supported.");
    3.36 -			}, "localStorage support test")
    3.37 -		}	
    3.38 -	</script>
    3.39 -
    3.40 +    <h1>storage_local_getItem</h1>
    3.41 +    <div id="log"></div>
    3.42 +    <script>
    3.43 +        test(function() {
    3.44 +            localStorage.clear();
    3.45 +            localStorage.setItem("name", "user1");
    3.46 +            localStorage.setItem("age", "20");
    3.47 +            test(function() {
    3.48 +                assert_equals(localStorage.getItem("name"), "user1", "localStorage.getItem('name')")
    3.49 +                assert_equals(localStorage.getItem("unknown"), null, "localStorage.getItem('name')")
    3.50 +            }, "getItem method test")
    3.51 +        });
    3.52 +    </script>
    3.53   </body>
    3.54 -</html>
    3.55 \ No newline at end of file
    3.56 +</html>
     4.1 --- a/WebStorage/tests/submissions/Infraware/storage_local_getitem_null.html	Fri Mar 23 22:57:42 2012 +0100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,43 +0,0 @@
     4.4 -<!DOCTYPE HTML>
     4.5 -<html>
     4.6 - <head>
     4.7 -  <title>Web Storage</title>
     4.8 -  <script src="/resources/testharness.js"></script>
     4.9 -  <script src="/resources/testharnessreport.js"></script>
    4.10 - </head>
    4.11 - <body>
    4.12 -	<p>
    4.13 -		<h3>storage_local_getItem_null</h3>
    4.14 -	</p>
    4.15 -	
    4.16 -	<hr>
    4.17 -
    4.18 -	<div id="log"></div>
    4.19 -
    4.20 -	<script>
    4.21 -
    4.22 -		if (('localStorage' in window) && window.localStorage !== null){
    4.23 -			localStorage.clear();
    4.24 -			localStorage.setItem("name", "user1");
    4.25 -			localStorage.setItem("age", "20");
    4.26 -
    4.27 -			try {
    4.28 -				test(function() {
    4.29 -					assert_equals(localStorage.getItem("unknown"), null, "localStorage.getItem('name')")
    4.30 -				}, "getItem method test")
    4.31 -			} catch (e) {
    4.32 -				test(function()
    4.33 -				{
    4.34 -					assert_unreached("getItem method is failed.");
    4.35 -				}, "getItem method test")
    4.36 -			}
    4.37 -		} else {
    4.38 -			test(function()
    4.39 -			{
    4.40 -				assert_unreached("localStorage is not supported.");
    4.41 -			}, "localStorage support test")
    4.42 -		}	
    4.43 -	</script>
    4.44 -
    4.45 - </body>
    4.46 -</html>
    4.47 \ No newline at end of file
     5.1 --- a/WebStorage/tests/submissions/Infraware/storage_local_key.html	Fri Mar 23 22:57:42 2012 +0100
     5.2 +++ b/WebStorage/tests/submissions/Infraware/storage_local_key.html	Sat Mar 24 14:08:30 2012 +0100
     5.3 @@ -6,62 +6,35 @@
     5.4    <script src="/resources/testharnessreport.js"></script>
     5.5   </head>
     5.6   <body>
     5.7 -	<p>
     5.8 -		<h3>storage_local_key</h3>
     5.9 -	</p>
    5.10 -	
    5.11 -	<p>
    5.12 -		<h3>
    5.13 -			<div id="result" >
    5.14 -				<span id="resultMsg"><span class="fail">FAIL<span></span>
    5.15 -			</div>
    5.16 -		</h3>
    5.17 -	</p>
    5.18 +    <h1>storage_local_key</h1>
    5.19 +    <div id="log"></div>
    5.20 +    <script>
    5.21 +        test(function() {
    5.22 +            localStorage.clear();
    5.23  
    5.24 -	<hr>
    5.25 +            localStorage.setItem("name", "user1");
    5.26 +            localStorage.setItem("age", "20");
    5.27 +            localStorage.setItem("a", "1");
    5.28 +            localStorage.setItem("b", "2");
    5.29  
    5.30 -	<div id="log"></div>
    5.31 -
    5.32 -	<script>
    5.33 -
    5.34 -		if (('localStorage' in window) && window.localStorage !== null){
    5.35 -			localStorage.clear();
    5.36 -
    5.37 -			localStorage.setItem("name", "user1");
    5.38 -			localStorage.setItem("age", "20");
    5.39 -			localStorage.setItem("a", "1");
    5.40 -			localStorage.setItem("b", "2");
    5.41 -
    5.42 -			try {
    5.43 -				var keys = ["name","age","a","b"];
    5.44 -				function checkMatch(index){
    5.45 -					for (var i = 0; i < keys.length ; i++){
    5.46 -						if(localStorage.key(index) == keys[i]){
    5.47 -							delete keys[i];
    5.48 -							return true;
    5.49 -						}
    5.50 -					}
    5.51 -					return false;
    5.52 -				}
    5.53 -				
    5.54 -				test(function()
    5.55 -				{
    5.56 -					assert_true(checkMatch(0) && checkMatch(1) && checkMatch(2) && checkMatch(3), "key method is failed.");
    5.57 -				}, "key method test")
    5.58 -					
    5.59 -			} catch (e) {
    5.60 -				test(function()
    5.61 -				{
    5.62 -					assert_unreached("key method is failed.");
    5.63 -				}, "key method test")
    5.64 -			}
    5.65 -		} else {
    5.66 -			test(function()
    5.67 -			{
    5.68 -				assert_unreached("localStorage is not supported.");
    5.69 -			}, "localStorage support test")
    5.70 -		}	
    5.71 -	</script>
    5.72 -
    5.73 +            var keys = ["name", "age", "a", "b"];
    5.74 +            function doTest(index) {
    5.75 +                test(function() {
    5.76 +                    var key = localStorage.key(index);
    5.77 +                    assert_not_equals(key, null);
    5.78 +                    assert_true(keys.indexOf(key) >= 0,
    5.79 +                                "Unexpected key " + key + " found.");
    5.80 +                }, "key(" + index + ") should return the right thing.");
    5.81 +            }
    5.82 +            for (var i = 0; i < keys.length; ++i) {
    5.83 +                doTest(i);
    5.84 +                doTest(i + 0x100000000);
    5.85 +            }
    5.86 +            test(function() {
    5.87 +                assert_equals(localStorage.key(-1), null, "localStorage.key(-1)");
    5.88 +                assert_equals(localStorage.key(4), null, "localStorage.key(4)");
    5.89 +            }, "key() should return null for out-of-range arguments.");
    5.90 +        });
    5.91 +    </script>
    5.92   </body>
    5.93 -</html>
    5.94 \ No newline at end of file
    5.95 +</html>
     6.1 --- a/WebStorage/tests/submissions/Infraware/storage_local_key_null.html	Fri Mar 23 22:57:42 2012 +0100
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,60 +0,0 @@
     6.4 -<!DOCTYPE HTML>
     6.5 -<html>
     6.6 - <head>
     6.7 -  <title>Web Storage</title>
     6.8 -  <script src="/resources/testharness.js"></script>
     6.9 -  <script src="/resources/testharnessreport.js"></script>
    6.10 - </head>
    6.11 - <body>
    6.12 -	<p>
    6.13 -		<h3>storage_local_key_null</h3>
    6.14 -	</p>
    6.15 -	
    6.16 -	<p>
    6.17 -		<h3>
    6.18 -			<div id="result" >
    6.19 -				<span id="resultMsg"><span class="fail">FAIL<span></span>
    6.20 -			</div>
    6.21 -		</h3>
    6.22 -	</p>
    6.23 -
    6.24 -	<hr>
    6.25 -
    6.26 -	<div id="log"></div>
    6.27 -
    6.28 -	<script>
    6.29 -
    6.30 -		if (('localStorage' in window) && window.localStorage !== null){
    6.31 -			localStorage.clear();
    6.32 -
    6.33 -			localStorage.setItem("name", "user1");
    6.34 -			localStorage.setItem("age", "20");
    6.35 -			localStorage.setItem("a", "1");
    6.36 -			localStorage.setItem("b", "2");
    6.37 -
    6.38 -			try {
    6.39 -
    6.40 -				test(function() {
    6.41 -					assert_equals(localStorage.key(-1), null, "localStorage.key(-1)")
    6.42 -				}, "key method test")
    6.43 -
    6.44 -				test(function() {
    6.45 -					assert_equals(localStorage.key(4), null, "localStorage.key(4)")
    6.46 -				}, "key method test")
    6.47 -				
    6.48 -			} catch (e) {
    6.49 -				test(function()
    6.50 -				{
    6.51 -					assert_unreached("key method is failed.");
    6.52 -				}, "key method test")
    6.53 -			}
    6.54 -		} else {
    6.55 -			test(function()
    6.56 -			{
    6.57 -				assert_unreached("localStorage is not supported.");
    6.58 -			}, "localStorage support test")
    6.59 -		}	
    6.60 -	</script>
    6.61 -
    6.62 - </body>
    6.63 -</html>
    6.64 \ No newline at end of file
     7.1 --- a/WebStorage/tests/submissions/Infraware/storage_local_length.html	Fri Mar 23 22:57:42 2012 +0100
     7.2 +++ b/WebStorage/tests/submissions/Infraware/storage_local_length.html	Sat Mar 24 14:08:30 2012 +0100
     7.3 @@ -6,36 +6,18 @@
     7.4    <script src="/resources/testharnessreport.js"></script>
     7.5   </head>
     7.6   <body>
     7.7 -	<p>
     7.8 -		<h3>storage_local_length</h3>
     7.9 -	</p>
    7.10 -	
    7.11 -	<hr>
    7.12 +    <h1>storage_local_length</h1>
    7.13 +    <div id="log"></div>
    7.14 +    <script>
    7.15 +        test(function() {
    7.16 +            localStorage.clear();
    7.17 +            assert_equals(localStorage.length, 0, "localStorage.length")
    7.18  
    7.19 -	<div id="log"></div>
    7.20 +            localStorage.setItem("name", "user1");
    7.21 +            localStorage.setItem("age", "20");
    7.22  
    7.23 -	<script>
    7.24 -		if (('localStorage' in window) && window.localStorage !== null){
    7.25 -			localStorage.clear();
    7.26 -
    7.27 -			test(function() {
    7.28 -				assert_equals(localStorage.length, 0, "localStorage.length")
    7.29 -			}, "localStorage length test after clear()")
    7.30 -
    7.31 -			localStorage.setItem("name", "user1");
    7.32 -			localStorage.setItem("age", "20");
    7.33 -
    7.34 -			test(function() {
    7.35 -				assert_equals(localStorage.length, 2, "localStorage.length")
    7.36 -			}, "localStorage length test after setItem()")
    7.37 -
    7.38 -		} else {
    7.39 -			test(function()
    7.40 -			{
    7.41 -				assert_unreached("localStorage is not supported.");
    7.42 -			}, "localStorage support test")
    7.43 -		}	
    7.44 -	</script>
    7.45 -
    7.46 +            assert_equals(localStorage.length, 2, "localStorage.length")
    7.47 +        });
    7.48 +    </script>
    7.49   </body>
    7.50 -</html>
    7.51 \ No newline at end of file
    7.52 +</html>
     8.1 --- a/WebStorage/tests/submissions/Infraware/storage_local_removeitem.html	Fri Mar 23 22:57:42 2012 +0100
     8.2 +++ b/WebStorage/tests/submissions/Infraware/storage_local_removeitem.html	Sat Mar 24 14:08:30 2012 +0100
     8.3 @@ -6,47 +6,18 @@
     8.4    <script src="/resources/testharnessreport.js"></script>
     8.5   </head>
     8.6   <body>
     8.7 -	<p>
     8.8 -		<h3>storage_local_removeItem</h3>
     8.9 -	</p>
    8.10 -	
    8.11 -	<hr>
    8.12 +    <h1>storage_local_removeItem</h1>
    8.13 +    <div id="log"></div>
    8.14 +    <script>
    8.15 +        test(function() {
    8.16 +            localStorage.clear();
    8.17 +            localStorage.setItem("name", "user1");
    8.18 +            assert_equals(localStorage.getItem("name"), "user1");
    8.19  
    8.20 -	<div id="log"></div>
    8.21 -
    8.22 -	<script>
    8.23 -
    8.24 -		if (('localStorage' in window) && window.localStorage !== null){
    8.25 -			localStorage.clear();
    8.26 -			localStorage.setItem("name", "user1");
    8.27 -
    8.28 -			if (localStorage.getItem("name") == "user1")
    8.29 -			{
    8.30 -				try {
    8.31 -					localStorage.removeItem("name");
    8.32 -					localStorage.removeItem("unknown");
    8.33 -				} catch (e) {
    8.34 -					test(function() {
    8.35 -						assert_unreached("removeItem method is failed.");
    8.36 -					}, "removeItem test")
    8.37 -				}
    8.38 -
    8.39 -				test(function() {
    8.40 -					assert_equals(localStorage.getItem("name"), null, "localStorage.getItem('name')")
    8.41 -				}, "result test of removeItem method")
    8.42 -
    8.43 -			} else {
    8.44 -				test(function() {
    8.45 -					assert_unreached("'name' item is not exist.");
    8.46 -				}, "item existence test")
    8.47 -			}
    8.48 -		} else {
    8.49 -			test(function()
    8.50 -			{
    8.51 -				assert_unreached("localStorage is not supported.");
    8.52 -			}, "localStorage support test")
    8.53 -		}	
    8.54 -	</script>
    8.55 -
    8.56 +            localStorage.removeItem("name");
    8.57 +            localStorage.removeItem("unknown");
    8.58 +            assert_equals(localStorage.getItem("name"), null, "localStorage.getItem('name')")
    8.59 +        });
    8.60 +    </script>
    8.61   </body>
    8.62 -</html>
    8.63 \ No newline at end of file
    8.64 +</html>
     9.1 --- a/WebStorage/tests/submissions/Infraware/storage_local_setitem.html	Fri Mar 23 22:57:42 2012 +0100
     9.2 +++ b/WebStorage/tests/submissions/Infraware/storage_local_setitem.html	Sat Mar 24 14:08:30 2012 +0100
     9.3 @@ -6,39 +6,14 @@
     9.4    <script src="/resources/testharnessreport.js"></script>
     9.5   </head>
     9.6   <body>
     9.7 -	<p>
     9.8 -		<h3>storage_local_setItem</h3>
     9.9 -	</p>
    9.10 -	
    9.11 -	<hr>
    9.12 -
    9.13 -	<div id="log"></div>
    9.14 -
    9.15 -	<script>
    9.16 -
    9.17 -		if (('localStorage' in window) && window.localStorage !== null){
    9.18 -			localStorage.clear();
    9.19 -
    9.20 -			try {
    9.21 -				localStorage.setItem("name", "user1");
    9.22 -			} catch (e) {
    9.23 -				test(function()
    9.24 -				{
    9.25 -					assert_unreached("setItem method is failed.");
    9.26 -				}, "setItem method test")
    9.27 -			}
    9.28 -
    9.29 -			test(function() {
    9.30 -				assert_not_equals(localStorage.length, 0, "localStorage.setItem")
    9.31 -			}, "setItem method test")
    9.32 -
    9.33 -		} else {
    9.34 -			test(function()
    9.35 -			{
    9.36 -				assert_unreached("localStorage is not supported.");
    9.37 -			}, "localStorage support test")
    9.38 -		}	
    9.39 -	</script>
    9.40 -
    9.41 +    <h1>storage_local_setItem</h1>
    9.42 +    <div id="log"></div>
    9.43 +    <script>
    9.44 +        test(function() {
    9.45 +            localStorage.clear();
    9.46 +            localStorage.setItem("name", "user1");
    9.47 +            assert_equals(localStorage.length, 1, "localStorage.setItem")
    9.48 +        });
    9.49 +    </script>
    9.50   </body>
    9.51 -</html>
    9.52 \ No newline at end of file
    9.53 +</html>
    10.1 --- a/WebStorage/tests/submissions/Infraware/storage_local_setitem_quotaexceedederr.html	Fri Mar 23 22:57:42 2012 +0100
    10.2 +++ b/WebStorage/tests/submissions/Infraware/storage_local_setitem_quotaexceedederr.html	Sat Mar 24 14:08:30 2012 +0100
    10.3 @@ -6,46 +6,25 @@
    10.4    <script src="/resources/testharnessreport.js"></script>
    10.5   </head>
    10.6   <body>
    10.7 -	<p>
    10.8 -		<h3>storage_local_setItem_QUOTA_EXCEEDED_ERR</h3>
    10.9 -	</p>
   10.10 -	
   10.11 -	<hr>
   10.12 +    <h1>storage_local_setItem_QUOTA_EXCEEDED_ERR</h1>
   10.13 +    <div id="log"></div>
   10.14 +    <script>
   10.15 +        test(function() {
   10.16 +            localStorage.clear();
   10.17  
   10.18 -	<div id="log"></div>
   10.19 +            var index = 0;
   10.20 +            var key = "name";
   10.21 +            var val = "user";
   10.22  
   10.23 -	<script>
   10.24 +            assert_throws("QUOTA_EXCEEDED_ERR", function() {
   10.25 +                while (true) {
   10.26 +                    index++;
   10.27 +                    localStorage.setItem("" + key + index, "" + name + index);
   10.28 +                }
   10.29 +            });
   10.30  
   10.31 -		if (('localStorage' in window) && window.localStorage !== null){
   10.32 -			localStorage.clear();
   10.33 -
   10.34 -			var index = 0;
   10.35 -			var key = "name";
   10.36 -			var val = "user";
   10.37 -
   10.38 -			try {
   10.39 -				while (true)
   10.40 -				{
   10.41 -					index++;
   10.42 -					localStorage.setItem("" + key + index, "" + name + index);
   10.43 -				}
   10.44 -			} catch (e) {
   10.45 -				if (e.code == e["QUOTA_EXCEEDED_ERR"]) {
   10.46 -					test(function() {
   10.47 -						assert_true(true);
   10.48 -					}, "QUOTA_EXCEEDED_ERR error test")
   10.49 -				} else {
   10.50 -					test(function() {
   10.51 -						assert_unreached("QUOTA_EXCEEDED_ERR error did not raised.");
   10.52 -					}, "QUOTA_EXCEEDED_ERR error test")
   10.53 -				}
   10.54 -			}
   10.55 -
   10.56 -			localStorage.clear();
   10.57 -		} else {
   10.58 -			fail("localStorage is not supported.");
   10.59 -		}	
   10.60 -	</script>
   10.61 -
   10.62 +            localStorage.clear();
   10.63 +        });
   10.64 +    </script>
   10.65   </body>
   10.66 -</html>
   10.67 \ No newline at end of file
   10.68 +</html>
    11.1 --- a/WebStorage/tests/submissions/Infraware/storage_session_clear.html	Fri Mar 23 22:57:42 2012 +0100
    11.2 +++ b/WebStorage/tests/submissions/Infraware/storage_session_clear.html	Sat Mar 24 14:08:30 2012 +0100
    11.3 @@ -6,51 +6,20 @@
    11.4    <script src="/resources/testharnessreport.js"></script>
    11.5   </head>
    11.6   <body>
    11.7 -	<p>
    11.8 -		<h3>storage_session_clear</h3>
    11.9 -	</p>
   11.10 -	
   11.11 -	<hr>
   11.12 +    <h1>storage_session_clear</h1>
   11.13 +    <div id="log"></div>
   11.14 +    <script>
   11.15 +        test(function() {
   11.16 +            sessionStorage.clear();
   11.17 +            sessionStorage.setItem("name", "user1");
   11.18  
   11.19 -	<div id="log"></div>
   11.20 +            assert_not_equals(sessionStorage.getItem("name"), null);
   11.21 +            assert_equals(sessionStorage.length, 1);
   11.22  
   11.23 -	<script>
   11.24 -
   11.25 -		if (('sessionStorage' in window) && window.sessionStorage !== null){
   11.26 -			sessionStorage.clear();
   11.27 -			sessionStorage.setItem("name", "user1");
   11.28 -
   11.29 -			if (sessionStorage.getItem("name") != null && sessionStorage.length == 1)
   11.30 -			{
   11.31 -				try {
   11.32 -					sessionStorage.clear();
   11.33 -				} catch (e) {
   11.34 -					test(function()
   11.35 -					{
   11.36 -						assert_unreached("clear method is failed.");
   11.37 -					}, "clear method test")
   11.38 -				}
   11.39 -
   11.40 -				test(function() {
   11.41 -					assert_equals(sessionStorage.getItem("name"), null, "sessionStorage.getItem('name')")
   11.42 -				}, "result test of clear method (item)")
   11.43 -
   11.44 -				test(function() {
   11.45 -					assert_equals(sessionStorage.length, 0, "sessionStorage.length")
   11.46 -				}, "result test of clear method (length)")
   11.47 -
   11.48 -			} else {
   11.49 -				test(function() {
   11.50 -					assert_unreached("'name' item is not exist.");
   11.51 -				}, "item existence test")
   11.52 -			}
   11.53 -		} else {
   11.54 -			test(function()
   11.55 -			{
   11.56 -				assert_unreached("sessionStorage is not supported.");
   11.57 -			}, "sessionStorage support test")
   11.58 -		}	
   11.59 -	</script>
   11.60 -
   11.61 +            sessionStorage.clear();
   11.62 +            assert_equals(sessionStorage.getItem("name"), null, "sessionStorage.getItem('name')")
   11.63 +            assert_equals(sessionStorage.length, 0, "sessionStorage.length")
   11.64 +        });
   11.65 +    </script>
   11.66   </body>
   11.67 -</html>
   11.68 \ No newline at end of file
   11.69 +</html>
    12.1 --- a/WebStorage/tests/submissions/Infraware/storage_session_getitem.html	Fri Mar 23 22:57:42 2012 +0100
    12.2 +++ b/WebStorage/tests/submissions/Infraware/storage_session_getitem.html	Sat Mar 24 14:08:30 2012 +0100
    12.3 @@ -6,38 +6,18 @@
    12.4    <script src="/resources/testharnessreport.js"></script>
    12.5   </head>
    12.6   <body>
    12.7 -	<p>
    12.8 -		<h3>storage_session_getItem</h3>
    12.9 -	</p>
   12.10 -	
   12.11 -	<hr>
   12.12 -
   12.13 -	<div id="log"></div>
   12.14 -
   12.15 -	<script>
   12.16 -
   12.17 -		if (('sessionStorage' in window) && window.sessionStorage !== null){
   12.18 -			sessionStorage.clear();
   12.19 -			sessionStorage.setItem("name", "user1");
   12.20 -			sessionStorage.setItem("age", "20");
   12.21 -
   12.22 -			try {
   12.23 -				test(function() {
   12.24 -					assert_equals(sessionStorage.getItem("name"), "user1", "sessionStorage.getItem('name')")
   12.25 -				}, "getItem method test")
   12.26 -			} catch (e) {
   12.27 -				test(function()
   12.28 -				{
   12.29 -					assert_unreached("getItem method is failed.");
   12.30 -				}, "getItem method test")
   12.31 -			}
   12.32 -		} else {
   12.33 -			test(function()
   12.34 -			{
   12.35 -				assert_unreached("sessionStorage is not supported.");
   12.36 -			}, "sessionStorage support test")
   12.37 -		}	
   12.38 -	</script>
   12.39 -
   12.40 +    <h1>storage_session_getItem</h1>
   12.41 +    <div id="log"></div>
   12.42 +    <script>
   12.43 +        test(function() {
   12.44 +            sessionStorage.clear();
   12.45 +            sessionStorage.setItem("name", "user1");
   12.46 +            sessionStorage.setItem("age", "20");
   12.47 +            test(function() {
   12.48 +                assert_equals(sessionStorage.getItem("name"), "user1", "sessionStorage.getItem('name')")
   12.49 +                assert_equals(sessionStorage.getItem("unknown"), null, "sessionStorage.getItem('name')")
   12.50 +            }, "getItem method test")
   12.51 +        });
   12.52 +    </script>
   12.53   </body>
   12.54 -</html>
   12.55 \ No newline at end of file
   12.56 +</html>
    13.1 --- a/WebStorage/tests/submissions/Infraware/storage_session_getitem_null.html	Fri Mar 23 22:57:42 2012 +0100
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,43 +0,0 @@
    13.4 -<!DOCTYPE HTML>
    13.5 -<html>
    13.6 - <head>
    13.7 -  <title>Web Storage</title>
    13.8 -  <script src="/resources/testharness.js"></script>
    13.9 -  <script src="/resources/testharnessreport.js"></script>
   13.10 - </head>
   13.11 - <body>
   13.12 -	<p>
   13.13 -		<h3>storage_session_getItem_null</h3>
   13.14 -	</p>
   13.15 -	
   13.16 -	<hr>
   13.17 -
   13.18 -	<div id="log"></div>
   13.19 -
   13.20 -	<script>
   13.21 -
   13.22 -		if (('sessionStorage' in window) && window.sessionStorage !== null){
   13.23 -			sessionStorage.clear();
   13.24 -			sessionStorage.setItem("name", "user1");
   13.25 -			sessionStorage.setItem("age", "20");
   13.26 -
   13.27 -			try {
   13.28 -				test(function() {
   13.29 -					assert_equals(sessionStorage.getItem("unknown"), null, "sessionStorage.getItem('name')")
   13.30 -				}, "getItem method test")
   13.31 -			} catch (e) {
   13.32 -				test(function()
   13.33 -				{
   13.34 -					assert_unreached("getItem method is failed.");
   13.35 -				}, "getItem method test")
   13.36 -			}
   13.37 -		} else {
   13.38 -			test(function()
   13.39 -			{
   13.40 -				assert_unreached("sessionStorage is not supported.");
   13.41 -			}, "sessionStorage support test")
   13.42 -		}	
   13.43 -	</script>
   13.44 -
   13.45 - </body>
   13.46 -</html>
   13.47 \ No newline at end of file
    14.1 --- a/WebStorage/tests/submissions/Infraware/storage_session_key.html	Fri Mar 23 22:57:42 2012 +0100
    14.2 +++ b/WebStorage/tests/submissions/Infraware/storage_session_key.html	Sat Mar 24 14:08:30 2012 +0100
    14.3 @@ -6,54 +6,35 @@
    14.4    <script src="/resources/testharnessreport.js"></script>
    14.5   </head>
    14.6   <body>
    14.7 -	<p>
    14.8 -		<h3>storage_session_key</h3>
    14.9 -	</p>
   14.10 -	
   14.11 -	<hr>
   14.12 +    <h1>storage_session_key</h1>
   14.13 +    <div id="log"></div>
   14.14 +    <script>
   14.15 +        test(function() {
   14.16 +            sessionStorage.clear();
   14.17  
   14.18 -	<div id="log"></div>
   14.19 +            sessionStorage.setItem("name", "user1");
   14.20 +            sessionStorage.setItem("age", "20");
   14.21 +            sessionStorage.setItem("a", "1");
   14.22 +            sessionStorage.setItem("b", "2");
   14.23  
   14.24 -	<script>
   14.25 -
   14.26 -		if (('sessionStorage' in window) && window.sessionStorage !== null){
   14.27 -			sessionStorage.clear();
   14.28 -
   14.29 -			sessionStorage.setItem("name", "user1");
   14.30 -			sessionStorage.setItem("age", "20");
   14.31 -			sessionStorage.setItem("a", "1");
   14.32 -			sessionStorage.setItem("b", "2");
   14.33 -
   14.34 -			try {
   14.35 -				var keys = ["name","age","a","b"];
   14.36 -				function checkMatch(index){
   14.37 -					for (var i = 0; i < keys.length ; i++){
   14.38 -						if(sessionStorage.key(index) == keys[i]){
   14.39 -							delete keys[i];
   14.40 -							return true;
   14.41 -						}
   14.42 -					}
   14.43 -					return false;
   14.44 -				}
   14.45 -					
   14.46 -				test(function()
   14.47 -				{
   14.48 -					assert_true(checkMatch(0) && checkMatch(1) && checkMatch(2) && checkMatch(3), "key method is failed.");
   14.49 -				}, "key method test")
   14.50 -				
   14.51 -			} catch (e) {
   14.52 -				test(function()
   14.53 -				{
   14.54 -					assert_unreached("key method is failed.");
   14.55 -				}, "key method test")
   14.56 -			}
   14.57 -		} else {
   14.58 -			test(function()
   14.59 -			{
   14.60 -				assert_unreached("sessionStorage is not supported.");
   14.61 -			}, "sessionStorage support test")
   14.62 -		}	
   14.63 -	</script>
   14.64 -
   14.65 +            var keys = ["name", "age", "a", "b"];
   14.66 +            function doTest(index) {
   14.67 +                test(function() {
   14.68 +                    var key = sessionStorage.key(index);
   14.69 +                    assert_not_equals(key, null);
   14.70 +                    assert_true(keys.indexOf(key) >= 0,
   14.71 +                                "Unexpected key " + key + " found.");
   14.72 +                }, "key(" + index + ") should return the right thing.");
   14.73 +            }
   14.74 +            for (var i = 0; i < keys.length; ++i) {
   14.75 +                doTest(i);
   14.76 +                doTest(i + 0x100000000);
   14.77 +            }
   14.78 +            test(function() {
   14.79 +                assert_equals(sessionStorage.key(-1), null, "sessionStorage.key(-1)");
   14.80 +                assert_equals(sessionStorage.key(4), null, "sessionStorage.key(4)");
   14.81 +            }, "key() should return null for out-of-range arguments.");
   14.82 +        });
   14.83 +    </script>
   14.84   </body>
   14.85 -</html>
   14.86 \ No newline at end of file
   14.87 +</html>
    15.1 --- a/WebStorage/tests/submissions/Infraware/storage_session_key_null.html	Fri Mar 23 22:57:42 2012 +0100
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,52 +0,0 @@
    15.4 -<!DOCTYPE HTML>
    15.5 -<html>
    15.6 - <head>
    15.7 -  <title>Web Storage</title>
    15.8 -  <script src="/resources/testharness.js"></script>
    15.9 -  <script src="/resources/testharnessreport.js"></script>
   15.10 - </head>
   15.11 - <body>
   15.12 -	<p>
   15.13 -		<h3>storage_session_key_null</h3>
   15.14 -	</p>
   15.15 -	
   15.16 -	<hr>
   15.17 -
   15.18 -	<div id="log"></div>
   15.19 -
   15.20 -	<script>
   15.21 -
   15.22 -		if (('sessionStorage' in window) && window.sessionStorage !== null){
   15.23 -			sessionStorage.clear();
   15.24 -
   15.25 -			sessionStorage.setItem("name", "user1");
   15.26 -			sessionStorage.setItem("age", "20");
   15.27 -			sessionStorage.setItem("a", "1");
   15.28 -			sessionStorage.setItem("b", "2");
   15.29 -
   15.30 -			try {
   15.31 -
   15.32 -				test(function() {
   15.33 -					assert_equals(sessionStorage.key(-1), null, "sessionStorage.key(-1)")
   15.34 -				}, "key method test")
   15.35 -
   15.36 -				test(function() {
   15.37 -					assert_equals(sessionStorage.key(4), null, "sessionStorage.key(4)")
   15.38 -				}, "key method test")
   15.39 -				
   15.40 -			} catch (e) {
   15.41 -				test(function()
   15.42 -				{
   15.43 -					assert_unreached("key method is failed.");
   15.44 -				}, "key method test")
   15.45 -			}
   15.46 -		} else {
   15.47 -			test(function()
   15.48 -			{
   15.49 -				assert_unreached("sessionStorage is not supported.");
   15.50 -			}, "sessionStorage support test")
   15.51 -		}	
   15.52 -	</script>
   15.53 -
   15.54 - </body>
   15.55 -</html>
   15.56 \ No newline at end of file
    16.1 --- a/WebStorage/tests/submissions/Infraware/storage_session_length.html	Fri Mar 23 22:57:42 2012 +0100
    16.2 +++ b/WebStorage/tests/submissions/Infraware/storage_session_length.html	Sat Mar 24 14:08:30 2012 +0100
    16.3 @@ -6,36 +6,18 @@
    16.4    <script src="/resources/testharnessreport.js"></script>
    16.5   </head>
    16.6   <body>
    16.7 -	<p>
    16.8 -		<h3>storage_session_length</h3>
    16.9 -	</p>
   16.10 -	
   16.11 -	<hr>
   16.12 +    <h1>storage_session_length</h1>
   16.13 +    <div id="log"></div>
   16.14 +    <script>
   16.15 +        test(function() {
   16.16 +            sessionStorage.clear();
   16.17 +            assert_equals(sessionStorage.length, 0, "sessionStorage.length")
   16.18  
   16.19 -	<div id="log"></div>
   16.20 +            sessionStorage.setItem("name", "user1");
   16.21 +            sessionStorage.setItem("age", "20");
   16.22  
   16.23 -	<script>
   16.24 -		if (('sessionStorage' in window) && window.sessionStorage !== null){
   16.25 -			sessionStorage.clear();
   16.26 -			
   16.27 -			test(function() {
   16.28 -				assert_equals(sessionStorage.length, 0, "sessionStorage.length")
   16.29 -			}, "sessionStorage length test after clear()")
   16.30 -
   16.31 -			sessionStorage.setItem("name", "user1");
   16.32 -			sessionStorage.setItem("age", "20");
   16.33 -
   16.34 -			test(function() {
   16.35 -				assert_equals(sessionStorage.length, 2, "sessionStorage.length")
   16.36 -			}, "sessionStorage length test after setItem()")
   16.37 -
   16.38 -		} else {
   16.39 -			test(function()
   16.40 -			{
   16.41 -				assert_unreached("sessionStorage is not supported.");
   16.42 -			}, "sessionStorage support test")
   16.43 -		}	
   16.44 -	</script>
   16.45 -
   16.46 +            assert_equals(sessionStorage.length, 2, "sessionStorage.length")
   16.47 +        });
   16.48 +    </script>
   16.49   </body>
   16.50 -</html>
   16.51 \ No newline at end of file
   16.52 +</html>
    17.1 --- a/WebStorage/tests/submissions/Infraware/storage_session_removeitem.html	Fri Mar 23 22:57:42 2012 +0100
    17.2 +++ b/WebStorage/tests/submissions/Infraware/storage_session_removeitem.html	Sat Mar 24 14:08:30 2012 +0100
    17.3 @@ -6,47 +6,18 @@
    17.4    <script src="/resources/testharnessreport.js"></script>
    17.5   </head>
    17.6   <body>
    17.7 -	<p>
    17.8 -		<h3>storage_session_removeItem</h3>
    17.9 -	</p>
   17.10 -	
   17.11 -	<hr>
   17.12 +    <h1>storage_session_removeItem</h1>
   17.13 +    <div id="log"></div>
   17.14 +    <script>
   17.15 +        test(function() {
   17.16 +            sessionStorage.clear();
   17.17 +            sessionStorage.setItem("name", "user1");
   17.18 +            assert_equals(sessionStorage.getItem("name"), "user1");
   17.19  
   17.20 -	<div id="log"></div>
   17.21 -
   17.22 -	<script>
   17.23 -
   17.24 -		if (('sessionStorage' in window) && window.sessionStorage !== null){
   17.25 -			sessionStorage.clear();
   17.26 -			sessionStorage.setItem("name", "user1");
   17.27 -
   17.28 -			if (sessionStorage.getItem("name") == "user1")
   17.29 -			{
   17.30 -				try {
   17.31 -					sessionStorage.removeItem("name");
   17.32 -					sessionStorage.removeItem("unknown");
   17.33 -				} catch (e) {
   17.34 -					test(function() {
   17.35 -						assert_unreached("removeItem method is failed.");
   17.36 -					}, "removeItem test")
   17.37 -				}
   17.38 -
   17.39 -				test(function() {
   17.40 -					assert_equals(sessionStorage.getItem("name"), null, "sessionStorage.getItem('name')")
   17.41 -				}, "result test of removeItem method")
   17.42 -
   17.43 -			} else {
   17.44 -				test(function() {
   17.45 -					assert_unreached("'name' item is not exist.");
   17.46 -				}, "item existence test")
   17.47 -			}
   17.48 -		} else {
   17.49 -			test(function()
   17.50 -			{
   17.51 -				assert_unreached("sessionStorage is not supported.");
   17.52 -			}, "sessionStorage support test")
   17.53 -		}	
   17.54 -	</script>
   17.55 -
   17.56 +            sessionStorage.removeItem("name");
   17.57 +            sessionStorage.removeItem("unknown");
   17.58 +            assert_equals(sessionStorage.getItem("name"), null, "sessionStorage.getItem('name')")
   17.59 +        });
   17.60 +    </script>
   17.61   </body>
   17.62 -</html>
   17.63 \ No newline at end of file
   17.64 +</html>
    18.1 --- a/WebStorage/tests/submissions/Infraware/storage_session_setitem.html	Fri Mar 23 22:57:42 2012 +0100
    18.2 +++ b/WebStorage/tests/submissions/Infraware/storage_session_setitem.html	Sat Mar 24 14:08:30 2012 +0100
    18.3 @@ -6,39 +6,14 @@
    18.4    <script src="/resources/testharnessreport.js"></script>
    18.5   </head>
    18.6   <body>
    18.7 -	<p>
    18.8 -		<h3>storage_session_setItem</h3>
    18.9 -	</p>
   18.10 -	
   18.11 -	<hr>
   18.12 -
   18.13 -	<div id="log"></div>
   18.14 -
   18.15 -	<script>
   18.16 -
   18.17 -		if (('sessionStorage' in window) && window.sessionStorage !== null){
   18.18 -			sessionStorage.clear();
   18.19 -
   18.20 -			try {
   18.21 -				sessionStorage.setItem("name", "user1");
   18.22 -			} catch (e) {
   18.23 -				test(function()
   18.24 -				{
   18.25 -					assert_unreached("setItem method is failed.");
   18.26 -				}, "setItem method test")
   18.27 -			}
   18.28 -
   18.29 -			test(function() {
   18.30 -				assert_not_equals(sessionStorage.length, 0, "sessionStorage.setItem")
   18.31 -			}, "setItem method test")
   18.32 -
   18.33 -		} else {
   18.34 -			test(function()
   18.35 -			{
   18.36 -				assert_unreached("sessionStorage is not supported.");
   18.37 -			}, "sessionStorage support test")
   18.38 -		}	
   18.39 -	</script>
   18.40 -
   18.41 +    <h1>storage_session_setItem</h1>
   18.42 +    <div id="log"></div>
   18.43 +    <script>
   18.44 +        test(function() {
   18.45 +            sessionStorage.clear();
   18.46 +            sessionStorage.setItem("name", "user1");
   18.47 +            assert_equals(sessionStorage.length, 1, "localStorage.setItem")
   18.48 +        });
   18.49 +    </script>
   18.50   </body>
   18.51 -</html>
   18.52 \ No newline at end of file
   18.53 +</html>
    19.1 --- a/WebStorage/tests/submissions/Infraware/storage_session_setitem_quotaexceedederr.html	Fri Mar 23 22:57:42 2012 +0100
    19.2 +++ b/WebStorage/tests/submissions/Infraware/storage_session_setitem_quotaexceedederr.html	Sat Mar 24 14:08:30 2012 +0100
    19.3 @@ -6,46 +6,25 @@
    19.4    <script src="/resources/testharnessreport.js"></script>
    19.5   </head>
    19.6   <body>
    19.7 -	<p>
    19.8 -		<h3>storage_session_setItem_QUOTA_EXCEEDED_ERR</h3>
    19.9 -	</p>
   19.10 -	
   19.11 -	<hr>
   19.12 +    <h1>storage_session_setItem_QUOTA_EXCEEDED_ERR</h1>
   19.13 +    <div id="log"></div>
   19.14 +    <script>
   19.15 +        test(function() {
   19.16 +            sessionStorage.clear();
   19.17  
   19.18 -	<div id="log"></div>
   19.19 +            var index = 0;
   19.20 +            var key = "name";
   19.21 +            var val = "user";
   19.22  
   19.23 -	<script>
   19.24 +            assert_throws("QUOTA_EXCEEDED_ERR", function() {
   19.25 +                while (true) {
   19.26 +                    index++;
   19.27 +                    sessionStorage.setItem("" + key + index, "" + name + index);
   19.28 +                }
   19.29 +            });
   19.30  
   19.31 -		if (('sessionStorage' in window) && window.sessionStorage !== null){
   19.32 -			sessionStorage.clear();
   19.33 -
   19.34 -			var index = 0;
   19.35 -			var key = "name";
   19.36 -			var val = "user";
   19.37 -
   19.38 -			try {
   19.39 -				while (true)
   19.40 -				{
   19.41 -					index++;
   19.42 -					sessionStorage.setItem("" + key + index, "" + name + index);
   19.43 -				}
   19.44 -			} catch (e) {
   19.45 -				if (e.code == e["QUOTA_EXCEEDED_ERR"]) {
   19.46 -					test(function() {
   19.47 -						assert_true(true);
   19.48 -					}, "QUOTA_EXCEEDED_ERR error test")
   19.49 -				} else {
   19.50 -					test(function() {
   19.51 -						assert_unreached("QUOTA_EXCEEDED_ERR error did not raised.");
   19.52 -					}, "QUOTA_EXCEEDED_ERR error test")
   19.53 -				}
   19.54 -			}
   19.55 -
   19.56 -			sessionStorage.clear();
   19.57 -		} else {
   19.58 -			fail("sessionStorage is not supported.");
   19.59 -		}	
   19.60 -	</script>
   19.61 -
   19.62 +            sessionStorage.clear();
   19.63 +        });
   19.64 +    </script>
   19.65   </body>
   19.66 -</html>
   19.67 \ No newline at end of file
   19.68 +</html>
Set up and maintained by W3C Systems Team, please report bugs to sysreq@w3.org.

W3C would like to thank Microsoft who donated the server that allows us to run this service.