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

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

Issue 10947037: DevTools: provide the debugger detach reason in chrome.debugger.onDetach extension API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewer comments addressed. Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/api/debugger.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 tabId; 8 var tabId;
9 var debuggee; 9 var debuggee;
10 var protocolVersion = "1.0"; 10 var protocolVersion = "1.0";
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 fail("Debugger is not attached to the tab with id: " + tabId + ".")); 62 fail("Debugger is not attached to the tab with id: " + tabId + "."));
63 }, 63 },
64 64
65 function detachAgain() { 65 function detachAgain() {
66 chrome.debugger.detach(debuggee, 66 chrome.debugger.detach(debuggee,
67 fail("Debugger is not attached to the tab with id: " + tabId + ".")); 67 fail("Debugger is not attached to the tab with id: " + tabId + "."));
68 }, 68 },
69 69
70 function closeTab() { 70 function closeTab() {
71 chrome.tabs.create({url:"inspected.html"}, function(tab) { 71 chrome.tabs.create({url:"inspected.html"}, function(tab) {
72 function onDetach(debuggee) { 72 function onDetach(debuggee, reason) {
73 chrome.test.assertEq(tab.id, debuggee.tabId); 73 chrome.test.assertEq(tab.id, debuggee.tabId);
74 chrome.test.assertEq("target_closed", reason);
74 chrome.debugger.onDetach.removeListener(onDetach); 75 chrome.debugger.onDetach.removeListener(onDetach);
75 chrome.test.succeed(); 76 chrome.test.succeed();
76 } 77 }
77 78
78 var debuggee2 = {tabId: tab.id}; 79 var debuggee2 = {tabId: tab.id};
79 chrome.debugger.attach(debuggee2, protocolVersion, function() { 80 chrome.debugger.attach(debuggee2, protocolVersion, function() {
80 chrome.debugger.onDetach.addListener(onDetach); 81 chrome.debugger.onDetach.addListener(onDetach);
81 chrome.tabs.remove(tab.id); 82 chrome.tabs.remove(tab.id);
82 }); 83 });
83 }); 84 });
84 }, 85 },
85 86
86 function attachToWebUI() { 87 function attachToWebUI() {
87 chrome.tabs.create({url:"chrome://version"}, function(tab) { 88 chrome.tabs.create({url:"chrome://version"}, function(tab) {
88 var debuggee = {tabId: tab.id}; 89 var debuggee = {tabId: tab.id};
89 chrome.debugger.attach(debuggee, protocolVersion, 90 chrome.debugger.attach(debuggee, protocolVersion,
90 fail("Can not attach to the page with the \"chrome://\" scheme.")); 91 fail("Can not attach to the page with the \"chrome://\" scheme."));
91 chrome.tabs.remove(tab.id); 92 chrome.tabs.remove(tab.id);
92 }); 93 });
93 } 94 }
94 95
95 ]); 96 ]);
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/debugger.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698