OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../http/tests/inspector/inspector-test.js"></script> |
4 <script type="text/javascript"> | 4 <script type="text/javascript"> |
5 function test() | 5 function test() |
6 { | 6 { |
7 var requestsSent = 0; | 7 var requestsSent = 0; |
8 var responsesReceived = 0; | 8 var responsesReceived = 0; |
9 | 9 |
10 InspectorTest.startDumpingProtocolMessages(); | 10 InspectorTest.startDumpingProtocolMessages(); |
11 | 11 |
12 function finishWhenDone(agentName, action, errorString) | 12 function finishWhenDone(agentName, action, errorString) |
13 { | 13 { |
14 if (action === "enable") | 14 if (action === "enable") |
15 InspectorTest.addResult(""); | 15 InspectorTest.addResult(""); |
16 if (errorString) | 16 if (errorString) |
17 InspectorTest.addResult(agentName + "." + action + " finished with e
rror " + errorString); | 17 InspectorTest.addResult(agentName + "." + action + " finished with e
rror " + errorString); |
18 else | 18 else |
19 InspectorTest.addResult(agentName + "." + action + " finished succes
sfully"); | 19 InspectorTest.addResult(agentName + "." + action + " finished succes
sfully"); |
20 | 20 |
21 ++responsesReceived; | 21 ++responsesReceived; |
22 if (responsesReceived === requestsSent) | 22 if (responsesReceived === requestsSent) |
23 InspectorTest.completeTest(); | 23 InspectorTest.completeTest(); |
24 } | 24 } |
25 | 25 |
26 var targets = WebInspector.targetManager.targets(); | 26 var targets = WebInspector.targetManager.targets(); |
27 targets.forEach(function(target) { | 27 targets.forEach(function(target) { |
28 var agentNames = Object.keys(target._agentsMap).filter(function(agentNam
e) { | 28 var agentNames = Object.keys(target._agentsMap).filter(function(agentNam
e) { |
29 var agent = target._agentsMap[agentName]; | 29 var agent = target._agentsMap[agentName]; |
30 return agent["enable"] && agent["disable"] && agentName !== "Service
Worker"; // async wrt others. | 30 return agent["enable"] && agent["disable"] && agentName !== "Service
Worker" && agentName !== "Security"; // async wrt others. |
31 }).sort(); | 31 }).sort(); |
32 | 32 |
33 function disableAgent(agentName) | 33 function disableAgent(agentName) |
34 { | 34 { |
35 ++requestsSent; | 35 ++requestsSent; |
36 var agent = target._agentsMap[agentName]; | 36 var agent = target._agentsMap[agentName]; |
37 if (agent._promisified) | 37 if (agent._promisified) |
38 agent.disable().then(finishWhenDone.bind(null, agentName, "disab
le", null), finishWhenDone.bind(null, agentName, "disable")); | 38 agent.disable().then(finishWhenDone.bind(null, agentName, "disab
le", null), finishWhenDone.bind(null, agentName, "disable")); |
39 else | 39 else |
40 agent.disable(finishWhenDone.bind(null, agentName, "disable")); | 40 agent.disable(finishWhenDone.bind(null, agentName, "disable")); |
(...skipping 17 matching lines...) Expand all Loading... |
58 }); | 58 }); |
59 }); | 59 }); |
60 } | 60 } |
61 | 61 |
62 </script> | 62 </script> |
63 </head> | 63 </head> |
64 <body onload="runTest()"> | 64 <body onload="runTest()"> |
65 <p>Test that each agent could be enabled/disabled separately.</p> | 65 <p>Test that each agent could be enabled/disabled separately.</p> |
66 </body> | 66 </body> |
67 </html> | 67 </html> |
OLD | NEW |