Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: ppapi/native_client/tests/ppapi_browser/ppb_graphics2d/ppapi_ppb_graphics2d.html

Issue 7740013: Cloning a bunch of stuff from the native_client repository at r6528 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 (c) 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 function testAndAssertStatus(test, name, status) {
13 var messageListener = test.wrap(function(message) {
14 plugin.removeEventListener('message', messageListener, false);
15 test.assertEqual(message.data, name + ':' + status);
16 test.pass();
17 });
18 plugin.addEventListener('message', messageListener, false);
19 plugin.postMessage(name);
20 }
21
22 function testAndAssertStatusAndCallbacks(test, name, status, callback, calls) {
23 gotCalls = 0;
24 var callbackListener = test.wrap(function(message) {
25 plugin.removeEventListener('message', callbackListener, false);
26 test.assertEqual(message.data, callback);
27 if (++gotCalls < calls)
28 plugin.addEventListener('message', callbackListener, false);
29 else
30 test.pass();
31 });
32 var messageListener = test.wrap(function(message) {
33 plugin.removeEventListener('message', messageListener, false);
34 test.assertEqual(message.data, name + ':' + status);
35 plugin.addEventListener('message', callbackListener, false);
36 });
37 plugin.addEventListener('message', messageListener, false);
38 plugin.postMessage(name);
39 }
40 tester.addAsyncTest('PPB_Graphics2D::Create', function(test) {
41 testAndAssertStatus(test, 'TestCreate', 'PASSED');
42 });
43 tester.addAsyncTest('PPB_Graphics2D::IsGraphics2D', function(test) {
44 testAndAssertStatus(test, 'TestIsGraphics2D', 'PASSED');
45 });
46 tester.addAsyncTest('PPB_Graphics2D::Describe', function(test) {
47 testAndAssertStatus(test, 'TestDescribe', 'PASSED');
48 });
49 // This must be called first because it sets the entire graphics area to gray.
50 tester.addAsyncTest('PPB_Graphics2D::ReplaceContents', function(test) {
51 testAndAssertStatusAndCallbacks(test, 'TestReplaceContents', 'PASSED',
52 'ReplaceContentsFlushCallback', 1);
53 });
54 // Adds a blue square at the top right.
55 tester.addAsyncTest('PPB_Graphics2D::PaintImageData', function(test) {
56 testAndAssertStatusAndCallbacks(test, 'TestPaintImageData', 'PASSED',
57 'PaintImageDataFlushCallback', 1);
58 });
59 // Adds a yellow square at the bottom left.
60 tester.addAsyncTest('PPB_Graphics2D::PaintImageDataEntire', function(test) {
61 testAndAssertStatusAndCallbacks(test, 'TestPaintImageDataEntire', 'PASSED',
62 'PaintImageDataEntireFlushCallback', 1);
63 });
64 // Adds a white square at the top left and then the middle.
65 tester.addAsyncTest('PPB_Graphics2D::Scroll', function(test) {
66 testAndAssertStatusAndCallbacks(test, 'TestScroll', 'PASSED',
67 'ScrollFlushCallback', 1);
68 });
69 // Adds a green square at the top left (over white) and then the bottom right.
70 tester.addAsyncTest('PPB_Graphics2D::ScrollEntire', function(test) {
71 testAndAssertStatusAndCallbacks(test, 'TestScrollEntire', 'PASSED',
72 'ScrollEntireFlushCallback', 1);
73 });
74 // Does not alter the image.
75 tester.addAsyncTest('PPB_Graphics2D::Flush', function(test) {
76 testAndAssertStatusAndCallbacks(test, 'TestFlush', 'PASSED',
77 'FlushCallback', 1);
78 });
79 // Adds a red square at the top left (over green) 10 times.
80 tester.addAsyncTest('PPB_Graphics2D::FlushAnimation', function(test) {
81 testAndAssertStatusAndCallbacks(test, 'TestFlushAnimation', 'PASSED',
82 'FlushAnimationCallback', 10);
83 });
84 tester.addAsyncTest('PPB_Graphics2D::Stress', function(test) {
85 testAndAssertStatus(test, 'TestStress', 'PASSED');
86 });
87 }
88 //]]>
89 </script>
90 <title>PPAPI PPB_Graphics2D Test</title>
91 </head>
92 <body>
93 <h1>PPAPI PPB_Graphics2D Test</h1>
94 NOTE: requires --enable-pepper-testing
95 <br><br>
96 <table>
97 <tr><td width="120"> Expected Image <td width="120">Actual Image
98 <tr>
99 <td>
100 <table width="90" height="90" bgcolor="#DDDDDD" cellspacing="0">
101 <tr><td bgcolor="#FF7777"><td><td bgcolor="#7777FF">
102 <tr><td><td bgcolor="#FFFFFF"><td>
103 <tr><td bgcolor="#FFFF00"><td><td bgcolor="#00FF00">
104 </table>
105 <td>
106 <embed type="application/x-nacl" id="test_nexe"
107 name="nacl_module"
108 src="ppapi_ppb_graphics2d.nmf"
109 style="background-color:#FFFFFF"
110 width="90" height="90" />
111 <table>
112 <br>
113 <script type="text/javascript">
114 //<![CDATA[
115 var tester = new Tester();
116 setupTests(tester, $('test_nexe'));
117 tester.waitFor($('test_nexe'));
118 tester.run();
119 //]]>
120 </script>
121 </body>
122 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698