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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/suborigins/crossorigin/suborigin-cors-eventsource.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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/security/suborigins/crossorigin/suborigin-cors-fetch.php » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/security/suborigins/crossorigin/suborigin-cors-eventsource.php
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/suborigins/crossorigin/suborigin-cors-eventsource.php b/third_party/WebKit/LayoutTests/http/tests/security/suborigins/crossorigin/suborigin-cors-eventsource.php
index 99211815ad754408125eac3d04c83f63bcd9a9dc..d558429b2d6301df5e710de4525f837dfd916bfd 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/suborigins/crossorigin/suborigin-cors-eventsource.php
+++ b/third_party/WebKit/LayoutTests/http/tests/security/suborigins/crossorigin/suborigin-cors-eventsource.php
@@ -4,6 +4,7 @@ header("Suborigin: foobar");
<!DOCTYPE html>
<html>
<head>
+<meta charset="utf-8">
<title>Verify CORS behavior on Suborigin using EventSource</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
@@ -12,69 +13,79 @@ header("Suborigin: foobar");
<body>
<div id="container"></div>
<script>
-var xorigin_anon_event_source_string = 'http://127.0.0.1:8000/eventsource/resources/es-cors-basic.php?';
-var xorigin_creds_event_source_string = 'http://127.0.0.1:8000/eventsource/resources/es-cors-credentials.php?';
-var xorigin_ineligible_event_source_string = 'http://127.0.0.1:8000/eventsource/resources/es-cors-basic.php?';
+var xorigin_anon_event_source_string =
+ 'http://127.0.0.1:8000/eventsource/resources/es-cors-basic.php?';
+var xorigin_creds_event_source_string =
+ 'http://127.0.0.1:8000/eventsource/resources/es-cors-credentials.php?';
+var xorigin_ineligible_event_source_string =
+ 'http://127.0.0.1:8000/eventsource/resources/es-cors-basic.php?';
-function xoriginAnonEventSource(acao_value) { return genCorsSrc(xorigin_anon_event_source_string, acao_value); }
-function xoriginCredsEventSource(acao_value) { return genCorsSrc(xorigin_creds_event_source_string, acao_value); }
-function xoriginIneligibleEventSource(acao_value) { return genCorsSrc(xorigin_ineligible_event_source_string); }
+function xorigin_anon_event_source(acao_value) {
+ return gen_cors_src(xorigin_anon_event_source_string, acao_value);
+}
+function xorigin_creds_event_source(acao_value) {
+ return gen_cors_src(xorigin_creds_event_source_string, acao_value);
+}
+function xorigin_ineligible_event_source(acao_value) {
+ return gen_cors_src(xorigin_ineligible_event_source_string);
+}
// EventSource tests
-var SuboriginEventSourceTest = function(pass, name, src, crossoriginValue) {
- SuboriginTest.call(this, pass, "EventSource: " + name, src, crossoriginValue);
+var SuboriginEventSourceTest = function(pass, name, src, crossorigin_value) {
+ SuboriginTest.call(
+ this, pass, 'EventSource: ' + name, src, crossorigin_value);
}
SuboriginEventSourceTest.prototype.execute = function() {
- var test = async_test(this.name);
- var pass = this.pass;
- var options = {};
+ var test = async_test(this.name);
+ var pass = this.pass;
+ var options = {};
- if (this.crossoriginValue === 'use-credentials') {
- options.withCredentials = 'include';
- }
+ if (this.crossorigin_value === 'use-credentials') {
+ options.withCredentials = 'include';
+ }
- var es = new EventSource(this.src, options);
- es.onmessage = test.step_func(function() {
- if (pass) {
- test.done();
- } else {
- assert_unreached("Bad EventSource received message.");
- }
+ var es = new EventSource(this.src, options);
+ es.onmessage = test.step_func(function() {
+ if (pass) {
+ test.done();
+ } else {
+ assert_unreached('Bad EventSource received message.');
+ }
});
- es.onerror = test.step_func(function() {
- if (pass) {
- assert_unreached("Good EventSource failed to connect.");
- } else {
- test.done();
- }
+ es.onerror = test.step_func(function() {
+ if (pass) {
+ assert_unreached('Good EventSource failed to connect.');
+ } else {
+ test.done();
+ }
});
};
// EventSource tests
new SuboriginEventSourceTest(
- false,
- "anonymous, ACAO: " + server,
- xoriginAnonEventSource(),
- "anonymous").execute();
+ false,
+ 'anonymous, ACAO: ' + server,
+ xorigin_anon_event_source(),
+ 'anonymous').execute();
new SuboriginEventSourceTest(
- true,
- "anonymous, ACAO: *",
- xoriginAnonEventSource('*'),
- "anonymous").execute();
+ true,
+ 'anonymous, ACAO: *',
+ xorigin_anon_event_source('*'),
+ 'anonymous').execute();
new SuboriginEventSourceTest(
- false,
- "use-credentials, ACAO: " + server,
- xoriginCredsEventSource(),
- "use-credentials").execute();
+ false,
+ 'use-credentials, ACAO: ' + server,
+ xorigin_creds_event_source(),
+ 'use-credentials').execute();
new SuboriginEventSourceTest(
- false,
- "anonymous, CORS-ineligible resource",
- xoriginIneligibleEventSource(),
- "anonymous").execute();
+ false,
+ 'anonymous, CORS-ineligible resource',
+ xorigin_ineligible_event_source(),
+ 'anonymous').execute();
</script>
</body>
</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/security/suborigins/crossorigin/suborigin-cors-fetch.php » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698