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

Side by Side Diff: tests/prebuilt/x64/srpc_shm.html

Issue 6899031: Remove the obsolete prebuilt infrastructure files and disable multiarch. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 9 years, 8 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/prebuilt/x64/srpc_plugin.html ('k') | tests/prebuilt/x64/srpc_shm.nexe » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html>
4 <!-- Copyright 2009 Google Inc. All rights reserved. -->
5 <head>
6 <title> SRPC Shared Memory API Test </title>
7 <META HTTP-EQUIV="Pragma" CONTENT="no-cache" />
8 <META HTTP-EQUIV="Expires" CONTENT="-1" />
9 <style type="text/css">
10 td.notrun { background-color: skyblue }
11 td.pass { background-color: lime }
12 td.fail { background-color: red }
13 </style>
14 <script type="application/x-javascript">
15 //<![CDATA[
16 var SetTestResult = function(element_id, result) {
17 var element = document.getElementById(element_id);
18 element.className = result;
19 }
20
21 // The NaCl module. Used to produce handles and for __shmFactory invocations.
22 var server;
23 // All shared memory regions will have this size.
24 var shm_size = 65536;
25 // Handle to a shared memory object returned by a NaCl module
26 var nacl_shm_handle;
27 // Shared memory object resulting from mapping a handle from a NaCl module.
28 var nacl_shm;
29 // A mapped shared memory object created by the __shmFactory method.
30 var factory_shm;
31 // The epitome of a test string.
32 var test_str = 'Hello, world.';
33 // The test string's length.
34 var str_len = test_str.length;
35 // The count of failing tests. Set from the queue length, and decremented
36 // whenever a test passes.
37 var failing_count;
38
39 // The queue of small tests.
40 var testQueue = [ ];
41 var appendTest = function(test_descr) {
42 testQueue[testQueue.length] = test_descr;
43 }
44
45 var expectPass = function(element, has_return, fp) {
46 appendTest(new Array('pass', element, has_return, fp));
47 }
48
49 var expectFail = function(element, fp) {
50 appendTest(new Array('fail', element, fp));
51 }
52
53 var SharedMemoryFactory = function() {
54 // Test the creation of shared memory objects.
55 // Attempt to create with the wrong number of parameters.
56 expectFail('factory_too_few',
57 function() {
58 return server.__shmFactory();
59 });
60 expectFail('factory_too_many',
61 function() {
62 return server.__shmFactory(shm_size, 'extra');
63 });
64 // Attempt to create a shared memory region with size of invalid type.
65 expectFail('factory_size_null',
66 function() {
67 return server.__shmFactory(undefined);
68 });
69 expectFail('factory_size_string',
70 function() {
71 return server.__shmFactory('string');
72 });
73 expectFail('factory_size_object',
74 function() {
75 return server.__shmFactory(new Array(10));
76 });
77 // Attempt to create a shared memory region with an invalid size.
78 expectFail('factory_size_invalid',
79 function() {
80 return server.__shmFactory(-1);
81 });
82 // Attempt to create a shared memory region with a valid size.
83 expectPass('factory_conforming',
84 true,
85 function() {
86 return server.__shmFactory(shm_size);
87 });
88 }
89
90 var SharedMemoryMaps = function() {
91 // Test the map method of a handle object.
92 // Get a handle to an invalid shared memory object from a NaCl module.
93 expectPass('map_invalid',
94 true,
95 function() {
96 return server.get_invalid_handle();
97 });
98 // Attempt to map with the wrong number of parameters.
99 expectFail('map_too_many',
100 function() {
101 nacl_shm_handle.map(1);
102 });
103 // Attempt to map with the correct number of parameters.
104 expectPass('map_valid',
105 true,
106 function() {
107 return nacl_shm_handle.map();
108 });
109 // Attempt to write to a negative offset.
110 expectFail('map_offset_neg',
111 function() {
112 nacl_shm.write(-1, str_len, test_str);
113 });
114 // Attempt to write to an offset larger than the region size.
115 expectFail('map_offset_big',
116 function() {
117 nacl_shm.write(shm_size, str_len, test_str);
118 });
119 // Attempt to write with a negative length.
120 expectFail('map_length_neg',
121 function() {
122 nacl_shm.write(0, -1, test_str);
123 });
124 // Attempt to write with a length larger than the region size.
125 expectFail('map_length_big',
126 function() {
127 nacl_shm.write(0, str_len + 1, test_str);
128 });
129 // Attempt to write to a valid offset.
130 expectPass('map_conforming', false,
131 function() {
132 nacl_shm.write(0, str_len, test_str);
133 });
134 }
135
136 var SharedMemoryWrites = function() {
137 // Test the write method.
138 // Attempt to write with the wrong number of parameters.
139 expectFail('write_too_few',
140 function() {
141 factory_shm.write(0, str_len);
142 });
143 expectFail('write_too_many',
144 function() {
145 factory_shm.write(0, str_len, test_str, 'extra');
146 });
147 // Attempt to write with a badly typed offset parameter.
148 expectFail('write_offset_null',
149 function() {
150 factory_shm.write(undefined, str_len, test_str);
151 });
152 expectFail('write_offset_string',
153 function() {
154 factory_shm.write('string', str_len, test_str);
155 });
156 expectFail('write_offset_object',
157 function() {
158 factory_shm.write(new Array(10), str_len, test_str);
159 });
160 // Attempt to write to a negative offset.
161 expectFail('write_offset_neg',
162 function() {
163 factory_shm.write(-1, str_len, test_str);
164 });
165 // Attempt to write to an offset larger than the region size.
166 expectFail('write_offset_big',
167 function() {
168 factory_shm.write(shm_size + 1, str_len, test_str);
169 });
170 // Attempt to write with a badly typed length parameter.
171 expectFail('write_length_null',
172 function() {
173 factory_shm.write(0, undefined, test_str);
174 });
175 expectFail('write_length_string',
176 function() {
177 factory_shm.write(0, 'string', test_str);
178 });
179 expectFail('write_length_object',
180 function() {
181 factory_shm.write(0, new Array(10), test_str);
182 });
183 // Attempt to write with a negative length.
184 expectFail('write_length_neg',
185 function() {
186 factory_shm.write(0, -1, test_str);
187 });
188 // Attempt to write with a length larger than the region size.
189 expectFail('write_length_big',
190 function() {
191 factory_shm.write(0, shm_size + 1, test_str);
192 });
193 // Attempt to write with a badly typed string parameter.
194 expectFail('write_string_null',
195 function() {
196 factory_shm.write(0, str_len, undefined);
197 });
198 expectFail('write_string_integer',
199 function() {
200 factory_shm.write(0, str_len, 10);
201 });
202 expectFail('write_string_object',
203 function() {
204 factory_shm.write(0, str_len, new Array(10));
205 });
206 // Attempt to write overlapping the end of the region.
207 expectFail('write_overlap',
208 function() {
209 factory_shm.write(shm_size - str_len + 1, str_len, test_str);
210 });
211 // Attempt to write with string.length != length.
212 expectFail('write_length_mismatch',
213 function() {
214 factory_shm.write(0, str_len + 1, test_str);
215 });
216 // Attempt a valid write. This should pass.
217 expectPass('write_conforming',
218 false,
219 function() {
220 factory_shm.write(0, str_len, test_str);
221 });
222 }
223
224 var SharedMemoryReads = function() {
225 // Test the read method.
226 // Attempt to read with the wrong number of parameters.
227 expectFail('read_too_few',
228 function() {
229 return factory_shm.read(0);
230 });
231 expectFail('read_too_many',
232 function() {
233 return factory_shm.read(0, str_len, 'extra');
234 });
235 // Attempt to read with a badly typed offset parameter.
236 expectFail('read_offset_null',
237 function() {
238 return factory_shm.read(undefined, str_len);
239 });
240 expectFail('read_offset_string',
241 function() {
242 return factory_shm.read('string', str_len);
243 });
244 expectFail('read_offset_object',
245 function() {
246 return factory_shm.read(new Array(10), str_len);
247 });
248 // Attempt to read from a negative offset.
249 expectFail('read_offset_neg',
250 function() {
251 return factory_shm.read(-1, str_len);
252 });
253 // Attempt to read from an offset larger than the region size.
254 expectFail('read_offset_big',
255 function() {
256 return factory_shm.read(shm_size + 1, str_len);
257 });
258 // Attempt to read with a badly typed length parameter.
259 expectFail('read_length_null',
260 function() {
261 return factory_shm.read(0, undefined);
262 });
263 expectFail('read_length_string',
264 function() {
265 return factory_shm.read(0, 'string');
266 });
267 expectFail('read_length_object',
268 function() {
269 return factory_shm.read(0, new Array(10));
270 });
271 // Attempt to read with a negative length.
272 expectFail('read_length_neg',
273 function() {
274 return factory_shm.read(0, -1);
275 });
276 // Attempt to read with a length larger than the region size.
277 expectFail('read_length_big',
278 function() {
279 return factory_shm.read(0, shm_size + 1);
280 });
281 // Attempt to read overlapping the end of the region.
282 expectFail('read_overlap',
283 function() {
284 return factory_shm.read(shm_size - str_len + 1, str_len);
285 });
286 // Attempt a valid read, and ensure return is correct. This should pass.
287 expectPass('read_conforming',
288 true,
289 function() {
290 return factory_shm.read(0, str_len);
291 });
292 }
293
294 // The test run functions.
295 var testExpectedPass = function(element, has_return, fp) {
296 var result = undefined;
297 try {
298 result = fp();
299 if (has_return && (undefined == result)) {
300 SetTestResult(element, 'fail');
301 } else {
302 SetTestResult(element, 'pass');
303 --failing_count;
304 }
305 } catch (string) {
306 SetTestResult(element, 'fail');
307 }
308 }
309
310 var testExpectedFail = function(element, fp) {
311 var result = undefined;
312 try {
313 result = fp();
314 SetTestResult(element, 'fail');
315 } catch (string) {
316 if (undefined == result) {
317 SetTestResult(element, 'pass');
318 --failing_count;
319 } else {
320 SetTestResult(element, 'fail');
321 }
322 }
323 }
324
325 var RunAllTests = function() {
326 var i;
327 var len = testQueue.length;
328 // All tests are considered failure until they have run successfully.
329 // This catches runs that end prematurely.
330 failing_count = len;
331 for (i = 0; i < len; ++i) {
332 var test_descr = testQueue[i];
333 if ('pass' == test_descr[0]) {
334 testExpectedPass(test_descr[1], test_descr[2], test_descr[3]);
335 } else {
336 testExpectedFail(test_descr[1], test_descr[2]);
337 }
338 }
339 if (0 == failing_count) {
340 // Set the magic Selenium variable to signal success.
341 document.cookie = 'status=OK';
342 }
343 }
344
345 var EnqueueAndRunTests = function() {
346 // Setup -- abort entire test if this fails.
347 try {
348 nacl_shm_handle = server.get_shm_handle(shm_size);
349 nacl_shm = server.get_shm_handle(shm_size).map();
350 factory_shm = server.__shmFactory(shm_size);
351 } catch (string) {
352 window.alert('Memory Maps test setup failed.');
353 return;
354 }
355 // Enqueue the tests.
356 SharedMemoryFactory();
357 SharedMemoryMaps();
358 SharedMemoryWrites();
359 SharedMemoryReads();
360 // Run them all.
361 RunAllTests();
362 }
363 //]]>
364 </script>
365 </head>
366 <body onload="nacllib.waitForModulesAndRunTests();"
367 onunload="nacllib.cleanUp();" >
368 <h1> SRPC Shared Memory API Test </h1>
369 <table cellspacing=5 cellpadding=5 border=5 summary="Test status table">
370 <tr>
371 <td>
372 </td>
373 <td>
374 <b> __shmFactory tests </b>
375 </td>
376 <td>
377 <b> handle mapping tests </b>
378 </td>
379 <td>
380 <b> write method tests </b>
381 </td>
382 <td>
383 <b> read method tests </b>
384 </td>
385 </tr>
386 <tr>
387 <td>
388 <b> Argument count tests </b>
389 </td>
390 <td valign=top>
391 <table summary="Factory arugments tests">
392 <tr>
393 <td id="factory_too_few" class="notrun">
394 argc: too few
395 </td>
396 </tr>
397 <tr>
398 <td id="factory_too_many" class="notrun">
399 argc: too many
400 </td>
401 </tr>
402 </table>
403 </td>
404 <td>
405 <table summary="Map arguments test">
406 <tr>
407 <td id="map_too_many" class="notrun">
408 argc: too many
409 </td>
410 </tr>
411 </table>
412 </td>
413 <td>
414 <table summary="Write argument tests">
415 <tr>
416 <td id="write_too_few" class="notrun">
417 argc: too few
418 </td>
419 </tr>
420 <tr>
421 <td id="write_too_many" class="notrun">
422 argc: too many
423 </td>
424 </tr>
425 </table>
426 </td>
427 <td>
428 <table summary="Read arguments tests">
429 <tr>
430 <td id="read_too_few" class="notrun">
431 argc: too few
432 </td>
433 </tr>
434 <tr>
435 <td id="read_too_many" class="notrun">
436 argc: too many
437 </td>
438 </tr>
439 </table>
440 </td>
441 </tr>
442 <tr>
443 <td>
444 <b> Argument type tests </b>
445 </td>
446 <td valign=top>
447 <table summary="Factory size tests">
448 <tr>
449 <td id="factory_size_null" class="notrun">
450 arg[0]: (size) undefined
451 </td>
452 </tr>
453 <tr>
454 <td id="factory_size_string" class="notrun">
455 arg[0]: (size) string
456 </td>
457 </tr>
458 <tr>
459 <td id="factory_size_object" class="notrun">
460 arg[0]: (size) object
461 </td>
462 </tr>
463 </table>
464 </td>
465 <td valign=top>
466 </td>
467 <td valign=top>
468 <table summary="Write offset tests">
469 <tr>
470 <td id="write_offset_null" class="notrun">
471 arg[0]: (offset) undefined
472 </td>
473 </tr>
474 <tr>
475 <td id="write_offset_string" class="notrun">
476 arg[0]: (offset) string
477 </td>
478 </tr>
479 <tr>
480 <td id="write_offset_object" class="notrun">
481 arg[0]: (offset) object
482 </td>
483 </tr>
484 <tr>
485 <td id="write_length_null" class="notrun">
486 arg[1]: (length) undefined
487 </td>
488 </tr>
489 <tr>
490 <td id="write_length_string" class="notrun">
491 arg[1]: (length) string
492 </td>
493 </tr>
494 <tr>
495 <td id="write_length_object" class="notrun">
496 arg[1]: (length) object
497 </td>
498 </tr>
499 <tr>
500 <td id="write_string_null" class="notrun">
501 arg[2]: (string) undefined
502 </td>
503 </tr>
504 <tr>
505 <td id="write_string_integer" class="notrun">
506 arg[2]: (string) integer
507 </td>
508 </tr>
509 <tr>
510 <td id="write_string_object" class="notrun">
511 arg[2]: (string) object
512 </td>
513 </tr>
514 </table>
515 </td>
516 <td valign=top>
517 <table summary="Read offset tests">
518 <tr>
519 <td id="read_offset_null" class="notrun">
520 arg[0]: (offset) undefined
521 </td>
522 </tr>
523 <tr>
524 <td id="read_offset_string" class="notrun">
525 arg[0]: (offset) string
526 </td>
527 </tr>
528 <tr>
529 <td id="read_offset_object" class="notrun">
530 arg[0]: (offset) object
531 </td>
532 </tr>
533 <tr>
534 <td id="read_length_null" class="notrun">
535 arg[1]: (length) undefined
536 </td>
537 </tr>
538 <tr>
539 <td id="read_length_string" class="notrun">
540 arg[1]: (length) string
541 </td>
542 </tr>
543 <tr>
544 <td id="read_length_object" class="notrun">
545 arg[1]: (length) object
546 </td>
547 </tr>
548 </table>
549 </td>
550 </tr>
551
552 <tr>
553 <td>
554 <b> Argument range tests </b>
555 </td>
556 <td valign=top>
557 <table summary="Factory invalid size test">
558 <tr>
559 <td id="factory_size_invalid" class="notrun">
560 arg[0]: (size) invalid/negative
561 </td>
562 </tr>
563 </table>
564 </td>
565 <td valign=top>
566 <table summary="Map invalid offset tests">
567 <tr>
568 <td id="map_offset_neg" class="notrun">
569 arg[0]: (offset) negative
570 </td>
571 </tr>
572 <tr>
573 <td id="map_offset_big" class="notrun">
574 arg[0]: (offset) too big
575 </td>
576 </tr>
577 <tr>
578 <td id="map_length_neg" class="notrun">
579 arg[1]: (length) negative
580 </td>
581 </tr>
582 <tr>
583 <td id="map_length_big" class="notrun">
584 arg[1]: (length) too big
585 </td>
586 </tr>
587 </table>
588 </td>
589 <td valign=top>
590 <table summary="Write invalid offset tests">
591 <tr>
592 <td id="write_offset_neg" class="notrun">
593 arg[0]: (offset) negative
594 </td>
595 </tr>
596 <tr>
597 <td id="write_offset_big" class="notrun">
598 arg[0]: (offset) too big
599 </td>
600 </tr>
601 <tr>
602 <td id="write_length_neg" class="notrun">
603 arg[1]: (length) negative
604 </td>
605 </tr>
606 <tr>
607 <td id="write_length_big" class="notrun">
608 arg[1]: (length) too big
609 </td>
610 </tr>
611 </table>
612 </td>
613 <td valign=top>
614 <table summary="Read invalid offset tests">
615 <tr>
616 <td id="read_offset_neg" class="notrun">
617 arg[0]: (offset) negative
618 </td>
619 </tr>
620 <tr>
621 <td id="read_offset_big" class="notrun">
622 arg[0]: (offset) too big
623 </td>
624 </tr>
625 <tr>
626 <td id="read_length_neg" class="notrun">
627 arg[1]: (length) negative
628 </td>
629 </tr>
630 <tr>
631 <td id="read_length_big" class="notrun">
632 arg[1]: (length) too big
633 </td>
634 </tr>
635 </table>
636 </td>
637 </tr>
638
639 <tr>
640 <td>
641 <b> Semantic error tests </b>
642 </td>
643 <td>
644 </td>
645 <td valign=top>
646 <table summary="Invalid map test">
647 <tr>
648 <td id="map_invalid" class="notrun">
649 NaCl module returns invalid handle
650 </td>
651 </tr>
652 </table>
653 </td>
654 <td valign=top>
655 <table summary="Write error tests">
656 <tr>
657 <td id="write_overlap" class="notrun">
658 Write overlaps end of region
659 </td>
660 </tr>
661 <tr>
662 <td id="write_length_mismatch" class="notrun">
663 Length disagrees with str.length
664 </td>
665 </tr>
666 </table>
667 </td>
668 <td valign=top>
669 <table summary="Read error tests">
670 <tr>
671 <td id="read_overlap" class="notrun">
672 Read overlaps end of region
673 </td>
674 </tr>
675 </table>
676 </td>
677 </tr>
678
679 <tr>
680 <td>
681 <b> Expected behavior </b>
682 </td>
683 <td valign=top>
684 <table summary="Factory conforming test">
685 <tr>
686 <td id="factory_conforming" class="notrun">
687 Conforming usage
688 </td>
689 </tr>
690 </table>
691 </td>
692 <td valign=top>
693 <table summary="Map conforming tests">
694 <tr>
695 <td id="map_valid" class="notrun">
696 Conforming invocation of map
697 </td>
698 </tr>
699 <tr>
700 <td id="map_conforming" class="notrun">
701 Conforming write to shared memory
702 </td>
703 </tr>
704 </table>
705 </td>
706 <td valign=top>
707 <table summary="Write conforming test">
708 <tr>
709 <td id="write_conforming" class="notrun">
710 Conforming usage
711 </td>
712 </tr>
713 </table>
714 </td>
715 <td valign=top>
716 <table summary="Read conforming test">
717 <tr>
718 <td id="read_conforming" class="notrun">
719 Conforming usage
720 </td>
721 </tr>
722 </table>
723 </td>
724 </tr>
725 </table>
726
727 <table summary="The color codes used for identifying test outcomes">
728 <tr> <td align="center"> <em> Legend </em> </td> </tr>
729 <tr> <td align="center" class="notrun"> Test not run </td> </tr>
730 <tr> <td align="center" class="pass"> Test passed </td> </tr>
731 <tr> <td align="center" class="fail"> Test failed </td> </tr>
732 </table>
733 <p>
734 <b>
735 NOTE: Some versions of some WebKit-based browsers do not correctly report
736 JavaScript exceptions raised by NPAPI plugins. This can cause some of
737 the above tests to spuriously report failure.
738 </b>
739 </p>
740
741 <div id=status>NO-STATUS</div>
742
743 <embed type="application/x-nacl" id="nacl_server" name="nacl_module"
744 width="0" height="0" src="srpc_shm.nexe" />
745
746 <script type="text/javascript" src="nacl_js_lib.js"></script>
747 <script type="text/javascript">
748 //<![CDATA[
749 var nacllib = new NaclLib("nacl_module", "status", 500);
750
751 nacllib.test = function() {
752 server = document.getElementById("nacl_server");
753 EnqueueAndRunTests();
754 if (0 == testQueue.length) {
755 return "No tests run.";
756 } else if (0 != failing_count) {
757 return "Tests failed.";
758 } else {
759 return "";
760 }
761 }
762 //]]>
763 </script>
764 </body>
765 </html>
OLDNEW
« no previous file with comments | « tests/prebuilt/x64/srpc_plugin.html ('k') | tests/prebuilt/x64/srpc_shm.nexe » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698