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

Unified Diff: chrome/test/data/extensions/api_test/debugger_extension/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: Added a command line switch enabling attach to extension 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_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
new file mode 100644
index 0000000000000000000000000000000000000000..f7649f892bea78df92e119c02335dddb33c5ce01
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/debugger_extension/background.js
@@ -0,0 +1,37 @@
+var pass = chrome.test.callbackPass;
+var fail = chrome.test.callbackFail;
+
+var debuggee;
+var protocolVersion = "1.0";
+
+chrome.test.runTests([
+
+ function attach() {
+ var extensionId = chrome.extension.getURL('').split('/')[2];
+ debuggee = {extensionId: extensionId};
+ chrome.debugger.attach(debuggee, protocolVersion, pass());
+ },
+
+ function attachToMissing() {
+ var missingDebuggee = {extensionId: "foo"};
+ chrome.debugger.attach(missingDebuggee, protocolVersion,
+ fail("No extension 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 + "."));
+ },
+
+ function detach() {
+ chrome.debugger.detach(debuggee, pass());
+ },
+
+ function detachAgain() {
+ chrome.debugger.detach(debuggee,
+ fail("Debugger is not attached to the extension with id: " +
+ debuggee.extensionId + "."));
+ },
+]);

Powered by Google App Engine
This is Rietveld 408576698