Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: LayoutTests/inspector/agents-enable-disable.html

Issue 653263004: DevTools: CSSAgent::enable should report an error if DOM agent hasn't been enabled (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: comments addressed Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/inspector/agents-enable-disable.html
diff --git a/LayoutTests/inspector/agents-enable-disable.html b/LayoutTests/inspector/agents-enable-disable.html
new file mode 100644
index 0000000000000000000000000000000000000000..ca6e49d277723d57b8d5571bcc5ec3bf8973ddd6
--- /dev/null
+++ b/LayoutTests/inspector/agents-enable-disable.html
@@ -0,0 +1,60 @@
+<html>
+<head>
+<script src="../http/tests/inspector/inspector-test.js"></script>
+<script type="text/javascript">
+
+var test = function()
+{
+ var requestsSent = 0;
+ var responsesReceived = 0;
+
+ InspectorTest.startDumpingProtocolMessages();
+
+ function finishWhenDone(agentName, action, errorString)
+ {
+ if (action === "enable")
+ InspectorTest.addResult("");
+ if (errorString)
+ InspectorTest.addResult(agentName + "." + action + " finished with error " + errorString);
+ else
+ InspectorTest.addResult(agentName + "." + action + " finished successfully");
+
+ ++responsesReceived;
+ if (responsesReceived === requestsSent)
+ InspectorTest.completeTest();
+ }
+
+ var targets = WebInspector.targetManager.targets();
+ targets.forEach(function(target) {
yurys 2014/10/15 14:12:37 style: { should go on the next line. Here and belo
+ var agentNames = Object.keys(target._agentsMap).filter(function(agentName) {
+ var agent = target._agentsMap[agentName];
+ return agent["enable"] && agent["disable"];
+ }).sort();
+
+ function disableAgent(agentName)
+ {
+ ++requestsSent;
+ target._agentsMap[agentName].disable(finishWhenDone.bind(null, agentName, "disable"));
+ }
+
+ function enableAgent(agentName)
+ {
+ ++requestsSent;
+ target._agentsMap[agentName].enable(finishWhenDone.bind(null, agentName, "enable"));
+ }
+
+ agentNames.forEach(disableAgent);
+
+ agentNames.forEach(function(agentName) {
+ enableAgent(agentName);
+ disableAgent(agentName);
+ });
+ });
+}
+
+</script>
+</head>
+<body onload="runTest()">
+<p>Test that each agent could be enabled/disabled separately.</p>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698