1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4 <!-- Copyright 2011 Google Inc. All rights reserved. -->
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">
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 plugin.removeEventListener('message', listener, false);
18 test.assertEqual(message.data, messages.shift());
19 if (messages.length ==
0) {
22 plugin.addEventListener('message', listener, false);
25 plugin.addEventListener('message', listener, false);
28 function addTest(test_name, responses) {
29 if (responses === undefined) {
32 var expected_messages = [test_name + ':PASSED'].concat(responses);
33 tester.addAsyncTest('PPB_Instance::' + test_name, function(test) {
34 expectMessages(test, plugin, expected_messages);
35 plugin.postMessage(test_name)
39 addTest('TestIsFullFrame');
40 addTest('TestBindGraphics');
44 <title>PPAPI PPB_Instance Test
</title>
47 <h1>PPAPI PPB_Instance Test
</h1>
49 <script type=
"text/javascript">
51 function createModule(id
, src
, type
) {
52 return createNaClEmbed({
61 var mime
= 'application/x-nacl';
62 if (getTestArguments()['pnacl'] !== undefined) {
63 mime
= 'application/x-pnacl';
65 var embed
= createModule('test_nexe', 'ppapi_ppb_instance.nmf', mime
);
66 document
.body
.appendChild(embed
);
68 var tester
= new Tester();
69 setupTests(tester
, $('test_nexe'));
70 tester
.waitFor($('test_nexe'));