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.1"; | 10 var protocolVersion = "1.2"; |
11 var protocolPreviousVersion = "1.0"; | 11 var protocolPreviousVersion = "1.1"; |
| 12 var unsupportedMinorProtocolVersion = "1.5"; |
| 13 var unsupportedMajorProtocolVersion = "100.0"; |
12 | 14 |
13 var SILENT_FLAG_REQUIRED = "Cannot attach to this target unless " + | 15 var SILENT_FLAG_REQUIRED = "Cannot attach to this target unless " + |
14 "'silent-debugger-extension-api' flag is enabled."; | 16 "'silent-debugger-extension-api' flag is enabled."; |
15 | 17 |
16 chrome.test.runTests([ | 18 chrome.test.runTests([ |
17 | 19 |
18 function attachMalformedVersion() { | 20 function attachMalformedVersion() { |
19 chrome.tabs.getSelected(null, function(tab) { | 21 chrome.tabs.getSelected(null, function(tab) { |
20 chrome.debugger.attach({tabId: tab.id}, "malformed-version", fail( | 22 chrome.debugger.attach({tabId: tab.id}, "malformed-version", fail( |
21 "Requested protocol version is not supported: malformed-version.")); | 23 "Requested protocol version is not supported: malformed-version.")); |
22 }); | 24 }); |
23 }, | 25 }, |
24 | 26 |
25 function attachUnsupportedMinorVersion() { | 27 function attachUnsupportedMinorVersion() { |
26 chrome.tabs.getSelected(null, function(tab) { | 28 chrome.tabs.getSelected(null, function(tab) { |
27 chrome.debugger.attach({tabId: tab.id}, "1.5", | 29 chrome.debugger.attach({tabId: tab.id}, unsupportedMinorProtocolVersion, |
28 fail("Requested protocol version is not supported: 1.5.")); | 30 fail("Requested protocol version is not supported: " + |
| 31 unsupportedMinorProtocolVersion + ".")); |
29 }); | 32 }); |
30 }, | 33 }, |
31 | 34 |
32 function attachUnsupportedVersion() { | 35 function attachUnsupportedVersion() { |
33 chrome.tabs.getSelected(null, function(tab) { | 36 chrome.tabs.getSelected(null, function(tab) { |
34 chrome.debugger.attach({tabId: tab.id}, "100.0", | 37 chrome.debugger.attach({tabId: tab.id}, unsupportedMajorProtocolVersion, |
35 fail("Requested protocol version is not supported: 100.0.")); | 38 fail("Requested protocol version is not supported: " + |
| 39 unsupportedMajorProtocolVersion + ".")); |
36 }); | 40 }); |
37 }, | 41 }, |
38 | 42 |
39 function attachPreviousVersion() { | 43 function attachPreviousVersion() { |
40 chrome.tabs.getSelected(null, function(tab) { | 44 chrome.tabs.getSelected(null, function(tab) { |
41 debuggee = {tabId: tab.id}; | 45 debuggee = {tabId: tab.id}; |
42 chrome.debugger.attach(debuggee, protocolPreviousVersion, function() { | 46 chrome.debugger.attach(debuggee, protocolPreviousVersion, function() { |
43 chrome.debugger.detach(debuggee, pass()); | 47 chrome.debugger.detach(debuggee, pass()); |
44 }); | 48 }); |
45 }); | 49 }); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 function onAttach() { | 212 function onAttach() { |
209 chrome.debugger.sendCommand(debuggee, "Page.enable"); | 213 chrome.debugger.sendCommand(debuggee, "Page.enable"); |
210 chrome.debugger.sendCommand( | 214 chrome.debugger.sendCommand( |
211 debuggee, "Page.navigate", {url:"about:blank"}, onNavigateDone); | 215 debuggee, "Page.navigate", {url:"about:blank"}, onNavigateDone); |
212 } | 216 } |
213 | 217 |
214 chrome.debugger.attach(debuggee, protocolVersion, onAttach); | 218 chrome.debugger.attach(debuggee, protocolVersion, onAttach); |
215 }); | 219 }); |
216 } | 220 } |
217 ]); | 221 ]); |
OLD | NEW |