xpathResult.singleNodeValue.dispatchEvent(click);
}
+InspectorTest.waitForStyleSheetChangedEvent = function(reply)
+{
+ var oldUpdateTimeout = WebInspector.StyleFile.updateTimeout;
+ WebInspector.StyleFile.updateTimeout = 0;
+ InspectorTest.addSniffer(WebInspector.CSSStyleModel.prototype, "_fireStyleSheetChanged", onStyleSheetChanged);
+
+ function onStyleSheetChanged()
+ {
+ WebInspector.StyleFile.updateTimeout = oldUpdateTimeout;
+ reply();
+ }
+}
+
}
function extension_testGetAllResources(nextTest)
});
}
-// Extensions tests override WebInspector.StyleFile.updateTimeout because otherwise extensions don't have any control over applying changes to domain specific bindings.
-function extension_setFakeStyleSheetUpdateTimeout(callback)
-{
- evaluateOnFrontend("WebInspector.oldStyleSheetUpdateTimeout = WebInspector.StyleFile.updateTimeout; WebInspector.StyleFile.updateTimeout = -1; reply();", callback);
-}
-
-function extension_resetStyleSheetUpdateTimeout(callback)
-{
- evaluateOnFrontend("WebInspector.StyleFile.updateTimeout = WebInspector.oldStyleSheetUpdateTimeout; delete WebInspector.oldStyleSheetUpdateTimeout; reply();", callback);
-}
-
function extension_testSetResourceContent(nextTest)
{
- extension_setFakeStyleSheetUpdateTimeout(step2);
+ evaluateOnFrontend("InspectorTest.waitForStyleSheetChangedEvent(reply);", step2);
- function step2()
- {
- extension_runWithResource(/audits-style1\.css$/, function(resource) {
- resource.setContent("div.test { width: 126px; height: 42px; }", false, step3);
- });
- }
+ extension_runWithResource(/audits-style1\.css$/, function(resource) {
+ resource.setContent("div.test { width: 126px; height: 42px; }", false, function() {});
+ });
- function step3()
+ function step2()
{
webInspector.inspectedWindow.eval("document.getElementById('test-div').clientWidth", function(result) {
output("div.test width after stylesheet edited (should be 126): " + result);
- step4();
+ nextTest();
});
}
-
- function step4()
- {
- extension_resetStyleSheetUpdateTimeout(nextTest);
- }
}
function extension_testOnContentCommitted(nextTest)
{
var expected_content = "div.test { width: 220px; height: 42px; }";
- extension_setFakeStyleSheetUpdateTimeout(step2);
-
- function step2()
- {
- webInspector.inspectedWindow.onResourceContentCommitted.addListener(onContentCommitted);
- extension_runWithResource(/audits-style1\.css$/, function(resource) {
- resource.setContent("div.test { width: 140px; height: 42px; }", false);
+ webInspector.inspectedWindow.onResourceContentCommitted.addListener(onContentCommitted);
+ extension_runWithResource(/audits-style1\.css$/, function(resource) {
+ resource.setContent("div.test { width: 140px; height: 42px; }", false);
+ });
+ // The next step is going to produce a console message that will be logged, so synchronize the output now.
+ evaluateOnFrontend("InspectorTest.runAfterPendingDispatches(reply)", function() {
+ extension_runWithResource(/abe\.png$/, function(resource) {
+ resource.setContent("", true);
});
- // The next step is going to produce a console message that will be logged, so synchronize the output now.
- evaluateOnFrontend("InspectorTest.runAfterPendingDispatches(reply)", function() {
- extension_runWithResource(/abe\.png$/, function(resource) {
- resource.setContent("", true);
- });
- extension_runWithResource(/audits-style1\.css$/, function(resource) {
- resource.setContent(expected_content, true);
- });
+ extension_runWithResource(/audits-style1\.css$/, function(resource) {
+ resource.setContent(expected_content, true);
});
- }
+ });
function onContentCommitted(resource, content)
{
webInspector.inspectedWindow.onResourceContentCommitted.removeListener(onContentCommitted);
resource.getContent(function(content) {
output("Revision content: " + content);
- step3();
+ nextTest();
});
}
-
- function step3()
- {
- extension_resetStyleSheetUpdateTimeout(nextTest);
- }
}
function extension_testOnResourceAdded(nextTest)