| OLD | NEW |
| (Empty) |
| 1 <!-- | |
| 2 Copyright 2014 The Chromium Authors. All rights reserved. | |
| 3 Use of this source code is governed by a BSD-style license that can | |
| 4 be found in the LICENSE file. | |
| 5 --> | |
| 6 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
| 7 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
| 8 <html> | |
| 9 <head> | |
| 10 <meta http-equiv="Pragma" content="no-cache" /> | |
| 11 <meta http-equiv="Expires" content="-1" /> | |
| 12 <script type="text/javascript" src="nacltest.js"></script> | |
| 13 <title>Native Client Post Message Manifest File Test</title> | |
| 14 </head> | |
| 15 | |
| 16 <body> | |
| 17 <h1>Native Client Post Message Manifest File Test</h1> | |
| 18 <script type="text/javascript"> | |
| 19 //<![CDATA[ | |
| 20 function createModule(id, src, type) { | |
| 21 return createNaClEmbed({ | |
| 22 id: id, | |
| 23 src: src, | |
| 24 width: 400, | |
| 25 height: 400, | |
| 26 type: type | |
| 27 }); | |
| 28 } | |
| 29 var mime = 'application/x-nacl'; | |
| 30 if (getTestArguments()['pnacl'] !== undefined) { | |
| 31 mime = 'application/x-pnacl'; | |
| 32 } | |
| 33 var embed = createModule('naclModule', 'pm_manifest_file.nmf', mime); | |
| 34 embed.basic_tests ='2'; | |
| 35 embed.stress_tests = '0'; | |
| 36 document.body.appendChild(embed); | |
| 37 | |
| 38 function setupTests(tester, plugin) { | |
| 39 tester.addAsyncTest('Test_00_Init', function(status) { | |
| 40 plugin.addEventListener('message', function(message_event) { | |
| 41 this.removeEventListener('message', arguments.callee, false); | |
| 42 status.assertEqual(message_event.data, | |
| 43 'NaClSrpcClientCtor succeeded\n'); | |
| 44 status.pass(); | |
| 45 }, false); | |
| 46 plugin.postMessage('init'); | |
| 47 }); | |
| 48 tester.addAsyncTest('Test_01_ManifestOpen', function(status) { | |
| 49 plugin.addEventListener('message', function(message_event) { | |
| 50 this.removeEventListener('message', arguments.callee, false); | |
| 51 var golden = 'File Contents:\nTest File Content'; | |
| 52 status.log('expecting golden: ' + golden); | |
| 53 status.log('golden.length: ' + golden.length); | |
| 54 status.log('message_event.data.length: ' + message_event.data.length); | |
| 55 var min_length = Math.min(message_event.data.length, golden.length); | |
| 56 status.log('min_length = ' + min_length); | |
| 57 var i = 0; | |
| 58 for (i = 0; i < min_length; i++) { | |
| 59 var mchar = message_event.data.charAt(i); | |
| 60 var gchar = golden.charAt(i); | |
| 61 if (mchar != gchar) { | |
| 62 status.log('char at ' + i + ' differ: ' + mchar + ' != ' + gchar); | |
| 63 status.log('charcodes: ' + mchar.charCodeAt(0) + ' != ' + gchar.charCo
deAt(0)); | |
| 64 } | |
| 65 } | |
| 66 status.assertEqual(message_event.data, golden); | |
| 67 status.pass(); | |
| 68 }, false); | |
| 69 plugin.postMessage('manifest_open'); | |
| 70 }); | |
| 71 } | |
| 72 | |
| 73 var tester = new Tester(); | |
| 74 setupTests(tester, $('naclModule')); | |
| 75 tester.waitFor($('naclModule')); | |
| 76 tester.run(); | |
| 77 //]]> | |
| 78 </script> | |
| 79 </body> | |
| 80 </html> | |
| OLD | NEW |