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"); |
+ } |
+ }); |
} |
]); |