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

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

Issue 8725019: Move another bunch of extension API tests to manifest_version 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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
OLDNEW
1 <script> 1 <!--
2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this
3 * source code is governed by a BSD-style license that can be found in the
4 * LICENSE file.
5 -->
6 <script src="background.js"></script>
2 7
3 var pass = chrome.test.callbackPass;
4 var fail = chrome.test.callbackFail;
5
6 var tabId;
7 var debuggee;
8 var protocolVersion = "0.1";
9
10 chrome.test.runTests([
11
12 function attachMalformedVersion() {
13 chrome.tabs.getSelected(null, function(tab) {
14 chrome.experimental.debugger.attach({tabId: tab.id}, "malformed-version",
15 fail("Requested protocol version is not supported: malformed-version." ));
16 });
17 },
18
19 function attachUnsupportedVersion() {
20 chrome.tabs.getSelected(null, function(tab) {
21 chrome.experimental.debugger.attach({tabId: tab.id}, "1.0",
22 fail("Requested protocol version is not supported: 1.0."));
23 });
24 },
25
26 function attach() {
27 chrome.tabs.getSelected(null, function(tab) {
28 tabId = tab.id;
29 debuggee = {tabId: tab.id};
30 chrome.experimental.debugger.attach(debuggee, protocolVersion, pass());
31 });
32 },
33
34 function attachAgain() {
35 chrome.experimental.debugger.attach(debuggee, protocolVersion,
36 fail("Another debugger is already attached to the tab with id: " +
37 tabId + "."));
38 },
39
40 function sendCommand() {
41 function onResponse() {
42 if (chrome.extension.lastError &&
43 chrome.extension.lastError.message.indexOf("invalidMethod") != -1)
44 chrome.test.succeed();
45 else
46 chrome.test.fail();
47 }
48 chrome.experimental.debugger.sendCommand(debuggee,
49 "invalidMethod",
50 null,
51 onResponse);
52 },
53
54 function detach() {
55 chrome.experimental.debugger.detach(debuggee, pass());
56 },
57
58 function sendCommandAfterDetach() {
59 chrome.experimental.debugger.sendCommand(debuggee, "Foo", null,
60 fail("Debugger is not attached to the tab with id: " + tabId + "."));
61 },
62
63 function detachAgain() {
64 chrome.experimental.debugger.detach(debuggee,
65 fail("Debugger is not attached to the tab with id: " + tabId + "."));
66 },
67
68 function closeTab() {
69 chrome.tabs.create({url:"inspected.html"}, function(tab) {
70 function onDetach(debuggee) {
71 chrome.test.assertEq(tab.id, debuggee.tabId);
72 chrome.experimental.debugger.onDetach.removeListener(onDetach);
73 chrome.test.succeed();
74 }
75
76 var debuggee2 = {tabId: tab.id};
77 chrome.experimental.debugger.attach(debuggee2, protocolVersion, function() {
78 chrome.experimental.debugger.onDetach.addListener(onDetach);
79 chrome.tabs.remove(tab.id);
80 });
81 });
82 }
83 ]);
84 </script>
85
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698