Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / timeline / timeline-node-reference.html
index dee907c..7cd8d67 100644 (file)
@@ -20,32 +20,36 @@ function performActions()
 
 function test()
 {
+    // Force panel load.
+    WebInspector.panel("elements");
+
     InspectorTest.evaluateInPage("var unused = document.body.offsetWidth; testRunner.display();", function() {
          InspectorTest.evaluateWithTimeline("performActions()", onTimelineRecorded);
     });
-    function getPopoverRow(record, row, callback)
+
+    function clickValueLink(record, row)
     {
-        var helper = record.generatePopupContent(onPopupContentReady);
-        function onPopupContentReady(popover)
+        var helper = record.generatePopupContent(onDetailsContentReady);
+
+        function onDetailsContentReady(element)
         {
-            // Temporarily attach popover so that document.evaluate() works
-            document.body.appendChild(popover);
-            var result = document.evaluate("//table/tr/td[position()=1 and text()='" + row.escapeCharacters("\"\'") + "']/following-sibling::td/child::*", popover, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
-            popover.remove();
-            callback(result.singleNodeValue);
+            var rows = element.querySelectorAll(".timeline-details-view-row");
+            for (var i = 0; i < rows.length; ++i) {
+                if (rows[i].firstChild.textContent.indexOf(row) !== -1) {
+                    rows[i].lastChild.firstChild.click();
+                    return;
+                }
+            }
         }
     }
+
     function onTimelineRecorded(records)
     {
         var layoutRecord = InspectorTest.findPresentationRecord("Layout");
-        WebInspector.notifications.addEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, onSelectedNodeChanged);
-        getPopoverRow(layoutRecord, "Layout root", clickOnLink);
-
-        function clickOnLink(link)
-        {
-            link.click();
-        }
+        WebInspector.notifications.addEventListener(WebInspector.NotificationService.Events.SelectedNodeChanged, onSelectedNodeChanged);
+        clickValueLink(layoutRecord, "Layout root");
     }
+
     function onSelectedNodeChanged()
     {
         // avoid using WebInspector.panel("elements"), as we get first event from constructor,
@@ -54,7 +58,7 @@ function test()
         // We may first get an old selected node while switching to the Elements panel.
         if (node.nodeName() === "BODY")
             return;
-        WebInspector.notifications.removeEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, onSelectedNodeChanged);
+        WebInspector.notifications.removeEventListener(WebInspector.NotificationService.Events.SelectedNodeChanged, onSelectedNodeChanged);
         InspectorTest.addResult("Layout root node id: " + node.getAttribute("id"));
         InspectorTest.completeTest();
     }