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

Side by Side Diff: ppapi/native_client/tests/ppapi_test_example/ppapi_test_example.js

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, 3 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 // Copyright (c) 2011 The Native Client Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 function setupTests(tester, plugin) {
6 // TODO(tester): replace with your tests.
7
8 // Below are sample test cases demonstrating postMessage as the test
9 // driving mechanism.
10
11 tester.addAsyncTest('Example::Simple', function(status) {
12 var messageListener = status.wrap(function(message) {
13 status.log('Received message: ' + message.data);
14 plugin.removeEventListener('message', messageListener, false);
15 status.assertEqual(message.data, 'TestSimple:PASSED');
16 status.pass();
17 });
18
19 plugin.addEventListener("message", messageListener, false);
20 plugin.postMessage("TestSimple");
21 });
22
23 tester.addAsyncTest('Example::Callback', function(status) {
24 var gotPassed = false;
25 var messageListener = status.wrap(function(message) {
26 status.log('Received message: ' + message.data);
27 plugin.removeEventListener('message', messageListener, false);
28 if (!gotPassed) {
29 status.assertEqual(message.data, 'TestCallback:PASSED');
30 gotPassed = true;
31 plugin.addEventListener("message", messageListener, false);
32 } else {
33 status.assertEqual(message.data, 'Callback');
34 status.pass();
35 }
36 });
37
38 plugin.addEventListener("message", messageListener, false);
39 plugin.postMessage("TestCallback");
40 });
41 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698