OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <title>NPAPI 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 | |
11 <script type="text/javascript"> | |
12 //<![CDATA[ | |
13 function fortytwo() { | |
14 try { | |
15 alert(document.getElementById('pluginobj').fortytwo()); | |
16 } catch(e) { | |
17 alert(e); | |
18 } | |
19 } | |
20 | |
21 function helloworld() { | |
22 try { | |
23 alert(document.getElementById('pluginobj').helloworld()); | |
24 } catch(e) { | |
25 alert(e); | |
26 } | |
27 } | |
28 //]]> | |
29 </script> | |
30 | |
31 <h1>Native Client NPAPI Simple Plug-in</h1> | |
32 <p> | |
33 <button onclick="fortytwo()">Call fortytwo()</button> | |
34 <button onclick="helloworld()">Call helloworld()</button> | |
35 | |
36 <embed name="nacl_module" | |
37 id="pluginobj" | |
38 width=0 | |
39 height=0 | |
40 src="npapi_hw.nexe" | |
41 type="application/x-nacl" /> | |
42 </p> | |
43 | |
44 <p>If the plug-in is working correctly, a click on the "Call fortytwo" button | |
45 should open a popup dialog containing <b>42</b> as value.</p> | |
46 | |
47 <p> Clicking on the "Call helloworld" button | |
48 should open a popup dialog containing <b>hello, world</b> as value.</p> | |
49 | |
50 <h2>Status</h2> | |
51 <div id=status>NO-STATUS</div> | |
52 | |
53 <script type="text/javascript" src="nacl_js_lib.js"></script> | |
54 <script type="text/javascript"> | |
55 //<![CDATA[ | |
56 var nacllib = new NaclLib("nacl_module", "status", 500); | |
57 | |
58 // we use a custom detector for whether a module is ready or not | |
59 nacllib.numModulesReady = function(modules) { | |
60 var count = 0; | |
61 for (var i = 0; i < modules.length; i++) { | |
62 try { | |
63 var foo = modules[i].fortytwo(); | |
64 count += 1; | |
65 } catch(e) { | |
66 // do nothing | |
67 } | |
68 } | |
69 return count; | |
70 }; | |
71 | |
72 // we use a custom detector for whether a module is ready or not | |
73 nacllib.areTherePluginProblems = function(modules) { return 0; }; | |
74 | |
75 | |
76 nacllib.test = function() { | |
77 var plugin = document.getElementById("pluginobj"); | |
78 if ('42' != plugin.fortytwo()) { | |
79 return "expected 42"; | |
80 } | |
81 | |
82 if ('hello, world.' != plugin.helloworld()) { | |
83 return "expected 'hello, world.'"; | |
84 } | |
85 | |
86 document.cookie = 'status=OK'; | |
87 | |
88 return ""; | |
89 }; | |
90 | |
91 //]]> | |
92 </script> | |
93 | |
94 </body> | |
95 </html> | |
OLD | NEW |