Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / inspector-enabled / reattach-after-editing-styles.html
index 10b2012..112cc50 100644 (file)
@@ -7,12 +7,10 @@
 
 function reopenWebInspector(objectId)
 {
-    saveOutput();
     window.didReopen = 1;
     testRunner.closeWebInspector();
     setTimeout(function() {
       testRunner.showWebInspector();
-      restoreOutput();
       runTest();
     }, 0);
 }
@@ -46,9 +44,9 @@ function test()
     function testFirstOpen()
     {
         InspectorTest.addResult("Dump initial styles:");
-        dump(step2);
-        
-        function step2()
+        dump(onStylesDumped);
+
+        function onStylesDumped()
         {
             treeElement = InspectorTest.getMatchedStylePropertyTreeItem("color");
             treeElement.startEditing();
@@ -59,14 +57,29 @@ function test()
             treeElement.valueElement.textContent = "green";
             treeElement.valueElement.firstChild.select();
             treeElement.valueElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
-            InspectorTest.runAfterPendingDispatches(step3);
+            InspectorTest.waitForStyleApplied(onPropertyEdited);
         }
 
-        function step3()
+        function onPropertyEdited()
+        {
+            InspectorTest.addNewRule("#testDiv, my-custom-tag", onFirstRuleAdded);
+        }
+
+        function onFirstRuleAdded()
+        {
+            InspectorTest.addNewRule("#testDiv, another-custom-tag", onSecondRuleAdded);
+        }
+
+        function onSecondRuleAdded()
+        {
+            WebInspector.domModel.undo(onRuleRemoved);
+        }
+
+        function onRuleRemoved()
         {
             InspectorTest.selectNodeAndWaitForStyles("other", step4);
         }
-        
+
         function step4()
         {
             InspectorTest.addResult("Dump styles after editing:");
@@ -76,13 +89,14 @@ function test()
 
     function reopenInspector()
     {
+        InspectorTest.flushResults();
         InspectorTest.evaluateInPage("reopenWebInspector()");
     }
 
     function dump(callback)
     {
         InspectorTest.selectNodeAndWaitForStyles("testDiv", step2);
-        
+
         function step2()
         {
             InspectorTest.dumpSelectedElementStyles(true);