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

Side by Side Diff: LayoutTests/fast/dom/custom/registration-context-isolation.html

Issue 117313008: Update Custom Elements API to new names. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update for forgotten tests. 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 | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../../resources/testharness.js"></script> 2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script> 3 <script src="../../../resources/testharnessreport.js"></script>
4 <script src="test-harness-utils.js"></script> 4 <script src="test-harness-utils.js"></script>
5 <body> 5 <body>
6 <script> 6 <script>
7 function TestRegistrationContextIsolation(windowA, documentA, 7 function TestRegistrationContextIsolation(windowA, documentA,
8 windowB, documentB) { 8 windowB, documentB) {
9 this.windowA = windowA; 9 this.windowA = windowA;
10 this.documentA = documentA; 10 this.documentA = documentA;
(...skipping 12 matching lines...) Expand all
23 testRegisterInAInstantiateInB_shouldNotActivateDefinition = function () { 23 testRegisterInAInstantiateInB_shouldNotActivateDefinition = function () {
24 24
25 // Test that element x-u registered in document A is not activated when 25 // Test that element x-u registered in document A is not activated when
26 // x-u is parsed in document B 26 // x-u is parsed in document B
27 27
28 var protoU = Object.create(this.windowA.HTMLElement.prototype); 28 var protoU = Object.create(this.windowA.HTMLElement.prototype);
29 protoU.createdCallback = function () { 29 protoU.createdCallback = function () {
30 assert_unreached('creating an x-u in a different context should ' + 30 assert_unreached('creating an x-u in a different context should ' +
31 'not invoke a callback in this context'); 31 'not invoke a callback in this context');
32 }; 32 };
33 this.documentA.register('x-u', {prototype: protoU}); 33 this.documentA.registerElement('x-u', {prototype: protoU});
34 34
35 var container = this.documentB.createElement('div'); 35 var container = this.documentB.createElement('div');
36 container.innerHTML = '<x-u></x-u>'; 36 container.innerHTML = '<x-u></x-u>';
37 // if protoU.createdCallback is not invoked; this passed 37 // if protoU.createdCallback is not invoked; this passed
38 }; 38 };
39 39
40 TestRegistrationContextIsolation.prototype. 40 TestRegistrationContextIsolation.prototype.
41 testRegisterSameName_definitionsShouldNotConflict = function () { 41 testRegisterSameName_definitionsShouldNotConflict = function () {
42 // Test that registering two different custom elements with the same 42 // Test that registering two different custom elements with the same
43 // tag name in each document doesn't lead to any crossed wires 43 // tag name in each document doesn't lead to any crossed wires
44 44
45 var invocations = []; 45 var invocations = [];
46 function created(name) { 46 function created(name) {
47 return function () { 47 return function () {
48 invocations.push('created ' + name + ' in ' + this.dataset.doc); 48 invocations.push('created ' + name + ' in ' + this.dataset.doc);
49 }; 49 };
50 } 50 }
51 51
52 var protoAV = Object.create(this.windowA.HTMLElement.prototype); 52 var protoAV = Object.create(this.windowA.HTMLElement.prototype);
53 protoAV.createdCallback = created('document A\'s element V'); 53 protoAV.createdCallback = created('document A\'s element V');
54 this.documentA.register('x-v', {prototype: protoAV}); 54 this.documentA.registerElement('x-v', {prototype: protoAV});
55 55
56 var protoBV = Object.create(this.windowB.HTMLElement.prototype); 56 var protoBV = Object.create(this.windowB.HTMLElement.prototype);
57 protoBV.createdCallback = created('document B\'s element V'); 57 protoBV.createdCallback = created('document B\'s element V');
58 this.documentB.register('x-v', {prototype: protoBV}); 58 this.documentB.registerElement('x-v', {prototype: protoBV});
59 59
60 var containerB = this.documentB.createElement('div'); 60 var containerB = this.documentB.createElement('div');
61 containerB.innerHTML = '<x-v data-doc="document B"></x-v>'; 61 containerB.innerHTML = '<x-v data-doc="document B"></x-v>';
62 var containerA = this.documentA.createElement('div'); 62 var containerA = this.documentA.createElement('div');
63 containerA.innerHTML = '<x-v data-doc="document A"></x-v>'; 63 containerA.innerHTML = '<x-v data-doc="document A"></x-v>';
64 64
65 assert_array_equals( 65 assert_array_equals(
66 invocations, 66 invocations,
67 ['created document B\'s element V in document B', 67 ['created document B\'s element V in document B',
68 'created document A\'s element V in document A'], 68 'created document A\'s element V in document A'],
(...skipping 12 matching lines...) Expand all
81 'registered in document B'); 81 'registered in document B');
82 }; 82 };
83 83
84 TestRegistrationContextIsolation.prototype. 84 TestRegistrationContextIsolation.prototype.
85 testRegisterSameName_lazyWrappingShouldNotSharePrototypes = function () { 85 testRegisterSameName_lazyWrappingShouldNotSharePrototypes = function () {
86 // Registering two different custom elements with the same tag 86 // Registering two different custom elements with the same tag
87 // name should not mix up prototypes. These do not have any 87 // name should not mix up prototypes. These do not have any
88 // callbacks, to try to tickle lazy wrapping. 88 // callbacks, to try to tickle lazy wrapping.
89 89
90 var protoAW = Object.create(this.windowA.HTMLElement.prototype); 90 var protoAW = Object.create(this.windowA.HTMLElement.prototype);
91 this.documentA.register('x-w', {prototype: protoAW}); 91 this.documentA.registerElement('x-w', {prototype: protoAW});
92 92
93 var protoBW = Object.create(this.windowB.HTMLElement.prototype); 93 var protoBW = Object.create(this.windowB.HTMLElement.prototype);
94 protoBW.createdCallback = function () {}; 94 protoBW.createdCallback = function () {};
95 this.documentB.register('x-w', {prototype: protoBW}); 95 this.documentB.registerElement('x-w', {prototype: protoBW});
96 96
97 var elementA = this.documentA.createElement('x-w'); 97 var elementA = this.documentA.createElement('x-w');
98 var elementB = this.documentB.createElement('x-w'); 98 var elementB = this.documentB.createElement('x-w');
99 99
100 assert_equals( 100 assert_equals(
101 Object.getPrototypeOf(elementB), protoBW, 101 Object.getPrototypeOf(elementB), protoBW,
102 'the prototype of element W in document B should be the prototype ' + 102 'the prototype of element W in document B should be the prototype ' +
103 'registered in document B'); 103 'registered in document B');
104 104
105 assert_equals( 105 assert_equals(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 frame.contentWindow, documentA, 142 frame.contentWindow, documentA,
143 frame.contentWindow, documentB); 143 frame.contentWindow, documentB);
144 tester.testRegistrationContextIsNotShared(); 144 tester.testRegistrationContextIsNotShared();
145 frame.remove(); 145 frame.remove();
146 t.done(); 146 t.done();
147 })); 147 }));
148 148
149 })(); 149 })();
150 150
151 </script> 151 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698