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

Unified Diff: chrome/test/data/extensions/api_test/debugger_extension/background.js

Issue 12377047: Add chrome.debugger.getTargets method to discover available debug targets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@targets
Patch Set: Rebase Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/debugger_extension/background.js
diff --git a/chrome/test/data/extensions/api_test/debugger_extension/background.js b/chrome/test/data/extensions/api_test/debugger_extension/background.js
index 63101a85e3e860abd3fb67aab28d6c6f11c05d46..5b2c1e8159a3eb9b4663a35d7d80eb0efb8537fa 100644
--- a/chrome/test/data/extensions/api_test/debugger_extension/background.js
+++ b/chrome/test/data/extensions/api_test/debugger_extension/background.js
@@ -19,14 +19,14 @@ chrome.test.runTests([
function attachToMissing() {
var missingDebuggee = {extensionId: "foo"};
chrome.debugger.attach(missingDebuggee, protocolVersion,
- fail("No extension with given id " +
+ fail("No background page with given id " +
missingDebuggee.extensionId + "."));
},
function attachAgain() {
chrome.debugger.attach(debuggee, protocolVersion,
- fail("Another debugger is already attached to the extension with id: " +
- debuggee.extensionId + "."));
+ fail("Another debugger is already attached " +
+ "to the background page with id: " + debuggee.extensionId + "."));
},
function detach() {
@@ -35,7 +35,22 @@ chrome.test.runTests([
function detachAgain() {
chrome.debugger.detach(debuggee,
- fail("Debugger is not attached to the extension with id: " +
+ fail("Debugger is not attached to the background page with id: " +
debuggee.extensionId + "."));
+ },
+
+ function discoverOwnBackgroundPage() {
+ chrome.debugger.getTargets(function(targets) {
+ var target = targets.filter(
+ function(t) {
+ return t.type == 'background_page' &&
+ t.title == 'Extension Debugger';
+ })[0];
+ if (target) {
+ chrome.debugger.attach({targetId: target.id}, protocolVersion, pass());
+ } else {
+ chrome.test.fail("No extension found");
+ }
+ });
}
]);

Powered by Google App Engine
This is Rietveld 408576698