imcplugin demo: Extend to support stat() call
[nativeclient.git] / tests / srpc_hw / srpc_hw.html
blob7c4fd5334ba2af151d942a535a50cc4d35aed164
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>SRPC Simple Plug-in</title>
5 </head>
6 <body onload="nacllib.waitForModulesAndRunTests();"
7 onunload="nacllib.cleanUp();" >
8 <script type="text/javascript">
9 //<![CDATA[
10 function fortytwo() {
11 try {
12 alert(document.getElementById('pluginobj').fortytwo());
13 } catch(e) {
14 alert(e);
18 function helloworld() {
19 try {
20 alert(document.getElementById('pluginobj').helloworld());
21 } catch(e) {
22 alert(e);
25 //]]>
26 </script>
28 <h1>Native Client SRPC Simple Plug-in</h1>
29 <p>
30 <button onclick='fortytwo()'>Call fortytwo()</button>
31 <button onclick='helloworld()'>Call helloworld()</button>
33 <embed name="nacl_module"
34 id="pluginobj"
35 width=0 height=0
36 src="srpc_hw.nexe"
37 type="application/x-nacl-srpc" />
38 </p>
40 <p>If the plug-in is working correctly, a click on the "Call fortytwo" button
41 should open a popup dialog containing <b>42</b> as value.</p>
43 <p> Clicking on the "Call helloworld" button
44 should open a popup dialog containing <b>hello, world</b> as value.</p>
46 <h2>Status</h2>
47 <div id=status>NO-STATUS</div>
49 <script type="text/javascript" src="nacl_js_lib.js"></script>
50 <script type="text/javascript">
51 //<![CDATA[
52 var nacllib = new NaclLib(document.getElementsByName("nacl_module"),
53 document.getElementById("status"),
54 50);
56 nacllib.test = function() {
57 var plugin = document.getElementById("pluginobj");
58 if ('42' != plugin.fortytwo()) {
59 return "expected 42";
62 if ('hello, world.' != plugin.helloworld()) {
63 return "expected 'hello, world.'";
66 return "";
68 //]]>
69 </script>
71 </body>
72 </html>