| Index: ppapi/native_client/tests/ppapi_browser/ppb_graphics2d/ppapi_ppb_graphics2d.html
|
| ===================================================================
|
| --- ppapi/native_client/tests/ppapi_browser/ppb_graphics2d/ppapi_ppb_graphics2d.html (revision 0)
|
| +++ ppapi/native_client/tests/ppapi_browser/ppb_graphics2d/ppapi_ppb_graphics2d.html (revision 0)
|
| @@ -0,0 +1,122 @@
|
| +<!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) {
|
| + function testAndAssertStatus(test, name, status) {
|
| + var messageListener = test.wrap(function(message) {
|
| + plugin.removeEventListener('message', messageListener, false);
|
| + test.assertEqual(message.data, name + ':' + status);
|
| + test.pass();
|
| + });
|
| + plugin.addEventListener('message', messageListener, false);
|
| + plugin.postMessage(name);
|
| + }
|
| +
|
| + function testAndAssertStatusAndCallbacks(test, name, status, callback, calls) {
|
| + gotCalls = 0;
|
| + var callbackListener = test.wrap(function(message) {
|
| + plugin.removeEventListener('message', callbackListener, false);
|
| + test.assertEqual(message.data, callback);
|
| + if (++gotCalls < calls)
|
| + plugin.addEventListener('message', callbackListener, false);
|
| + else
|
| + test.pass();
|
| + });
|
| + var messageListener = test.wrap(function(message) {
|
| + plugin.removeEventListener('message', messageListener, false);
|
| + test.assertEqual(message.data, name + ':' + status);
|
| + plugin.addEventListener('message', callbackListener, false);
|
| + });
|
| + plugin.addEventListener('message', messageListener, false);
|
| + plugin.postMessage(name);
|
| + }
|
| + tester.addAsyncTest('PPB_Graphics2D::Create', function(test) {
|
| + testAndAssertStatus(test, 'TestCreate', 'PASSED');
|
| + });
|
| + tester.addAsyncTest('PPB_Graphics2D::IsGraphics2D', function(test) {
|
| + testAndAssertStatus(test, 'TestIsGraphics2D', 'PASSED');
|
| + });
|
| + tester.addAsyncTest('PPB_Graphics2D::Describe', function(test) {
|
| + testAndAssertStatus(test, 'TestDescribe', 'PASSED');
|
| + });
|
| + // This must be called first because it sets the entire graphics area to gray.
|
| + tester.addAsyncTest('PPB_Graphics2D::ReplaceContents', function(test) {
|
| + testAndAssertStatusAndCallbacks(test, 'TestReplaceContents', 'PASSED',
|
| + 'ReplaceContentsFlushCallback', 1);
|
| + });
|
| + // Adds a blue square at the top right.
|
| + tester.addAsyncTest('PPB_Graphics2D::PaintImageData', function(test) {
|
| + testAndAssertStatusAndCallbacks(test, 'TestPaintImageData', 'PASSED',
|
| + 'PaintImageDataFlushCallback', 1);
|
| + });
|
| + // Adds a yellow square at the bottom left.
|
| + tester.addAsyncTest('PPB_Graphics2D::PaintImageDataEntire', function(test) {
|
| + testAndAssertStatusAndCallbacks(test, 'TestPaintImageDataEntire', 'PASSED',
|
| + 'PaintImageDataEntireFlushCallback', 1);
|
| + });
|
| + // Adds a white square at the top left and then the middle.
|
| + tester.addAsyncTest('PPB_Graphics2D::Scroll', function(test) {
|
| + testAndAssertStatusAndCallbacks(test, 'TestScroll', 'PASSED',
|
| + 'ScrollFlushCallback', 1);
|
| + });
|
| + // Adds a green square at the top left (over white) and then the bottom right.
|
| + tester.addAsyncTest('PPB_Graphics2D::ScrollEntire', function(test) {
|
| + testAndAssertStatusAndCallbacks(test, 'TestScrollEntire', 'PASSED',
|
| + 'ScrollEntireFlushCallback', 1);
|
| + });
|
| + // Does not alter the image.
|
| + tester.addAsyncTest('PPB_Graphics2D::Flush', function(test) {
|
| + testAndAssertStatusAndCallbacks(test, 'TestFlush', 'PASSED',
|
| + 'FlushCallback', 1);
|
| + });
|
| + // Adds a red square at the top left (over green) 10 times.
|
| + tester.addAsyncTest('PPB_Graphics2D::FlushAnimation', function(test) {
|
| + testAndAssertStatusAndCallbacks(test, 'TestFlushAnimation', 'PASSED',
|
| + 'FlushAnimationCallback', 10);
|
| + });
|
| + tester.addAsyncTest('PPB_Graphics2D::Stress', function(test) {
|
| + testAndAssertStatus(test, 'TestStress', 'PASSED');
|
| + });
|
| +}
|
| + //]]>
|
| + </script>
|
| + <title>PPAPI PPB_Graphics2D Test</title>
|
| + </head>
|
| + <body>
|
| + <h1>PPAPI PPB_Graphics2D Test</h1>
|
| + NOTE: requires --enable-pepper-testing
|
| + <br><br>
|
| + <table>
|
| + <tr><td width="120"> Expected Image <td width="120">Actual Image
|
| + <tr>
|
| + <td>
|
| + <table width="90" height="90" bgcolor="#DDDDDD" cellspacing="0">
|
| + <tr><td bgcolor="#FF7777"><td><td bgcolor="#7777FF">
|
| + <tr><td><td bgcolor="#FFFFFF"><td>
|
| + <tr><td bgcolor="#FFFF00"><td><td bgcolor="#00FF00">
|
| + </table>
|
| + <td>
|
| + <embed type="application/x-nacl" id="test_nexe"
|
| + name="nacl_module"
|
| + src="ppapi_ppb_graphics2d.nmf"
|
| + style="background-color:#FFFFFF"
|
| + width="90" height="90" />
|
| + <table>
|
| + <br>
|
| + <script type="text/javascript">
|
| + //<![CDATA[
|
| + var tester = new Tester();
|
| + setupTests(tester, $('test_nexe'));
|
| + tester.waitFor($('test_nexe'));
|
| + tester.run();
|
| + //]]>
|
| + </script>
|
| + </body>
|
| +</html>
|
|
|