<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<!-- Copyright 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.
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('TestIsFullFrame');
addTest('TestBindGraphics');
}
//]]>
</script>
<title>PPAPI PPB_Instance Test</title>
</head>
<body>
<h1>PPAPI PPB_Instance Test</h1>
<script type="text/javascript">
//<![CDATA[
function createModule(id, src, type) {
return createNaClEmbed({
id: id,
src: src,
width: 1,
height: 1,
type: type
});
}
var mime = 'application/x-nacl';
if (getTestArguments()['pnacl'] !== undefined) {
mime = 'application/x-pnacl';
}
var embed = createModule('test_nexe', 'ppapi_ppb_instance.nmf', mime);
document.body.appendChild(embed);
var tester = new Tester();
setupTests(tester, $('test_nexe'));
tester.waitFor($('test_nexe'));
tester.run();
//]]>
</script>
</body>
</html>