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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 var missingDebuggee = {tabId: -1}; | 107 var missingDebuggee = {tabId: -1}; |
108 chrome.debugger.attach(missingDebuggee, protocolVersion, | 108 chrome.debugger.attach(missingDebuggee, protocolVersion, |
109 fail("No tab with given id " + missingDebuggee.tabId + ".")); | 109 fail("No tab with given id " + missingDebuggee.tabId + ".")); |
110 }, | 110 }, |
111 | 111 |
112 function attachToOwnBackgroundPageWithNoSilentFlag() { | 112 function attachToOwnBackgroundPageWithNoSilentFlag() { |
113 var ownExtensionId = chrome.extension.getURL('').split('/')[2]; | 113 var ownExtensionId = chrome.extension.getURL('').split('/')[2]; |
114 debuggeeExtension = {extensionId: ownExtensionId}; | 114 debuggeeExtension = {extensionId: ownExtensionId}; |
115 chrome.debugger.attach(debuggeeExtension, protocolVersion, | 115 chrome.debugger.attach(debuggeeExtension, protocolVersion, |
116 fail(SILENT_FLAG_REQUIRED)); | 116 fail(SILENT_FLAG_REQUIRED)); |
| 117 }, |
| 118 |
| 119 function discoverWorkerWithNoSilentFlag() { |
| 120 chrome.test.listenOnce(chrome.tabs.onUpdated, function () { |
| 121 chrome.debugger.getTargets(function(targets) { |
| 122 var page = targets.filter( |
| 123 function(t) { return t.type == 'worker'; })[0]; |
| 124 if (page) { |
| 125 chrome.debugger.attach({targetId: page.id}, protocolVersion, |
| 126 fail(SILENT_FLAG_REQUIRED)); |
| 127 } else { |
| 128 chrome.test.fail("Cannot discover a newly created worker"); |
| 129 } |
| 130 }); |
| 131 }); |
| 132 chrome.tabs.create({url: "worker.html"}); |
117 } | 133 } |
118 ]); | 134 ]); |
OLD | NEW |