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

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

Issue 12304021: Allow chrome.debugger API to attach to extension background pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/debugger/background.js
diff --git a/chrome/test/data/extensions/api_test/debugger/background.js b/chrome/test/data/extensions/api_test/debugger/background.js
index 0ca46c96a3bb130dba39384b31f4233213b97be4..35a02514bb8ea03fde52a0ab38fbfe6de9e4320a 100644
--- a/chrome/test/data/extensions/api_test/debugger/background.js
+++ b/chrome/test/data/extensions/api_test/debugger/background.js
@@ -7,6 +7,7 @@ var fail = chrome.test.callbackFail;
var tabId;
var debuggee;
+var debuggeeExtension;
var protocolVersion = "1.0";
chrome.test.runTests([
@@ -40,6 +41,12 @@ chrome.test.runTests([
});
},
+ function attachToMissingTab() {
+ var missingDebuggee = {tabId: -1};
+ chrome.debugger.attach(missingDebuggee, protocolVersion,
+ fail("No tab with given id " + missingDebuggee.tabId + "."));
+ },
+
function attachAgain() {
chrome.debugger.attach(debuggee, protocolVersion,
fail("Another debugger is already attached to the tab with id: " +
@@ -98,6 +105,40 @@ chrome.test.runTests([
fail("Can not attach to the page with the \"chrome://\" scheme."));
chrome.tabs.remove(tab.id);
});
- }
+ },
+
+ function attachToExtension() {
+ var extensionId = chrome.extension.getURL('').split('/')[2];
+ debuggeeExtension = {extensionId: extensionId};
+ chrome.debugger.attach(debuggeeExtension, protocolVersion, pass());
+ },
+
+ function attachToMissingExtension() {
+ var missingDebuggee = {extensionId: "foo"};
+ chrome.debugger.attach(missingDebuggee, protocolVersion,
+ fail("No extension with given id " +
+ missingDebuggee.extensionId + "."));
+ },
+ function attachToInvalidTarget() {
+ var emptyDebuggee = {};
+ chrome.debugger.attach(emptyDebuggee, protocolVersion,
+ fail("Either tab id or extension id must be specified."));
+ },
+
+ function attachAgainToExtension() {
+ chrome.debugger.attach(debuggeeExtension, protocolVersion,
+ fail("Another debugger is already attached to the extension with id: " +
+ debuggeeExtension.extensionId + "."));
+ },
+
+ function detachFromExtension() {
+ chrome.debugger.detach(debuggeeExtension, pass());
+ },
+
+ function detachAgainFromExtension() {
+ chrome.debugger.detach(debuggeeExtension,
+ fail("Debugger is not attached to the extension with id: " +
+ debuggeeExtension.extensionId + "."));
+ },
]);

Powered by Google App Engine
This is Rietveld 408576698