Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / elements / elements-panel-search.html
index 7891d5c..bffbc5b 100644 (file)
@@ -3,20 +3,29 @@
 <head>
 <script src="../../http/tests/inspector/inspector-test.js"></script>
 <script>
+function initializeShadowDOM()
+{
+    var shadow = document.querySelector('#shadow-host').createShadowRoot();
+    var template = document.querySelector('#shadow-dom-template');
+
+    // Avoid matching this function
+    shadow.appendChild(template.content.cloneNode(true));
+}
+
 function test()
 {
-    WebInspector.showPanel("elements");
+    WebInspector.inspectorView.showPanel("elements");
 
     function searchCallback(next, resultCount)
     {
         if (resultCount == 0) {
             InspectorTest.addResult("Nothing found");
-            WebInspector.domAgent.cancelSearch();
+            WebInspector.domModel.cancelSearch();
             next();
         }
 
         for (var i = 0; i < resultCount; ++i)
-            WebInspector.domAgent.searchResult(i, searchResultCallback.bind(this, i + 1 === resultCount));
+            WebInspector.domModel.searchResult(i, searchResultCallback.bind(this, i + 1 === resultCount));
 
         function searchResultCallback(isLastItem, node)
         {
@@ -27,101 +36,128 @@ function test()
         {
             InspectorTest.addResult(markupVa_lue.split("").join(" "));
             if (isLastItem) {
-                WebInspector.domAgent.cancelSearch();
+                WebInspector.domModel.cancelSearch();
                 next();
             }
         }
     }
 
+    function setUp(next)
+    {
+        WebInspector.domModel.requestDocument(step2);
+
+        function step2()
+        {
+            InspectorTest.evaluateInPage("initializeShadowDOM()", next);
+        }
+    }
+
     InspectorTest.runTestSuite([
         function testSetUp(next)
         {
-            WebInspector.domAgent.requestDocument(next);
+            setUp(next);
         },
 
         function testPlainText(next)
         {
-            WebInspector.domAgent.performSearch("Fo" + "o" + "Bar", searchCallback.bind(this, next));
+            WebInspector.domModel.performSearch("Fo" + "o" + "Bar", false, searchCallback.bind(this, next));
         },
 
         function testPartialText(next)
         {
-            WebInspector.domAgent.performSearch("oo" + "Ba", searchCallback.bind(this, next));
+            WebInspector.domModel.performSearch("oo" + "Ba", false, searchCallback.bind(this, next));
         },
 
         function testStartTag(next)
         {
-            WebInspector.domAgent.performSearch("<inpu" + "t", searchCallback.bind(this, next));
+            WebInspector.domModel.performSearch("<inpu" + "t", false, searchCallback.bind(this, next));
         },
 
         function testEndTag(next)
         {
-            WebInspector.domAgent.performSearch("npu" + "t>", searchCallback.bind(this, next));
+            WebInspector.domModel.performSearch("npu" + "t>", false, searchCallback.bind(this, next));
         },
 
         function testPartialTag(next)
         {
-            WebInspector.domAgent.performSearch("npu" + "t", searchCallback.bind(this, next));
+            WebInspector.domModel.performSearch("npu" + "t", false, searchCallback.bind(this, next));
         },
 
         function testPartialAbsentTagStart(next)
         {
-            WebInspector.domAgent.performSearch("<npu" + "t", searchCallback.bind(this, next));
+            WebInspector.domModel.performSearch("<npu" + "t", false, searchCallback.bind(this, next));
         },
 
         function testPartialAbsentTagEnd(next)
         {
-            WebInspector.domAgent.performSearch("npu" + ">", searchCallback.bind(this, next));
+            WebInspector.domModel.performSearch("npu" + ">", false, searchCallback.bind(this, next));
         },
 
         function testFullTag(next)
         {
-            WebInspector.domAgent.performSearch("<inpu" + "t>", searchCallback.bind(this, next));
+            WebInspector.domModel.performSearch("<inpu" + "t>", false, searchCallback.bind(this, next));
         },
 
         function testExactAttributeName(next)
         {
-            WebInspector.domAgent.performSearch("valu" + "e", searchCallback.bind(this, next));
+            WebInspector.domModel.performSearch("valu" + "e", false, searchCallback.bind(this, next));
         },
 
         function testExactAttributeVal_ue(next)
         {
-            WebInspector.domAgent.performSearch("In" + "putVa" + "l", searchCallback.bind(this, next));
+            WebInspector.domModel.performSearch("In" + "putVa" + "l", false, searchCallback.bind(this, next));
         },
 
         function testExactAttributeVal_ueWithQuotes(next)
         {
-            WebInspector.domAgent.performSearch("\"fo" + "o\"", searchCallback.bind(this, next));
+            WebInspector.domModel.performSearch("\"fo" + "o\"", false, searchCallback.bind(this, next));
         },
 
         function testPartialAttributeVal_ue(next)
         {
-            WebInspector.domAgent.performSearch("n" + "putVa" + "l", searchCallback.bind(this, next));
+            WebInspector.domModel.performSearch("n" + "putVa" + "l", false, searchCallback.bind(this, next));
         },
 
         function testXPathAttribute(next)
         {
-            WebInspector.domAgent.performSearch("//html" + "//@attr", searchCallback.bind(this, next));
+            WebInspector.domModel.performSearch("//html" + "//@attr", false, searchCallback.bind(this, next));
         },
 
         function testSelector(next)
         {
-            WebInspector.domAgent.performSearch("d" + "iv.divclass span", searchCallback.bind(this, next));
+            WebInspector.domModel.performSearch("d" + "iv.divclass span", false, searchCallback.bind(this, next));
         },
 
         function testCaseUpperFindsLower(next)
         {
-            WebInspector.domAgent.performSearch("K" +"OO", searchCallback.bind(this, next));
+            WebInspector.domModel.performSearch("K" +"OO", false, searchCallback.bind(this, next));
         },
 
         function testCaseLowerFindsUpper(next)
         {
-            WebInspector.domAgent.performSearch("c" + "aseless", searchCallback.bind(this, next));
+            WebInspector.domModel.performSearch("c" + "aseless", false, searchCallback.bind(this, next));
         },
 
         function testCaseAttribute(next)
         {
-            WebInspector.domAgent.performSearch("C" + "AMEL", searchCallback.bind(this, next));
+            WebInspector.domModel.performSearch("C" + "AMEL", false, searchCallback.bind(this, next));
+        },
+
+        function testSearchShadowDOM(next)
+        {
+            WebInspector.domModel.performSearch("<c" + "ontent", false, searchCallback.bind(this, next));
+        },
+
+        function testSearchUAShadowDOM(next)
+        {
+            InspectorTest.addResult("Searching UA shadow DOM with setting disabled:")
+            WebInspector.domModel.performSearch("inne" + "r-editor", false, searchCallback.bind(this, step2));
+
+            function step2()
+            {
+                InspectorTest.addResult("Searching UA shadow DOM with setting enabled:")
+                WebInspector.domModel.performSearch("inne" + "r-editor", true, searchCallback.bind(this, next));
+            }
         }
     ]);
 
@@ -142,6 +178,16 @@ Tests that elements panel search is returning proper results.
 <span class="foo koo"></span>
 <span class="CASELESS"></span>
 <span data-camel="insenstive"></span>
+<div id="shadow-host">
+    <div id="shadow-root-content"></div>
+</div>
+<template id="shadow-dom-template">
+  <div id="shadow-dom-outer">
+      <content></content>
+  </div>
+</div>
+</template>
+<textarea></textarea>
 
 </body>
 </html>