Index: ppapi/native_client/tests/ppapi_example_post_message/ppapi_example_post_message.html |
=================================================================== |
--- ppapi/native_client/tests/ppapi_example_post_message/ppapi_example_post_message.html (revision 0) |
+++ ppapi/native_client/tests/ppapi_example_post_message/ppapi_example_post_message.html (revision 0) |
@@ -0,0 +1,60 @@ |
+<!-- |
+ Copyright 2011 The Native Client Authors. All rights reserved. |
+ Use of this source code is governed by a BSD-style license that can |
+ be found in the LICENSE file. |
+--> |
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
+<html> |
+ <head> |
+ <meta http-equiv="Pragma" content="no-cache" /> |
+ <meta http-equiv="Expires" content="-1" /> |
+ <script type="text/javascript" src="nacltest.js"></script> |
+ <title>Native Client PPAPI Post Message Example</title> |
+ </head> |
+ |
+ <body> |
+ <h1>Native Client PPAPI Post Message Example</h1> |
+ <div> |
+ <embed id="naclModule" |
+ name="naclModule" |
+ width=400 height=400 |
+ src="ppapi_example_post_message.nmf" |
+ basic_tests="2" |
+ stress_tests="0" |
+ style="background-color:gray" |
+ type="application/x-nacl" /> |
+ </div> |
+ |
+ <script type="text/javascript"> |
+ //<![CDATA[ |
+function setupTests(tester, plugin) { |
+ tester.addAsyncTest('TestPalindrome', function(status) { |
+ // Try posting a palindrome to the plugin. |
+ plugin.addEventListener('message', function(message_event) { |
+ this.removeEventListener('message', arguments.callee, false); |
+ status.assertEqual(message_event.data, true); |
+ status.pass(); |
+ }, false); |
+ plugin.postMessage('amokigleredderelgikoma'); |
+ }); |
+ |
+ tester.addAsyncTest('TestNonPalindrome', function(status) { |
+ // Try posting a non-palindrome. |
+ plugin.addEventListener('message', function(message_event) { |
+ this.removeEventListener('message', arguments.callee, false); |
+ status.assertEqual(message_event.data, false); |
+ status.pass(); |
+ }, false); |
+ plugin.postMessage('This is not a palindrome.'); |
+ }); |
+} |
+ |
+var tester = new Tester(); |
+setupTests(tester, $('naclModule')); |
+tester.waitFor($('naclModule')); |
+tester.run(); |
+ //]]> |
+ </script> |
+ </body> |
+</html> |