| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>SRPC Simple Plug-in</title> | 4 <title>SRPC Simple Plug-in</title> |
| 5 <META HTTP-EQUIV="Pragma" CONTENT="no-cache" /> | 5 <META HTTP-EQUIV="Pragma" CONTENT="no-cache" /> |
| 6 <META HTTP-EQUIV="Expires" CONTENT="-1" /> | 6 <META HTTP-EQUIV="Expires" CONTENT="-1" /> |
| 7 </head> | 7 </head> |
| 8 <body onload="nacllib.waitForModulesAndRunTests();" | 8 <body onload="nacllib.waitForModulesAndRunTests();" |
| 9 onunload="nacllib.cleanUp();" > | 9 onunload="nacllib.cleanUp();" > |
| 10 <script type="text/javascript"> | 10 <script type="text/javascript"> |
| 11 //<![CDATA[ | 11 //<![CDATA[ |
| 12 function setStatus(message) { |
| 13 var status = document.getElementById("status"); |
| 14 status.firstChild.nodeValue = message; |
| 15 } |
| 16 |
| 12 function fortytwo() { | 17 function fortytwo() { |
| 13 var result = ""; | 18 var result = ""; |
| 14 try { | 19 try { |
| 15 result = document.getElementById('pluginobj').fortytwo(); | 20 result = document.getElementById("pluginobj").fortytwo(); |
| 16 } catch(e) { | 21 } catch(e) { |
| 17 result = "ERROR: " + e; | 22 result = "ERROR: " + e; |
| 18 } | 23 } |
| 19 alert("" + result); | 24 setStatus(result); |
| 20 } | 25 } |
| 21 | 26 |
| 22 function helloworld() { | 27 function helloworld() { |
| 23 var result = ""; | 28 var result = ""; |
| 24 try { | 29 try { |
| 25 result = document.getElementById('pluginobj').helloworld(); | 30 result = document.getElementById("pluginobj").helloworld(); |
| 26 } catch(e) { | 31 } catch(e) { |
| 27 result = "ERROR: " + e; | 32 result = "ERROR: " + e; |
| 28 } | 33 } |
| 29 alert("" + result); | 34 setStatus(result); |
| 30 } | 35 } |
| 31 //]]> | 36 //]]> |
| 32 </script> | 37 </script> |
| 33 | 38 |
| 34 <h1>Native Client SRPC Simple Plug-in</h1> | 39 <h1>Native Client SRPC Simple Plug-in</h1> |
| 35 <p> | 40 <p> |
| 36 <button onclick='fortytwo()'>Call fortytwo()</button> | 41 <button onclick="fortytwo()">Call fortytwo()</button> |
| 37 <button onclick='helloworld()'>Call helloworld()</button> | 42 <button onclick="helloworld()">Call helloworld()</button> |
| 38 | 43 |
| 39 <embed name="nacl_module" | 44 <embed name="nacl_module" |
| 40 id="pluginobj" | 45 id="pluginobj" |
| 41 width=0 height=0 | 46 width=0 height=0 |
| 42 src="srpc_hw.nexe" | 47 src="srpc_hw.nexe" |
| 43 type="application/x-nacl-srpc" /> | 48 type="application/x-nacl" /> |
| 44 </p> | 49 </p> |
| 45 | 50 |
| 46 <p>If the plug-in is working correctly, a click on the "Call fortytwo" button | 51 <p>If the plug-in is working correctly, a click on the "Call fortytwo" button |
| 47 should open a popup dialog containing <b>42</b> as value.</p> | 52 should open a popup dialog containing <b>42</b> as value.</p> |
| 48 | 53 |
| 49 <p> Clicking on the "Call helloworld" button | 54 <p> Clicking on the "Call helloworld" button |
| 50 should open a popup dialog containing <b>hello, world</b> as value.</p> | 55 should open a popup dialog containing <b>hello, world</b> as value.</p> |
| 51 | 56 |
| 52 <h2>Status</h2> | 57 <h2>Status</h2> |
| 53 <div id=status>NO-STATUS</div> | 58 <div id=status>NO-STATUS</div> |
| 54 | 59 |
| 55 <script type="text/javascript" src="nacl_js_lib.js"></script> | 60 <script type="text/javascript" src="nacl_js_lib.js"></script> |
| 56 <script type="text/javascript"> | 61 <script type="text/javascript"> |
| 57 //<![CDATA[ | 62 //<![CDATA[ |
| 58 var nacllib = new NaclLib("nacl_module", "status", 500); | 63 var nacllib = new NaclLib("nacl_module", "status", 500); |
| 59 | 64 |
| 60 nacllib.test = function() { | 65 nacllib.test = function() { |
| 61 var plugin = document.getElementById("pluginobj"); | 66 var plugin = document.getElementById("pluginobj"); |
| 62 if ('42' != plugin.fortytwo()) { | 67 if ('42' != plugin.fortytwo()) { |
| 63 return "expected 42"; | 68 return "expected 42"; |
| 64 } | 69 } |
| 65 | 70 |
| 66 if ('hello, world.' != plugin.helloworld()) { | 71 if ("hello, world." != plugin.helloworld()) { |
| 67 return "expected 'hello, world.'"; | 72 return "expected 'hello, world.'"; |
| 68 } | 73 } |
| 69 | 74 |
| 70 return ""; | 75 return ""; |
| 71 }; | 76 }; |
| 72 //]]> | 77 //]]> |
| 73 </script> | 78 </script> |
| 74 | 79 |
| 75 </body> | 80 </body> |
| 76 </html> | 81 </html> |
| OLD | NEW |