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 InspectorTest
.nodeWithId("inspected", step1
);
20 var backendCallCount
= 0;
23 function onBackendCall(domain
, method
, params
)
25 if (method
=== "CSS.getComputedStyleForNode" && params
.nodeId
=== nodeId
)
33 InspectorTest
.addSniffer(InspectorBackend
.connection(), "_wrapCallbackAndSendMessageObject", onBackendCall
, true);
34 InspectorTest
.cssModel
.computedStylePromise(nodeId
).then(styleCallback
);
35 InspectorTest
.cssModel
.computedStylePromise(nodeId
).then(styleCallback
);
36 function styleCallback()
40 InspectorTest
.addResult("# of backend calls sent [2 requests]: " + backendCallCount
);
41 InspectorTest
.evaluateInPage("updateStyle()", step2
);
47 InspectorTest
.cssModel
.computedStylePromise(nodeId
).then(callback
);
50 InspectorTest
.addResult("# of backend calls sent [style update + another request]: " + backendCallCount
);
51 InspectorTest
.completeTest();
58 <body onload=
"runTest()">
60 Tests that computed styles are cached across synchronous requests.
64 <div id=
"inspected">Test
</div>