Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / webexposed / resources / global-constructors-attributes.js
blob7717c658ca1804f445179f416848a83cafd91d7a
1 description("Test to ensure that global constructors have the right attributes");
3 function descriptorShouldBe(object, property, expected) {
4     var test = "Object.getOwnPropertyDescriptor(" + object + ", " + property + ")";
5     if ("writable" in expected) {
6         shouldBe(test + ".value", "" + expected.value);
7         shouldBeFalse(test + ".hasOwnProperty('get')");
8         shouldBeFalse(test + ".hasOwnProperty('set')");
9     } else {
10         shouldBe(test + ".get", "" + expected.get);
11         shouldBe(test + ".set", "" + expected.set);
12         shouldBeFalse(test + ".hasOwnProperty('value')");
13         shouldBeFalse(test + ".hasOwnProperty('writable')");
14     }
15     shouldBe(test + ".enumerable", "" + expected.enumerable);
16     shouldBe(test + ".configurable", "" + expected.configurable);
19 var global = this;
21 descriptorShouldBe("global", "'CSSRuleList'", {writable: true, enumerable: false, configurable: true, value:"CSSRuleList"});
22 descriptorShouldBe("global", "'Document'", {writable: true, enumerable: false, configurable: true, value:"Document"});
23 descriptorShouldBe("global", "'Element'", {writable: true, enumerable: false, configurable: true, value:"Element"});
24 descriptorShouldBe("global", "'HTMLDivElement'", {writable: true, enumerable: false, configurable: true, value:"HTMLDivElement"});
25 descriptorShouldBe("global", "'ProgressEvent'", {writable: true, enumerable: false, configurable: true, value:"ProgressEvent"});
26 descriptorShouldBe("global", "'Selection'", {writable: true, enumerable: false, configurable: true, value:"Selection"});
27 descriptorShouldBe("global", "'XMLHttpRequest'", {writable: true, enumerable: false, configurable: true, value:"XMLHttpRequest"});