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

Side by Side Diff: ppapi/native_client/tests/ppapi_browser/ppb_widget/ppapi_ppb_widget.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, 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 // 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 // This function takes an array of messages and asserts that the nexe
7 // calls PostMessage with each of these messages, in order.
8 function expectMessages(test, plugin, messages) {
9 test.assert(messages.length > 0, 'Must provide at least one message');
10 var listener = test.wrap(function(message) {
11 plugin.removeEventListener('message', listener, false);
12 test.assertEqual(message.data, messages.shift());
13 if (messages.length == 0) {
14 test.pass();
15 } else {
16 plugin.addEventListener('message', listener, false);
17 }
18 });
19 plugin.addEventListener('message', listener, false);
20 }
21
22 function addTest(test_name, responses) {
23 if (responses === undefined) {
24 responses = [];
25 }
26 var expected_messages = [test_name + ':PASSED'];
27 expected_messages.concat(responses);
28 tester.addAsyncTest('PPB_Widget::' + test_name, function(test) {
29 expectMessages(test, plugin, expected_messages);
30 plugin.postMessage(test_name)
31 });
32 }
33
34 addTest('TestIsWidget');
35 addTest('TestLocation');
36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698