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

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

Issue 23903029: [HTML Imports] Employ load/error events to stabilize polling-based tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: For landing Created 7 years, 3 months 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/htmlimports/import-script-block-crossorigin-dynamic.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 TestRegistrationContextSharing(window, documentA, documentB) { 7 function TestRegistrationContextSharing(window, documentA, documentB) {
8 this.window = window; 8 this.window = window;
9 this.documentA = documentA; 9 this.documentA = documentA;
10 this.documentB = documentB; 10 this.documentB = documentB;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 var documentA; 139 var documentA;
140 140
141 t.step(function () { 141 t.step(function () {
142 // FIXME: When inserting a <link> within a frame triggers an import, 142 // FIXME: When inserting a <link> within a frame triggers an import,
143 // run this part of the test in isolation within a frame. 143 // run this part of the test in isolation within a frame.
144 documentA = document; 144 documentA = document;
145 145
146 link = documentA.createElement('link'); 146 link = documentA.createElement('link');
147 link.rel = 'import'; 147 link.rel = 'import';
148 link.href = 'resources/empty-document.html'; 148 link.href = 'resources/empty-document.html';
149 documentA.head.appendChild(link); 149 link.onload = t.step_func(function () {
150
151 // FIXME: When imports raise the 'load' event, use that instead of
152 // polling.
153 waitForLinkToLoad();
154 });
155
156 function waitForLinkToLoad() {
157 if (!link.import) {
158 setTimeout(waitForLinkToLoad, 100);
159 return;
160 }
161
162 t.step(function () {
163 var documentB = link.import; 150 var documentB = link.import;
164 var tester = new TestRegistrationContextSharing(window, 151 var tester = new TestRegistrationContextSharing(window,
165 documentA, documentB); 152 documentA, documentB);
166 tester.testRegistrationContextIsShared(); 153 tester.testRegistrationContextIsShared();
167 t.done(); 154 t.done();
168 }); 155 });
169 } 156
157 documentA.head.appendChild(link);
158 });
170 159
171 })(); 160 })();
172 161
173 </script> 162 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/htmlimports/import-script-block-crossorigin-dynamic.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698