Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: tests/srpc_hw/srpc_hw.html

Issue 6452010: Remove the x-ppapi-nacl-srpc and x-nacl-srpc mime types in favor of the singl... (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/srpc/srpc_url_as_nacl_desc_ppapi.html ('k') | tests/srpc_hw/srpc_hw_fd.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 $(id) {
polina 2011/02/09 21:54:41 This helper is used only once. It would be nice to
13 return document.getElementById(id);
14 }
15
16 function setStatus(message) {
17 var status = $("status");
18 status.firstChild.nodeValue = message;
19 }
20
12 function fortytwo() { 21 function fortytwo() {
13 var result = ""; 22 var result = "";
14 try { 23 try {
15 result = document.getElementById('pluginobj').fortytwo(); 24 result = document.getElementById("pluginobj").fortytwo();
16 } catch(e) { 25 } catch(e) {
17 result = "ERROR: " + e; 26 result = "ERROR: " + e;
18 } 27 }
19 alert("" + result); 28 setStatus(result);
20 } 29 }
21 30
22 function helloworld() { 31 function helloworld() {
23 var result = ""; 32 var result = "";
24 try { 33 try {
25 result = document.getElementById('pluginobj').helloworld(); 34 result = document.getElementById("pluginobj").helloworld();
26 } catch(e) { 35 } catch(e) {
27 result = "ERROR: " + e; 36 result = "ERROR: " + e;
28 } 37 }
29 alert("" + result); 38 setStatus(result);
30 } 39 }
31 //]]> 40 //]]>
32 </script> 41 </script>
33 42
34 <h1>Native Client SRPC Simple Plug-in</h1> 43 <h1>Native Client SRPC Simple Plug-in</h1>
35 <p> 44 <p>
36 <button onclick='fortytwo()'>Call fortytwo()</button> 45 <button onclick="fortytwo()">Call fortytwo()</button>
37 <button onclick='helloworld()'>Call helloworld()</button> 46 <button onclick="helloworld()">Call helloworld()</button>
38 47
39 <embed name="nacl_module" 48 <embed name="nacl_module"
40 id="pluginobj" 49 id="pluginobj"
41 width=0 height=0 50 width=0 height=0
42 src="srpc_hw.nexe" 51 src="srpc_hw.nexe"
43 type="application/x-nacl-srpc" /> 52 type="application/x-nacl" />
44 </p> 53 </p>
45 54
46 <p>If the plug-in is working correctly, a click on the "Call fortytwo" button 55 <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> 56 should open a popup dialog containing <b>42</b> as value.</p>
48 57
49 <p> Clicking on the "Call helloworld" button 58 <p> Clicking on the "Call helloworld" button
50 should open a popup dialog containing <b>hello, world</b> as value.</p> 59 should open a popup dialog containing <b>hello, world</b> as value.</p>
51 60
52 <h2>Status</h2> 61 <h2>Status</h2>
53 <div id=status>NO-STATUS</div> 62 <div id=status>NO-STATUS</div>
54 63
55 <script type="text/javascript" src="nacl_js_lib.js"></script> 64 <script type="text/javascript" src="nacl_js_lib.js"></script>
56 <script type="text/javascript"> 65 <script type="text/javascript">
57 //<![CDATA[ 66 //<![CDATA[
58 var nacllib = new NaclLib("nacl_module", "status", 500); 67 var nacllib = new NaclLib("nacl_module", "status", 500);
59 68
60 nacllib.test = function() { 69 nacllib.test = function() {
61 var plugin = document.getElementById("pluginobj"); 70 var plugin = document.getElementById("pluginobj");
62 if ('42' != plugin.fortytwo()) { 71 if ('42' != plugin.fortytwo()) {
63 return "expected 42"; 72 return "expected 42";
64 } 73 }
65 74
66 if ('hello, world.' != plugin.helloworld()) { 75 if ("hello, world." != plugin.helloworld()) {
67 return "expected 'hello, world.'"; 76 return "expected 'hello, world.'";
68 } 77 }
69 78
70 return ""; 79 return "";
71 }; 80 };
72 //]]> 81 //]]>
73 </script> 82 </script>
74 83
75 </body> 84 </body>
76 </html> 85 </html>
OLDNEW
« no previous file with comments | « tests/srpc/srpc_url_as_nacl_desc_ppapi.html ('k') | tests/srpc_hw/srpc_hw_fd.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698