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

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 flag 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..63101a85e3e860abd3fb67aab28d6c6f11c05d46
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/debugger_extension/background.js
@@ -0,0 +1,41 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+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