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

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

Issue 12319114: Extract debugger target enumeration into a separate class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@debugger
Patch Set: Cleaner version ready for review 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var pass = chrome.test.callbackPass; 5 var pass = chrome.test.callbackPass;
6 var fail = chrome.test.callbackFail; 6 var fail = chrome.test.callbackFail;
7 7
8 var debuggee; 8 var debuggee;
9 var protocolVersion = "1.0"; 9 var protocolVersion = "1.0";
10 10
(...skipping 19 matching lines...) Expand all
30 }, 30 },
31 31
32 function detach() { 32 function detach() {
33 chrome.debugger.detach(debuggee, pass()); 33 chrome.debugger.detach(debuggee, pass());
34 }, 34 },
35 35
36 function detachAgain() { 36 function detachAgain() {
37 chrome.debugger.detach(debuggee, 37 chrome.debugger.detach(debuggee,
38 fail("Debugger is not attached to the extension with id: " + 38 fail("Debugger is not attached to the extension with id: " +
39 debuggee.extensionId + ".")); 39 debuggee.extensionId + "."));
40 },
41
42 function discoverOwnExtension() {
43 chrome.debugger.getTargets(function(targets) {
44 var target = targets.filter(
45 function(t) {
46 return t.type == 'extension' && t.title == 'Extension Debugger';
47 })[0];
48 if (target) {
49 chrome.debugger.attach({targetId: target.id}, protocolVersion, pass());
50 } else {
51 chrome.test.fail("No extension found");
52 }
53 });
40 } 54 }
41 ]); 55 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698