| 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 function finishWhenDone(agentName, action, errorString) | 10 function finishWhenDone(agentName, action, errorString) |
| 11 { | 11 { |
| 12 if (action === "enable") | 12 if (action === "enable") |
| 13 InspectorTest.addResult(""); | 13 InspectorTest.addResult(""); |
| 14 if (errorString) | 14 if (errorString) |
| 15 InspectorTest.addResult(agentName + "." + action + " finished with e
rror " + errorString); | 15 InspectorTest.addResult(agentName + "." + action + " finished with e
rror " + errorString); |
| 16 else | 16 else |
| 17 InspectorTest.addResult(agentName + "." + action + " finished succes
sfully"); | 17 InspectorTest.addResult(agentName + "." + action + " finished succes
sfully"); |
| 18 | 18 |
| 19 ++responsesReceived; | 19 ++responsesReceived; |
| 20 if (responsesReceived === requestsSent) | 20 if (responsesReceived === requestsSent) |
| 21 InspectorTest.completeTest(); | 21 InspectorTest.completeTest(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 var targets = WebInspector.targetManager.targets(); | 24 var targets = WebInspector.targetManager.targets(); |
| 25 targets.forEach(function(target) { | 25 targets.forEach(function(target) { |
| 26 var agentNames = Object.keys(target._agentsMap).filter(function(agentNam
e) { | 26 var agentNames = Object.keys(target._agentsMap).filter(function(agentNam
e) { |
| 27 var agent = target._agentsMap[agentName]; | 27 var agent = target._agentsMap[agentName]; |
| 28 return agent["enable"] && agent["disable"] && agentName !== "Service
Worker" && agentName !== "Security" && agentName !== "Inspector"; // async wrt
others. | 28 return agent["enable"] && agent["disable"] && agentName !== "Service
Worker" && agentName !== "Security" && agentName !== "Inspector" && agentName !=
= "Target"; // async wrt others. |
| 29 }).sort(); | 29 }).sort(); |
| 30 | 30 |
| 31 function disableAgent(agentName) | 31 function disableAgent(agentName) |
| 32 { | 32 { |
| 33 ++requestsSent; | 33 ++requestsSent; |
| 34 var agent = target._agentsMap[agentName]; | 34 var agent = target._agentsMap[agentName]; |
| 35 agent.disable(finishWhenDone.bind(null, agentName, "disable")) | 35 agent.disable(finishWhenDone.bind(null, agentName, "disable")) |
| 36 .catch(finishWhenDone.bind(null, agentName, "disable")); | 36 .catch(finishWhenDone.bind(null, agentName, "disable")); |
| 37 } | 37 } |
| 38 | 38 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 52 }); | 52 }); |
| 53 }); | 53 }); |
| 54 } | 54 } |
| 55 | 55 |
| 56 </script> | 56 </script> |
| 57 </head> | 57 </head> |
| 58 <body onload="runTest()"> | 58 <body onload="runTest()"> |
| 59 <p>Test that each agent could be enabled/disabled separately.</p> | 59 <p>Test that each agent could be enabled/disabled separately.</p> |
| 60 </body> | 60 </body> |
| 61 </html> | 61 </html> |
| OLD | NEW |