OLD | NEW |
1 <!-- | 1 <!-- |
2 Copyright 2011 The Native Client Authors. All rights reserved. | 2 Copyright 2011 The Native Client Authors. All rights reserved. |
3 Use of this source code is governed by a BSD-style license that can | 3 Use of this source code is governed by a BSD-style license that can |
4 be found in the LICENSE file. | 4 be found in the LICENSE file. |
5 --> | 5 --> |
6 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | 6 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
7 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | 7 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
8 <html> | 8 <html> |
9 <head> | 9 <head> |
10 <meta http-equiv="Pragma" content="no-cache" /> | 10 <meta http-equiv="Pragma" content="no-cache" /> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 this.removeEventListener('message', arguments.callee, false); | 43 this.removeEventListener('message', arguments.callee, false); |
44 status.assertEqual(message_event.data, | 44 status.assertEqual(message_event.data, |
45 'EnumerateNames: in_out_nbytes 4\nEnumerateNames: in_ou
t_nbytes 8\nEnumerateNames: in_out_nbytes 16\nEnumerateNames: in_out_nbytes 32\n
EnumerateNames: in_out_nbytes 47\nnbytes = 47\nKernelService\nManifestNameServic
e\nSecureRandom\n'); | 45 'EnumerateNames: in_out_nbytes 4\nEnumerateNames: in_ou
t_nbytes 8\nEnumerateNames: in_out_nbytes 16\nEnumerateNames: in_out_nbytes 32\n
EnumerateNames: in_out_nbytes 47\nnbytes = 47\nKernelService\nManifestNameServic
e\nSecureRandom\n'); |
46 status.pass(); | 46 status.pass(); |
47 }, false); | 47 }, false); |
48 plugin.postMessage('name_dump'); | 48 plugin.postMessage('name_dump'); |
49 }); | 49 }); |
50 tester.addAsyncTest('Test_02_ManifestList', function(status) { | 50 tester.addAsyncTest('Test_02_ManifestList', function(status) { |
51 plugin.addEventListener('message', function(message_event) { | 51 plugin.addEventListener('message', function(message_event) { |
52 this.removeEventListener('message', arguments.callee, false); | 52 this.removeEventListener('message', arguments.callee, false); |
53 status.assertEqual(message_event.data, | 53 status.assert( |
54 'Manifest Contents:\nnmf says hello world\ntest_file\n'
); | 54 message_event.data.indexOf('Manifest Contents:\n') != -1, |
| 55 '"Manifest Contents:" not found in "' + message_event.data + '"') |
| 56 status.assert( |
| 57 message_event.data.indexOf('nmf says hello world\n') != -1, |
| 58 '"nmf says hello world" not found in "' + message_event.data + '"') |
| 59 status.assert( |
| 60 message_event.data.indexOf('test_file\n') != -1, |
| 61 '"test_file" not found in "' + message_event.data + '"') |
55 status.pass(); | 62 status.pass(); |
56 }, false); | 63 }, false); |
57 plugin.postMessage('manifest_list'); | 64 plugin.postMessage('manifest_list'); |
58 }); | 65 }); |
59 tester.addAsyncTest('Test_03_ManifestOpen', function(status) { | 66 tester.addAsyncTest('Test_03_ManifestOpen', function(status) { |
60 plugin.addEventListener('message', function(message_event) { | 67 plugin.addEventListener('message', function(message_event) { |
61 this.removeEventListener('message', arguments.callee, false); | 68 this.removeEventListener('message', arguments.callee, false); |
62 var golden = 'File Contents:\n// There should not be CRs in here, just LF
termination!\n{\n "program": {\n "x86-32": {"url": "pm_manifest_file_test_x8
6-32.nexe"},\n "x86-64": {"url": "pm_manifest_file_test_x86-64.nexe"},\n "
arm": {"url": "pm_manifest_file_test_arm.nexe"}\n },\n "files": {\n "nmf
says hello world": {\n "x86-32": {"url": "pm_manifest_file_test_x86-32.nex
e"},\n "x86-64": {"url": "pm_manifest_file_test_x86-64.nexe"},\n "arm"
: {"url": "pm_manifest_file_test_arm.nexe"}\n },\n "test_file": {\n
"portable": {"url": "pm_manifest_file.nmf"}\n }\n }\n}\n'; | 69 var golden = 'File Contents:\nTest File Content'; |
63 status.log('expecting golden: ' + golden); | 70 status.log('expecting golden: ' + golden); |
64 status.log('golden.length: ' + golden.length); | 71 status.log('golden.length: ' + golden.length); |
65 status.log('message_event.data.length: ' + message_event.data.length); | 72 status.log('message_event.data.length: ' + message_event.data.length); |
66 var min_length = Math.min(message_event.data.length, golden.length); | 73 var min_length = Math.min(message_event.data.length, golden.length); |
67 status.log('min_length = ' + min_length); | 74 status.log('min_length = ' + min_length); |
68 var i = 0; | 75 var i = 0; |
69 for (i = 0; i < min_length; i++) { | 76 for (i = 0; i < min_length; i++) { |
70 var mchar = message_event.data.charAt(i); | 77 var mchar = message_event.data.charAt(i); |
71 var gchar = golden.charAt(i); | 78 var gchar = golden.charAt(i); |
72 if (mchar != gchar) { | 79 if (mchar != gchar) { |
73 status.log('char at ' + i + ' differ: ' + mchar + ' != ' + gchar); | 80 status.log('char at ' + i + ' differ: ' + mchar + ' != ' + gchar); |
74 status.log('charcodes: ' + mchar.charCodeAt(0) + ' != ' + gchar.charCo
deAt(0)); | 81 status.log('charcodes: ' + mchar.charCodeAt(0) + ' != ' + gchar.charCo
deAt(0)); |
75 } | 82 } |
76 } | 83 } |
77 status.assertEqual(message_event.data, golden); | 84 status.assertEqual(message_event.data, golden); |
78 status.pass(); | 85 status.pass(); |
79 }, false); | 86 }, false); |
80 plugin.postMessage('manifest_open'); | 87 plugin.postMessage('manifest_open'); |
81 }); | 88 }); |
82 } | 89 } |
83 | 90 |
84 var tester = new Tester(); | 91 var tester = new Tester(); |
85 setupTests(tester, $('naclModule')); | 92 setupTests(tester, $('naclModule')); |
86 tester.waitFor($('naclModule')); | 93 tester.waitFor($('naclModule')); |
87 tester.run(); | 94 tester.run(); |
88 //]]> | 95 //]]> |
89 </script> | 96 </script> |
90 </body> | 97 </body> |
91 </html> | 98 </html> |
OLD | NEW |