Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-storage-dom-access.php

Issue 2370843003: Suborigin LayoutTest formatting and refactoring (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-storage-dom-access.php
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-storage-dom-access.php b/third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-storage-dom-access.php
index a373506f177da67e3eb3bf1b646f2d7462838c3b..b0e90f6ff81f6b3aa4d73983dab5411af091aa4d 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-storage-dom-access.php
+++ b/third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-storage-dom-access.php
@@ -4,25 +4,28 @@ header("Suborigin: foobar");
<!DOCTYPE html>
<html>
<head>
+<meta charset="utf-8">
<title>Verifies that localStorage and sessionStorage are not accessible from within a suborigin</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
-var expectedError = new DOMException("TEST EXCEPTION", "SecurityError");
-var localStorageTest = async_test("localStorage must not be accessible from a suborigin");
-var sessionStorageTest = async_test("sessionStorage must not be accessible from a suborigin");
+var expected_error = new DOMException('TEST EXCEPTION', 'SecurityError');
-function mustThrowSecurityException() {
- assert_throws(expectedError, function() {
- window.localStorage;
- });
- this.done();
+function must_throw_security_exception(storage) {
+ return function(t) {
+ assert_throws(expected_error, function() {
+ window[storage];
+ });
+ t.done();
+ };
}
-localStorageTest.step(mustThrowSecurityException);
-sessionStorageTest.step(mustThrowSecurityException);
+async_test(must_throw_security_exception('localStorage'),
+ 'localStorage must not be accessible from a suborigin');
+async_test(must_throw_security_exception('sessionStorage'),
+ 'sessionStorage must not be accessible from a suborigin');
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698