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

Side by Side Diff: ppapi/tests/extensions/packaged_app/controller.js

Issue 949543002: PPAPI: Add test for new-style permission for Sockets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 5 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var control_message; 5 var control_message;
6 6
7 function testAll() { 7 function testAll() {
8 var nacl_module = document.getElementById('nacl_module'); 8 var nacl_module = document.getElementById('nacl_module');
9 // The plugin will start the corresponding test and post a message back 9 // The plugin will start the corresponding test and post a message back
10 // the test is done. If the test has failed, the message is a description 10 // the test is done. If the test has failed, the message is a description
11 // of the error; otherwise the message is empty. 11 // of the error; otherwise the message is empty.
12 nacl_module.postMessage(control_message); 12 nacl_module.postMessage(control_message);
13 } 13 }
14 14
15 var onControlMessageReceived = function(message) { 15 var onControlMessageReceived = function(message) {
16 control_message = message; 16 control_message = message;
17 chrome.test.runTests([testAll]); 17 chrome.test.runTests([testAll]);
18 } 18 }
19 19
20 var pass_count = 0
20 var onPluginMessageReceived = function(message) { 21 var onPluginMessageReceived = function(message) {
21 if (message.data == "Test passed") { 22 if (message.data == "PASS") {
22 chrome.test.sendMessage("hello", onControlMessageReceived); 23 pass_count++;
24 if (pass_count == 2)
25 chrome.test.sendMessage("PASS", onControlMessageReceived);
dmichael (off chromium) 2015/02/23 23:46:38 I realized that since I added a new check, this wa
23 } else if (message.data) { 26 } else if (message.data) {
24 chrome.test.fail(message.data); 27 chrome.test.fail(message.data);
25 } else {
26 chrome.test.succeed();
27 } 28 }
28 }; 29 };
29 30
30 window.onload = function() { 31 window.onload = function() {
31 var nacl_module = document.getElementById('nacl_module'); 32 var nacl_module = document.getElementById('nacl_module');
32 nacl_module.addEventListener("message", onPluginMessageReceived, false); 33 nacl_module.addEventListener("message", onPluginMessageReceived, false);
33 }; 34 };
OLDNEW
« no previous file with comments | « ppapi/tests/extensions/extensions.gyp ('k') | ppapi/tests/extensions/packaged_app/test_packaged_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698