Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / inspector / elements-test.js
index 79522d2..4aee99b 100644 (file)
@@ -756,20 +756,26 @@ InspectorTest.matchingSelectors = function(rule)
     return "[" + selectors.join(", ") + "]";
 }
 
+InspectorTest.addNewRuleInStyleSheet = function(styleSheetHeader, selector, callback)
+{
+    InspectorTest.addSniffer(WebInspector.StylesSidebarPane.prototype, "_addBlankSection", onBlankSection.bind(null, selector, callback));
+    WebInspector.panels.elements.sidebarPanes.styles._createNewRuleInStyleSheet(styleSheetHeader);
+}
+
 InspectorTest.addNewRule = function(selector, callback)
 {
     // Click "Add new rule".
     document.getElementById("add-style-button-test-id").click();
-    InspectorTest.addSniffer(WebInspector.StylesSidebarPane.prototype, "_addBlankSection", onBlankSection);
+    InspectorTest.addSniffer(WebInspector.StylesSidebarPane.prototype, "_addBlankSection", onBlankSection.bind(null, selector, callback));
+}
 
-    function onBlankSection()
-    {
-        var section = WebInspector.panels.elements.sidebarPanes.styles.sections[0][2];
-        if (typeof selector === "string")
-            section._selectorElement.textContent = selector;
-        section._selectorElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
-        InspectorTest.runAfterPendingDispatches(callback.bind(null, section));
-    }
+function onBlankSection(selector, callback)
+{
+    var section = WebInspector.panels.elements.sidebarPanes.styles.sections[0][2];
+    if (typeof selector === "string")
+        section._selectorElement.textContent = selector;
+    section._selectorElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
+    InspectorTest.runAfterPendingDispatches(callback.bind(null, section));
 }
 
 InspectorTest.dumpInspectorHighlight = function(node, callback)