OLD | NEW |
(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 2011 Google Inc. All rights reserved. --> |
| 5 <head> |
| 6 <META HTTP-EQUIV="Pragma" CONTENT="no-cache" /> |
| 7 <META HTTP-EQUIV="Expires" CONTENT="-1" /> |
| 8 <script type="text/javascript" src="nacltest.js"></script> |
| 9 <script type="application/x-javascript"> |
| 10 //<![CDATA[ |
| 11 function setupTests(tester, plugin) { |
| 12 // This function takes an array of messages and asserts that the nexe |
| 13 // calls PostMessage with each of these messages, in order. |
| 14 function expectMessages(test, plugin, messages) { |
| 15 test.assert(messages.length > 0, 'Must provide at least one message'); |
| 16 var listener = test.wrap(function(message) { |
| 17 console.log('got a message' + message.data); |
| 18 plugin.removeEventListener('message', listener, false); |
| 19 test.assertEqual(message.data, messages.shift()); |
| 20 if (messages.length == 0) { |
| 21 test.pass(); |
| 22 } else { |
| 23 plugin.addEventListener('message', listener, false); |
| 24 } |
| 25 }); |
| 26 plugin.addEventListener('message', listener, false); |
| 27 } |
| 28 |
| 29 function addTest(test_name, responses) { |
| 30 if (responses === undefined) { |
| 31 responses = []; |
| 32 } |
| 33 var expected_messages = [test_name + ':PASSED'].concat(responses); |
| 34 console.log('adding' + test_name); |
| 35 tester.addAsyncTest('PPB_Var::' + test_name, function(test) { |
| 36 expectMessages(test, plugin, expected_messages); |
| 37 plugin.postMessage(test_name) |
| 38 }); |
| 39 } |
| 40 |
| 41 addTest('TestStringVarCreateDelete'); |
| 42 /* TestStringVarRefCount is flaky (or the implementation is flaky) |
| 43 Disabling for now. |
| 44 http://code.google.com/p/nativeclient/issues/detail?id=2124 |
| 45 TODO(sehr): file bug in chromium against pepper (and maybe fix it!) |
| 46 */ |
| 47 //addTest('TestStringVarRefCount'); |
| 48 } |
| 49 //]]> |
| 50 </script> |
| 51 <title>PPAPI PPB_Var Test</title> |
| 52 </head> |
| 53 <body> |
| 54 <h1>PPAPI PPB_Core Test</h1> |
| 55 |
| 56 <embed type="application/x-nacl" id="test_nexe" |
| 57 name="nacl_module" |
| 58 src="ppapi_ppb_var.nmf" |
| 59 width="0" height="0" /> |
| 60 |
| 61 <script type="text/javascript"> |
| 62 //<![CDATA[ |
| 63 var tester = new Tester(); |
| 64 setupTests(tester, $('test_nexe')); |
| 65 tester.waitFor($('test_nexe')); |
| 66 tester.run(); |
| 67 //]]> |
| 68 </script> |
| 69 </body> |
| 70 </html> |
OLD | NEW |