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

Side by Side Diff: ppapi/tests/test_case.html

Issue 65793002: PPAPI/NaCl: Make tests enforce dispatchEvent check (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 7 years, 1 month 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html><head> 1 <html><head>
2 <meta http-equiv="Pragma" content="no-cache" /> 2 <meta http-equiv="Pragma" content="no-cache" />
3 <meta http-equiv="Expires" content="-1" /> 3 <meta http-equiv="Expires" content="-1" />
4 <link rel="stylesheet" href="test_page.css"> 4 <link rel="stylesheet" href="test_page.css">
5 <script> 5 <script>
6 function AdjustHeight(frameWin) { 6 function AdjustHeight(frameWin) {
7 var div = frameWin.document.getElementsByTagName("div")[0]; 7 var div = frameWin.document.getElementsByTagName("div")[0];
8 var height = frameWin.getComputedStyle(div).height; 8 var height = frameWin.getComputedStyle(div).height;
9 frameWin.frameElement.style.height = height; 9 frameWin.frameElement.style.height = height;
10 } 10 }
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 // domAutomationController so that it knows we're still working. 290 // domAutomationController so that it knows we're still working.
291 obj.addEventListener("loadstart", sendProgress, true); 291 obj.addEventListener("loadstart", sendProgress, true);
292 obj.addEventListener("progress", sendProgress, true); 292 obj.addEventListener("progress", sendProgress, true);
293 obj.addEventListener("load", sendProgress, true); 293 obj.addEventListener("load", sendProgress, true);
294 obj.addEventListener("loadend", sendProgress, true); 294 obj.addEventListener("loadend", sendProgress, true);
295 295
296 // Register a bad dispatchEvent to make sure it isn't used. See 'EVIL' note 296 // Register a bad dispatchEvent to make sure it isn't used. See 'EVIL' note
297 // below. 297 // below.
298 var original = obj.dispatchEvent; 298 var original = obj.dispatchEvent;
299 obj.dispatchEvent = function() { 299 obj.dispatchEvent = function() {
300 // TODO(dmichael): NaCl triggers this; take out the special case for NaCl 300 InternalError("Bad dispatchEvent called!");
301 // when crbug.com/109775 is fixed.
302 if (mode.indexOf("nacl") !== 0)
303 InternalError("Bad dispatchEvent called!");
304
305 // Pass it on anyways, we need the event to detect load progress and
306 // errors.
307 return original.apply(obj, arguments);
308 } 301 }
309 container.appendChild(obj); 302 container.appendChild(obj);
310 } 303 }
311 } 304 }
312 305
313 // EVIL Note: 306 // EVIL Note:
314 // This part of the script does some nefarious things to make sure that it 307 // This part of the script does some nefarious things to make sure that it
315 // doesn't affect the behavior of PostMessage (on which all the tests rely). In 308 // doesn't affect the behavior of PostMessage (on which all the tests rely). In
316 // particular, we replace document.createEvent, MessageEvent.initMessageEvent, 309 // particular, we replace document.createEvent, MessageEvent.initMessageEvent,
317 // and the MessageEvent constructor. Previous versions of the PostMessage 310 // and the MessageEvent constructor. Previously, the NaCl integration
318 // implementation made use of these and would fail (http://crbug.com/82604). 311 // implementation made use of these and would fail (http://crbug.com/82604
319 // The NaCl plugin uses dispatchEvent for progress events, hence we are careful 312 // and http://crbug.com/109775).
320 // to make that still pass for NaCl (see above, and see crbug.com/109775).
321 document.createEvent = function() { 313 document.createEvent = function() {
322 InternalError("Bad document.createEvent called!"); 314 InternalError("Bad document.createEvent called!");
323 } 315 }
324 function MessageEvent() { 316 function MessageEvent() {
325 InternalError("Bad MessageEvent constructor called!"); 317 InternalError("Bad MessageEvent constructor called!");
326 } 318 }
327 MessageEvent.prototype.initMessageEvent = function() { 319 MessageEvent.prototype.initMessageEvent = function() {
328 InternalError("Bad MessageEvent.initMessageEvent called!"); 320 InternalError("Bad MessageEvent.initMessageEvent called!");
329 } 321 }
330 322
331 </script> 323 </script>
332 </head><body> 324 </head><body>
333 <div> 325 <div>
334 <div id="container"></div> 326 <div id="container"></div>
335 <div id="console"><span class="load_msg">loading...</span></div> 327 <div id="console"><span class="load_msg">loading...</span></div>
336 </div> 328 </div>
337 </body></html> 329 </body></html>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698