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

Side by Side Diff: chrome/test/data/extensions/api_test/stubs/content_script.js

Issue 11745015: Update references to the extension messaging APIs to point to the "runtime" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Helper function to log message to both the local console and to the 5 // Helper function to log message to both the local console and to the
6 // background page, so that the latter can output the message via the 6 // background page, so that the latter can output the message via the
7 // chrome.test.log() function. 7 // chrome.test.log() function.
8 function logToConsoleAndStdout(msg) { 8 function logToConsoleAndStdout(msg) {
9 console.log(msg); 9 console.log(msg);
10 chrome.extension.sendRequest("log: " + msg); 10 chrome.extension.sendRequest("log: " + msg);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 parts.slice(0, i+1).join('.') + '(' + err + ')'); 72 parts.slice(0, i+1).join('.') + '(' + err + ')');
73 return false; 73 return false;
74 } 74 }
75 if (typeof(module) == "undefined") 75 if (typeof(module) == "undefined")
76 return true; 76 return true;
77 } else { 77 } else {
78 // This is the last component - we expect it to either be undefined or 78 // This is the last component - we expect it to either be undefined or
79 // to throw an error on access. 79 // to throw an error on access.
80 try { 80 try {
81 if (typeof(module[parts[i]]) == "undefined" && 81 if (typeof(module[parts[i]]) == "undefined" &&
82 path != "extension.lastError" && 82 path != "runtime.lastError" &&
83 path != "runtime.lastError" && 83 path != "runtime.lastError" &&
84 path != "runtime.id") { 84 path != "runtime.id") {
85 logToConsoleAndStdout(" fail (undefined and not throwing error): " + 85 logToConsoleAndStdout(" fail (undefined and not throwing error): " +
86 path); 86 path);
87 return false; 87 return false;
88 } else if (!expectError) { 88 } else if (!expectError) {
89 return true; 89 return true;
90 } 90 }
91 } catch (err) { 91 } catch (err) {
92 if (!expectError) { 92 if (!expectError) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 console.log(success ? "pass" : "fail"); 157 console.log(success ? "pass" : "fail");
158 if (success) { 158 if (success) {
159 reportSuccess(); 159 reportSuccess();
160 } else { 160 } else {
161 logToConsoleAndStdout("failures on:\n" + failures.join("\n") + 161 logToConsoleAndStdout("failures on:\n" + failures.join("\n") +
162 "\n\n\n>>> See comment in stubs_apitest.cc for a " + 162 "\n\n\n>>> See comment in stubs_apitest.cc for a " +
163 "hint about fixing this failure.\n\n"); 163 "hint about fixing this failure.\n\n");
164 reportFailure(); 164 reportFailure();
165 } 165 }
166 } 166 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698