| 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(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 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" && agentName !== "Security"; // 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(finishWhenDone.bind(null, agentName, "disable")) |
| 39 else | 39 .catch(finishWhenDone.bind(null, agentName, "disable")); |
| 40 } else { |
| 40 agent.disable(finishWhenDone.bind(null, agentName, "disable")); | 41 agent.disable(finishWhenDone.bind(null, agentName, "disable")); |
| 42 } |
| 41 } | 43 } |
| 42 | 44 |
| 43 function enableAgent(agentName) | 45 function enableAgent(agentName) |
| 44 { | 46 { |
| 45 ++requestsSent; | 47 ++requestsSent; |
| 46 var agent = target._agentsMap[agentName]; | 48 var agent = target._agentsMap[agentName]; |
| 47 if (agent._promisified) | 49 if (agent._promisified) { |
| 48 agent.enable().then(finishWhenDone.bind(null, agentName, "enable
", null), finishWhenDone.bind(null, agentName, "enable")); | 50 agent.enable(finishWhenDone.bind(null, agentName, "enable")) |
| 49 else | 51 .catch(finishWhenDone.bind(null, agentName, "enable")); |
| 52 } else { |
| 50 agent.enable(finishWhenDone.bind(null, agentName, "enable")); | 53 agent.enable(finishWhenDone.bind(null, agentName, "enable")); |
| 54 } |
| 51 } | 55 } |
| 52 | 56 |
| 53 agentNames.forEach(disableAgent); | 57 agentNames.forEach(disableAgent); |
| 54 | 58 |
| 55 agentNames.forEach(function(agentName) { | 59 agentNames.forEach(function(agentName) { |
| 56 enableAgent(agentName); | 60 enableAgent(agentName); |
| 57 disableAgent(agentName); | 61 disableAgent(agentName); |
| 58 }); | 62 }); |
| 59 }); | 63 }); |
| 60 } | 64 } |
| 61 | 65 |
| 62 </script> | 66 </script> |
| 63 </head> | 67 </head> |
| 64 <body onload="runTest()"> | 68 <body onload="runTest()"> |
| 65 <p>Test that each agent could be enabled/disabled separately.</p> | 69 <p>Test that each agent could be enabled/disabled separately.</p> |
| 66 </body> | 70 </body> |
| 67 </html> | 71 </html> |
| OLD | NEW |