Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / constructors / security-policy-violation-event-constructor.html
blob10ffd7b2ada29b202630dc6b49c090e0b01a1c3b
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
9 description("This tests the constructor for the SecurityPolicyViolationEvent DOM class.");
11 var testObject = {nyannyan: 123};
12 var testDiv = document.createElement("div");
14 // No initializer is passed.
15 shouldBeFalse("new SecurityPolicyViolationEvent('eventType').bubbles");
16 shouldBeFalse("new SecurityPolicyViolationEvent('eventType').cancelable");
17 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').documentURI");
18 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').referrer");
19 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').blockedURI");
20 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').violatedDirective");
21 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').effectiveDirective");
22 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').originalPolicy");
23 shouldBeEmptyString("new SecurityPolicyViolationEvent('eventType').sourceFile");
24 shouldBe("new SecurityPolicyViolationEvent('eventType').lineNumber", "0");
25 shouldBe("new SecurityPolicyViolationEvent('eventType').columnNumber", "0");
26 shouldBe("new SecurityPolicyViolationEvent('eventType').statusCode", "0");
28 // bubbles is passed.
29 shouldBeFalse("new SecurityPolicyViolationEvent('eventType', { bubbles: false }).bubbles");
30 shouldBeTrue("new SecurityPolicyViolationEvent('eventType', { bubbles: true }).bubbles");
32 // cancelable is passed.
33 shouldBeFalse("new SecurityPolicyViolationEvent('eventType', { cancelable: false }).cancelable");
34 shouldBeTrue("new SecurityPolicyViolationEvent('eventType', { cancelable: true }).cancelable");
36 // String members are passed.
37 ["documentURI", "referrer", "blockedURI", "violatedDirective", "effectiveDirective", "originalPolicy", "sourceFile"].forEach(function(member) {
38 shouldBeEqualToString("new SecurityPolicyViolationEvent('eventType', { " + member + ": 'foo' })." + member, "foo");
39 });
41 // Number members are passed.
42 ["lineNumber", "columnNumber", "statusCode"].forEach(function(member) {
43 shouldBe("new SecurityPolicyViolationEvent('eventType', { " + member + ": 42 })." + member, "42");
44 });
45 </script>
46 </body>
47 </html>