Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / agents-enable-disable.html
blob9f6a9705993c6fffb2bef99906aaef49365e5c04
1 <html>
2 <head>
3 <script src="../http/tests/inspector/inspector-test.js"></script>
4 <script type="text/javascript">
5 function test()
7 var requestsSent = 0;
8 var responsesReceived = 0;
10 function finishWhenDone(agentName, action, errorString)
12 if (action === "enable")
13 InspectorTest.addResult("");
14 if (errorString)
15 InspectorTest.addResult(agentName + "." + action + " finished with error " + errorString);
16 else
17 InspectorTest.addResult(agentName + "." + action + " finished successfully");
19 ++responsesReceived;
20 if (responsesReceived === requestsSent)
21 InspectorTest.completeTest();
24 var targets = WebInspector.targetManager.targets();
25 targets.forEach(function(target) {
26 var agentNames = Object.keys(target._agentsMap).filter(function(agentName) {
27 var agent = target._agentsMap[agentName];
28 return agent["enable"] && agent["disable"] && agentName !== "ServiceWorker" && agentName !== "Security"; // async wrt others.
29 }).sort();
31 function disableAgent(agentName)
33 ++requestsSent;
34 var agent = target._agentsMap[agentName];
35 if (agent._promisified) {
36 agent.disable(finishWhenDone.bind(null, agentName, "disable"))
37 .catch(finishWhenDone.bind(null, agentName, "disable"));
38 } else {
39 agent.disable(finishWhenDone.bind(null, agentName, "disable"));
43 function enableAgent(agentName)
45 ++requestsSent;
46 var agent = target._agentsMap[agentName];
47 if (agent._promisified) {
48 agent.enable(finishWhenDone.bind(null, agentName, "enable"))
49 .catch(finishWhenDone.bind(null, agentName, "enable"));
50 } else {
51 agent.enable(finishWhenDone.bind(null, agentName, "enable"));
55 agentNames.forEach(disableAgent);
57 agentNames.forEach(function(agentName) {
58 enableAgent(agentName);
59 disableAgent(agentName);
60 });
61 });
64 </script>
65 </head>
66 <body onload="runTest()">
67 <p>Test that each agent could be enabled/disabled separately.</p>
68 </body>
69 </html>