| OLD | NEW |
| (Empty) | |
| 1 <!-- |
| 2 Copyright 2011 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 I/O Redirection to Post Message Test</title> |
| 14 </head> |
| 15 |
| 16 <body> |
| 17 <h1>Native Client I/O Redirection to Post Message Test</h1> |
| 18 <div> |
| 19 <embed id="naclModule" |
| 20 name="naclModule" |
| 21 width=400 height=400 |
| 22 src="pm_redir_test.nmf" |
| 23 basic_tests="2" |
| 24 stress_tests="0" |
| 25 style="background-color:gray" |
| 26 type="application/x-nacl" /> |
| 27 </div> |
| 28 |
| 29 <script type="text/javascript"> |
| 30 //<![CDATA[ |
| 31 function setupTests(tester, plugin) { |
| 32 tester.addAsyncTest('Test_output', function(status) { |
| 33 plugin.addEventListener('message', function(message_event) { |
| 34 var prefix = 'DEBUG_POSTMESSAGE:'; |
| 35 if (message_event.data.indexOf(prefix) == 0) { |
| 36 var expected_output = 'BOGUS STRING'; |
| 37 if (args.stream == 'stdout' && args.thread == 'fg') { |
| 38 expected_output = |
| 39 ('In the year 1878 I took my degree of Doctor of Medicine...\n'); |
| 40 } else if (args.stream == 'stderr' && args.thread == 'fg') { |
| 41 expected_output = |
| 42 ('A merry little surge of electricity piped by automatic' |
| 43 +' alarm...\n'); |
| 44 } else if (args.stream == 'stdout' && args.thread == 'bg') { |
| 45 expected_output = |
| 46 ('Squire Trelawney, Dr. Livesey, and the rest of these' |
| 47 +' gentlemen...\n'); |
| 48 } else if (args.stream == 'stderr' && args.thread == 'bg') { |
| 49 expected_output = |
| 50 ('It is a truth universally acknowledged, that a single man' |
| 51 +' in possession...\n'); |
| 52 } |
| 53 var msg_string = message_event.data.substring(prefix.length); |
| 54 console.log('expected output ' + expected_output); |
| 55 |
| 56 console.log(msg_string); |
| 57 if (msg_string == expected_output) { |
| 58 console.log('pass!'); |
| 59 this.removeEventListener('message', arguments.callee, true); |
| 60 status.pass(); |
| 61 } else { |
| 62 // comment this out if test framework args=['--debug'] is |
| 63 // used, since that causes lots of SRPC and PPAPI_PROXY |
| 64 // debug output to be generated on stdout/err, and the test |
| 65 // has no debugging output |
| 66 // |
| 67 status.fail('unexpected output: ' + msg_string); |
| 68 } |
| 69 } |
| 70 }, true); |
| 71 message=('stream=' + args.stream + ',thread=' + args.thread + |
| 72 ',delay_us=' + args.delay_us); |
| 73 console.log(message); |
| 74 plugin.postMessage(message); |
| 75 }); |
| 76 } |
| 77 |
| 78 var tester = new Tester(); |
| 79 var args = getTestArguments({ |
| 80 'stream' : 'THIS TEST CANNOT RUN STANDALONE -- run using scons instead', |
| 81 'thread' : 'THIS TEST CANNOT RUN STANDALONE -- run using scons instead', |
| 82 }); |
| 83 setupTests(tester, $('naclModule')); |
| 84 tester.waitFor($('naclModule')); |
| 85 tester.run(); |
| 86 //]]> |
| 87 </script> |
| 88 </body> |
| 89 </html> |
| OLD | NEW |