Bug 765177 - Part a: Update WebStorage tests; r=bz

This commit is contained in:
Ms2ger 2012-06-17 10:11:16 +02:00
Родитель c403b93455
Коммит 0694b06721
4 изменённых файлов: 47 добавлений и 0 удалений

Просмотреть файл

@ -12,6 +12,7 @@ include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TESTS = \
test_missing_arguments.html.json \
test_storage_local_in_js.html.json \
test_storage_local_removeitem_js.html.json \
test_storage_session_in_js.html.json \

Просмотреть файл

@ -0,0 +1,13 @@
{
"Should throw TypeError for function \"function () {\n localStorage.key();\n}\".": true,
"Should throw TypeError for function \"function () {\n localStorage.getItem();\n}\".": true,
"Should throw TypeError for function \"function () {\n localStorage.setItem();\n}\".": true,
"Should throw TypeError for function \"function () {\n localStorage.setItem(\"a\");\n}\".": true,
"Should throw TypeError for function \"function () {\n localStorage.removeItem();\n}\".": true,
"Should throw TypeError for function \"function () {\n sessionStorage.key();\n}\".": true,
"Should throw TypeError for function \"function () {\n sessionStorage.getItem();\n}\".": true,
"Should throw TypeError for function \"function () {\n sessionStorage.setItem();\n}\".": true,
"Should throw TypeError for function \"function () {\n sessionStorage.setItem(\"a\");\n}\".": true,
"Should throw TypeError for function \"function () {\n sessionStorage.removeItem();\n}\".": true,
"Should throw TypeError for function \"function () {\n new StorageEvent;\n}\".": true
}

Просмотреть файл

@ -15,6 +15,7 @@ include $(topsrcdir)/config/rules.mk
_TESTS = \
test_event_constructor_js.html \
test_missing_arguments.html \
test_storage_local_clear_js.html \
test_storage_local_getitem_js.html \
test_storage_local_index_js.html \

Просмотреть файл

@ -0,0 +1,32 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Web Storage</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<h1>missing_arguments</h1>
<div id="log"></div>
<script>
var tests = [
function() { localStorage.key(); },
function() { localStorage.getItem(); },
function() { localStorage.setItem(); },
function() { localStorage.setItem("a"); },
function() { localStorage.removeItem(); },
function() { sessionStorage.key(); },
function() { sessionStorage.getItem(); },
function() { sessionStorage.setItem(); },
function() { sessionStorage.setItem("a"); },
function() { sessionStorage.removeItem(); },
function() { new StorageEvent(); }
];
tests.forEach(function(fun) {
test(function() {
assert_throws(new TypeError(), fun);
}, "Should throw TypeError for " + format_value(fun) + ".");
});
</script>
</body>
</html>