Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / timeline / timeline-receive-response-event.html
index 5d6f852..5e165f2 100644 (file)
@@ -4,7 +4,7 @@
 <script src="../../http/tests/inspector/timeline-test.js"></script>
 <script>
 
-function performActions()
+function performActions(callback)
 {
     var image = new Image();
     image.onload = bar;
@@ -12,7 +12,7 @@ function performActions()
 
     function bar() {
         var image = new Image();
-        image.onload = function() { testRunner.evaluateInWebInspector(0, "window.step2()"); }
+        image.onload = function(event) { callback(); }  // do not pass event argument to the callback.
         image.src = "resources/anotherImage.png";
     }
 }
@@ -20,40 +20,28 @@ function performActions()
 function test()
 {
     WebInspector.inspectorView.showPanel("timeline");
-    WebInspector.panels.timeline._model._collectionEnabled = true;
+    WebInspector.inspectorView.panel("timeline")._model._currentTarget = WebInspector.targetManager.mainTarget();
+    InspectorTest.invokeAsyncWithTimeline("performActions", finish);
 
-    TimelineAgent.start(step1);
-
-    function step1()
-    {
-        InspectorTest.evaluateInPage("performActions()");
-    }
-
-    window.step2 = function()
-    {
-        TimelineAgent.stop(step3);
-    }
-
-    function step3()
+    function finish()
     {
         function dumpFormattedRecord(presentationRecord, prefix)
         {
             var record = presentationRecord.record();
             prefix = prefix || "";
             // Here and below: pretend coalesced record are just not there, as coalescation is time dependent and, hence, not stable.
+            var categoryName = WebInspector.panels.timeline._uiUtils.categoryForRecord(record).name;
+            if (categoryName !== "loading" && categoryName !== "scripting")
+                return;
             if (!presentationRecord.coalesced() && record.type() !== "GCEvent")
                 InspectorTest.addResult(prefix + record.type());
             // Ignore stray paint & rendering events for better stability.
-            if (record.category().name !== "loading" && record.category().name !== "scripting")
-                return;
             if (presentationRecord.presentationChildren()) {
                 var childPrefix = prefix + (presentationRecord.coalesced() ? "" : "    ");
                 for (var i = 0; i < presentationRecord.presentationChildren().length; ++i)
                     dumpFormattedRecord(presentationRecord.presentationChildren()[i], childPrefix);
             }
         }
-        WebInspector.panels.timeline._model._collectionEnabled = false;
-
         var records = WebInspector.panels.timeline._currentViews[0]._rootRecord().presentationChildren();
         for (var i = 0; i < records.length; ++i)
             dumpFormattedRecord(records[i]);