| Index: ppapi/native_client/tests/ppapi_browser/ppb_memory/ppapi_ppb_memory.html
|
| ===================================================================
|
| --- ppapi/native_client/tests/ppapi_browser/ppb_memory/ppapi_ppb_memory.html (revision 0)
|
| +++ ppapi/native_client/tests/ppapi_browser/ppb_memory/ppapi_ppb_memory.html (revision 0)
|
| @@ -0,0 +1,66 @@
|
| +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
| + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
| +<html>
|
| + <!-- Copyright (c) 2011 Google Inc. All rights reserved. -->
|
| + <head>
|
| + <meta http-equiv="Pragma" content="no-cache" />
|
| + <meta http-equiv="Expires" content="-1" />
|
| + <script type="text/javascript" src="nacltest.js"></script>
|
| + <script type="application/x-javascript">
|
| + //<![CDATA[
|
| + function setupTests(tester, plugin) {
|
| + // This function takes an array of messages and asserts that the nexe
|
| + // calls PostMessage with each of these messages, in order.
|
| + // TODO(dmichael, polina, ncbray or mball): This is copy/pasted from
|
| + // ppapi_ppb_instance.html, which was probably copy/pasted from
|
| + // somewhere else. We should move this or something like it to
|
| + // nacltest.js and remove this code from the tests that use it.
|
| + function expectMessages(test, plugin, messages) {
|
| + test.assert(messages.length > 0, 'Must provide at least one message');
|
| + var listener = test.wrap(function(message) {
|
| + plugin.removeEventListener('message', listener, false);
|
| + test.assertEqual(message.data, messages.shift());
|
| + if (messages.length == 0) {
|
| + test.pass();
|
| + } else {
|
| + plugin.addEventListener('message', listener, false);
|
| + }
|
| + });
|
| + plugin.addEventListener('message', listener, false);
|
| + }
|
| +
|
| + function addTest(test_name, responses) {
|
| + if (responses === undefined) {
|
| + responses = [];
|
| + }
|
| + var expected_messages = [test_name + ':PASSED'].concat(responses);
|
| + tester.addAsyncTest('PPB_Instance::' + test_name, function(test) {
|
| + expectMessages(test, plugin, expected_messages);
|
| + plugin.postMessage(test_name)
|
| + });
|
| + }
|
| +
|
| + addTest('TestMemAllocAndMemFree');
|
| + }
|
| + //]]>
|
| + </script>
|
| + <title>PPAPI PPB_Memory_Dev Test</title>
|
| + </head>
|
| + <body>
|
| + <h1>PPAPI PPB_Memory_Dev Test</h1>
|
| +
|
| + <embed type="application/x-nacl" id="test_nexe"
|
| + name="nacl_module"
|
| + src="ppapi_ppb_memory.nmf"
|
| + width="0" height="0" />
|
| +
|
| + <script type="text/javascript">
|
| + //<![CDATA[
|
| + var tester = new Tester();
|
| + setupTests(tester, $('test_nexe'));
|
| + tester.waitFor($('test_nexe'));
|
| + tester.run();
|
| + //]]>
|
| + </script>
|
| + </body>
|
| +</html>
|
|
|