5 background-color: green;
8 <script src="../../http/tests/inspector/inspector-test.js"></script>
9 <script src="../../http/tests/inspector/elements-test.js"></script>
12 function updateStyle()
14 document.getElementById("style").textContent = "#inspected { color: red }";
19 WebInspector.showPanel("elements");
20 InspectorTest.nodeWithId("inspected", step1);
21 var backendCallCount = 0;
24 setTimeout(InspectorTest.completeTest.bind(InspectorTest), 3000);
25 function onBackendCall(method)
27 if (method === "CSS.getComputedStyleForNode")
35 InspectorTest.addSniffer(InspectorBackendClass.prototype, "_wrapCallbackAndSendMessageObject", onBackendCall, true);
36 WebInspector.cssModel.getComputedStyleAsync(nodeId, styleCallback);
37 WebInspector.cssModel.getComputedStyleAsync(nodeId, styleCallback);
38 function styleCallback()
42 InspectorTest.addResult("# of backend calls sent [2 requests]: " + backendCallCount);
43 InspectorTest.evaluateInPage("updateStyle()", step2);
49 WebInspector.cssModel.getComputedStyleAsync(nodeId, callback);
52 InspectorTest.addResult("# of backend calls sent [style update + another request]: " + backendCallCount);
53 InspectorTest.completeTest();
60 <body onload="runTest()">
62 Tests that computed styles are cached across synchronous requests.
66 <div id="inspected">Test</div>