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

Side by Side Diff: LayoutTests/fast/dom/custom/document-register-basic.html

Issue 99083002: WIP: Migrate generated bindings to new ExceptionState constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase. Created 7 years 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <div id="container"></div> 7 <div id="container"></div>
8 <script> 8 <script>
9 description('Testing document.register() basic behaviors.'); 9 description('Testing document.register() basic behaviors.');
10 10
11 if (window.testRunner) 11 if (window.testRunner)
12 testRunner.dumpAsText(); 12 testRunner.dumpAsText();
13 13
14 function createRegisterParameters() 14 function createRegisterParameters()
15 { 15 {
16 return { 16 return {
17 prototype: Object.create(HTMLElement.prototype, { thisIsPrototype: { val ue: true } }) 17 prototype: Object.create(HTMLElement.prototype, { thisIsPrototype: { val ue: true } })
18 }; 18 };
19 } 19 }
20 20
21 var fooConstructor = document.register('x-foo', createRegisterParameters()); 21 var fooConstructor = document.register('x-foo', createRegisterParameters());
22 shouldBe('typeof fooConstructor', '"function"'); 22 shouldBe('typeof fooConstructor', '"function"');
23 shouldBe('fooConstructor.prototype.__proto__', 'HTMLElement.prototype'); 23 shouldBe('fooConstructor.prototype.__proto__', 'HTMLElement.prototype');
24 shouldBeTrue('fooConstructor.prototype.thisIsPrototype'); 24 shouldBeTrue('fooConstructor.prototype.thisIsPrototype');
25 25
26 // Bad prototype: prototype is already a built-in interface prototype object 26 // Bad prototype: prototype is already a built-in interface prototype object
27 shouldThrow('document.register("x-bad-a", HTMLElement)', '"NotSupportedError: Fa iled to call \'register\' on \'Document\' for type \'x-bad-a\': prototype is alr eady in-use as an interface prototype object."'); 27 shouldThrow('document.register("x-bad-a", HTMLElement)', '"NotSupportedError: Fa iled to execute \'register\' on \'Document\': Registration failed for type \'x-b ad-a\'. The prototype is already in-use as an interface prototype object."');
28 // Bad prototype: prototype is already a Custom Element interface prototype obje ct 28 // Bad prototype: prototype is already a Custom Element interface prototype obje ct
29 shouldThrow('document.register("x-bad-b", fooConstructor)', '"NotSupportedError: Failed to call \'register\' on \'Document\' for type \'x-bad-b\': prototype is already in-use as an interface prototype object."'); 29 shouldThrow('document.register("x-bad-b", fooConstructor)', '"NotSupportedError: Failed to execute \'register\' on \'Document\': Registration failed for type \' x-bad-b\'. The prototype is already in-use as an interface prototype object."');
30 // Bad prototype: 'constructor' is not configurable 30 // Bad prototype: 'constructor' is not configurable
31 var proto = Object.create(HTMLElement.prototype, { 31 var proto = Object.create(HTMLElement.prototype, {
32 constructor: {configurable: false, writable: true} 32 constructor: {configurable: false, writable: true}
33 }); 33 });
34 shouldThrow('document.register("x-bad-c", { prototype: proto })', '"NotSupported Error: Failed to call \'register\' on \'Document\' for type \'x-bad-c\': prototy pe constructor property is not configurable."'); 34 shouldThrow('document.register("x-bad-c", { prototype: proto })', '"NotSupported Error: Failed to execute \'register\' on \'Document\': Registration failed for t ype \'x-bad-c\'. Prototype constructor property is not configurable."');
35 // Call as function 35 // Call as function
36 shouldThrow('fooConstructor()', '"TypeError: DOM object constructor cannot be ca lled as a function."') 36 shouldThrow('fooConstructor()', '"TypeError: DOM object constructor cannot be ca lled as a function."')
37 37
38 // Constructor initiated instantiation 38 // Constructor initiated instantiation
39 var createdFoo = new fooConstructor(); 39 var createdFoo = new fooConstructor();
40 40
41 // JS built-in properties 41 // JS built-in properties
42 shouldBe('createdFoo.__proto__', 'fooConstructor.prototype'); 42 shouldBe('createdFoo.__proto__', 'fooConstructor.prototype');
43 shouldBe('createdFoo.constructor', 'fooConstructor'); 43 shouldBe('createdFoo.constructor', 'fooConstructor');
44 44
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 shouldBe('container.lastChild.tagName', '"X-BAR"'); 94 shouldBe('container.lastChild.tagName', '"X-BAR"');
95 95
96 // Constructors shouldn't interfere with each other 96 // Constructors shouldn't interfere with each other
97 shouldBe('(new fooConstructor).tagName', '"X-FOO"'); 97 shouldBe('(new fooConstructor).tagName', '"X-FOO"');
98 shouldBe('(new barConstructor).tagName', '"X-BAR"'); 98 shouldBe('(new barConstructor).tagName', '"X-BAR"');
99 shouldBe('(new bazConstructor).tagName', '"X-BAZ"'); 99 shouldBe('(new bazConstructor).tagName', '"X-BAZ"');
100 100
101 </script> 101 </script>
102 </body> 102 </body>
103 </html> 103 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698