Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script type="text/javascript"> | |
| 5 | |
| 6 var test = function() | |
| 7 { | |
| 8 var requestsSent = 0; | |
| 9 var responsesReceived = 0; | |
| 10 | |
| 11 InspectorTest.startDumpingProtocolMessages(); | |
| 12 | |
| 13 function finishWhenDone(agentName, action, errorString) | |
| 14 { | |
| 15 if (action === "enable") | |
| 16 InspectorTest.addResult(""); | |
| 17 if (errorString) | |
| 18 InspectorTest.addResult(agentName + "." + action + " finished with e rror " + errorString); | |
| 19 else | |
| 20 InspectorTest.addResult(agentName + "." + action + " finished succes sfully"); | |
| 21 | |
| 22 ++responsesReceived; | |
| 23 if (responsesReceived === requestsSent) | |
| 24 InspectorTest.completeTest(); | |
| 25 } | |
| 26 | |
| 27 var targets = WebInspector.targetManager.targets(); | |
| 28 targets.forEach(function(target) { | |
|
yurys
2014/10/15 14:12:37
style: { should go on the next line. Here and belo
| |
| 29 var agentNames = Object.keys(target._agentsMap).filter(function(agentNam e) { | |
| 30 var agent = target._agentsMap[agentName]; | |
| 31 return agent["enable"] && agent["disable"]; | |
| 32 }).sort(); | |
| 33 | |
| 34 function disableAgent(agentName) | |
| 35 { | |
| 36 ++requestsSent; | |
| 37 target._agentsMap[agentName].disable(finishWhenDone.bind(null, agent Name, "disable")); | |
| 38 } | |
| 39 | |
| 40 function enableAgent(agentName) | |
| 41 { | |
| 42 ++requestsSent; | |
| 43 target._agentsMap[agentName].enable(finishWhenDone.bind(null, agentN ame, "enable")); | |
| 44 } | |
| 45 | |
| 46 agentNames.forEach(disableAgent); | |
| 47 | |
| 48 agentNames.forEach(function(agentName) { | |
| 49 enableAgent(agentName); | |
| 50 disableAgent(agentName); | |
| 51 }); | |
| 52 }); | |
| 53 } | |
| 54 | |
| 55 </script> | |
| 56 </head> | |
| 57 <body onload="runTest()"> | |
| 58 <p>Test that each agent could be enabled/disabled separately.</p> | |
| 59 </body> | |
| 60 </html> | |
| OLD | NEW |