| OLD | NEW |
| 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 Loading... |
| 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 ]); |
| OLD | NEW |