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