Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / eventsource / eventsource-constructor.html
blobd127f17c8effdbd1024040a3214176f29e816c5b
1 <html>
2 <head>
3 <meta http-equiv="Content-Security-Policy" content="connect-src http://invalid http://127.0.0.1">
4 </head>
5 <body>
6 <p>Test EventSource constructor functionality. Should print a series of PASS messages followed by DONE.</p>
7 <div id="result"></div>
8 <script>
9 function log(msg) {
10 document.getElementById("result").innerHTML += msg + "<br>";
13 if (window.testRunner) {
14 testRunner.dumpAsText();
15 testRunner.waitUntilDone();
18 try {
19 new EventSource();
20 log("FAIL: no exception when trying to construct an EventSource without argument");
21 } catch (e) {
22 log("PASS: missing argument to EventSource constructor resulted in an exception (" + e + ")");
25 try {
26 new EventSource("");
27 log("FAIL: no exception when passing an empty string to the EventSource constructor");
28 } catch (e) {
29 log("PASS: passing an empty string to the EventSource constructor resulted in an exception (" + e + ")");
32 try {
33 new EventSource("http://webserver:eighty/");
34 log("FAIL: no exception when passing an invalid URL to the EventSource constructor");
35 } catch (e) {
36 log("PASS: passing an invalid URL to the EventSource constructor resulted in an exception (" + e + ")");
39 try {
40 new EventSource("http://disallowed.example.com/");
41 log("FAIL: no exception when passing an URL blocked by Content Security Policy to the EventSource constructor");
42 } catch (e) {
43 log("PASS: passing a Content-Security-Policy-blocked URL to the EventSource constructor resulted in an exception (" + e + ")");
46 try {
47 var es = new EventSource("http://127.0.0.1/", {"withCredentials": false});
48 es.close();
49 if (!es.withCredentials) {
50 log("PASS: no exception when passing a second argument to the EventSource constructor");
51 log("DONE");
52 } else
53 log("FAIL: the 'withCredentials' property is unexpectedly true");
54 } catch (e) {
55 log("FAIL: passing a second argument to the EventSource constructor resulted in an exception (" + e + ")");
58 if (window.testRunner)
59 testRunner.notifyDone();
61 </script>
62 </body>
63 </html>