| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.or
g/TR/html4/loose.dtd"> | 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.or
g/TR/html4/loose.dtd"> |
| 2 <html id="documentElement"> | 2 <html id="documentElement"> |
| 3 <head> | 3 <head> |
| 4 <script src="../../http/tests/inspector/inspector-test.js"></script> | 4 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 function initializeShadowDOM() | 6 function initializeShadowDOM() |
| 7 { | 7 { |
| 8 var shadow = document.querySelector('#shadow-host').createShadowRoot(); | 8 var shadow = document.querySelector('#shadow-host').createShadowRoot(); |
| 9 var template = document.querySelector('#shadow-dom-template'); | 9 var template = document.querySelector('#shadow-dom-template'); |
| 10 | 10 |
| 11 // Avoid matching this function | 11 // Avoid matching this function |
| 12 shadow.appendChild(template.content.cloneNode(true)); | 12 shadow.appendChild(template.content.cloneNode(true)); |
| 13 } | 13 } |
| 14 | 14 |
| 15 function test() | 15 function test() |
| 16 { | 16 { |
| 17 var omitInnerHTML; | 17 var omitInnerHTML; |
| 18 | 18 |
| 19 function searchCallback(next, resultCount) | 19 function searchCallback(next, resultCount) |
| 20 { | 20 { |
| 21 if (resultCount == 0) { | 21 if (resultCount == 0) { |
| 22 InspectorTest.addResult("Nothing found"); | 22 InspectorTest.addResult("Nothing found"); |
| 23 WebInspector.domModel.cancelSearch(); | 23 InspectorTest.domModel.cancelSearch(); |
| 24 next(); | 24 next(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 for (var i = 0; i < resultCount; ++i) | 27 for (var i = 0; i < resultCount; ++i) |
| 28 WebInspector.domModel.searchResult(i, searchResultCallback.bind(this
, i + 1 === resultCount)); | 28 InspectorTest.domModel.searchResult(i, searchResultCallback.bind(thi
s, i + 1 === resultCount)); |
| 29 | 29 |
| 30 function searchResultCallback(isLastItem, node) | 30 function searchResultCallback(isLastItem, node) |
| 31 { | 31 { |
| 32 node.getOuterHTML(addSearchResult.bind(this, isLastItem)); | 32 node.getOuterHTML(addSearchResult.bind(this, isLastItem)); |
| 33 } | 33 } |
| 34 | 34 |
| 35 function addSearchResult(isLastItem, error, markupVa_lue) | 35 function addSearchResult(isLastItem, error, markupVa_lue) |
| 36 { | 36 { |
| 37 if (omitInnerHTML) | 37 if (omitInnerHTML) |
| 38 markupVa_lue = markupVa_lue.substr(0, markupVa_lue.indexOf(">")
+ 1); | 38 markupVa_lue = markupVa_lue.substr(0, markupVa_lue.indexOf(">")
+ 1); |
| 39 InspectorTest.addResult(markupVa_lue.split("").join(" ")); | 39 InspectorTest.addResult(markupVa_lue.split("").join(" ")); |
| 40 if (isLastItem) { | 40 if (isLastItem) { |
| 41 WebInspector.domModel.cancelSearch(); | 41 InspectorTest.domModel.cancelSearch(); |
| 42 next(); | 42 next(); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 function setUp(next) | 47 function setUp(next) |
| 48 { | 48 { |
| 49 WebInspector.domModel.requestDocument(step2); | 49 InspectorTest.domModel.requestDocument(step2); |
| 50 | 50 |
| 51 function step2() | 51 function step2() |
| 52 { | 52 { |
| 53 InspectorTest.evaluateInPage("initializeShadowDOM()", next); | 53 InspectorTest.evaluateInPage("initializeShadowDOM()", next); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 InspectorTest.runTestSuite([ | 57 InspectorTest.runTestSuite([ |
| 58 function testSetUp(next) | 58 function testSetUp(next) |
| 59 { | 59 { |
| 60 setUp(next); | 60 setUp(next); |
| 61 }, | 61 }, |
| 62 | 62 |
| 63 function testPlainText(next) | 63 function testPlainText(next) |
| 64 { | 64 { |
| 65 WebInspector.domModel.performSearch("Fo" + "o" + "Bar", false, searc
hCallback.bind(this, next)); | 65 InspectorTest.domModel.performSearch("Fo" + "o" + "Bar", false, sear
chCallback.bind(this, next)); |
| 66 }, | 66 }, |
| 67 | 67 |
| 68 function testPartialText(next) | 68 function testPartialText(next) |
| 69 { | 69 { |
| 70 WebInspector.domModel.performSearch("oo" + "Ba", false, searchCallba
ck.bind(this, next)); | 70 InspectorTest.domModel.performSearch("oo" + "Ba", false, searchCallb
ack.bind(this, next)); |
| 71 }, | 71 }, |
| 72 | 72 |
| 73 function testStartTag(next) | 73 function testStartTag(next) |
| 74 { | 74 { |
| 75 WebInspector.domModel.performSearch("<inpu" + "t", false, searchCall
back.bind(this, next)); | 75 InspectorTest.domModel.performSearch("<inpu" + "t", false, searchCal
lback.bind(this, next)); |
| 76 }, | 76 }, |
| 77 | 77 |
| 78 function testEndTag(next) | 78 function testEndTag(next) |
| 79 { | 79 { |
| 80 WebInspector.domModel.performSearch("npu" + "t>", false, searchCallb
ack.bind(this, next)); | 80 InspectorTest.domModel.performSearch("npu" + "t>", false, searchCall
back.bind(this, next)); |
| 81 }, | 81 }, |
| 82 | 82 |
| 83 function testPartialTag(next) | 83 function testPartialTag(next) |
| 84 { | 84 { |
| 85 WebInspector.domModel.performSearch("npu" + "t", false, searchCallba
ck.bind(this, next)); | 85 InspectorTest.domModel.performSearch("npu" + "t", false, searchCallb
ack.bind(this, next)); |
| 86 }, | 86 }, |
| 87 | 87 |
| 88 function testPartialAbsentTagStart(next) | 88 function testPartialAbsentTagStart(next) |
| 89 { | 89 { |
| 90 WebInspector.domModel.performSearch("<npu" + "t", false, searchCallb
ack.bind(this, next)); | 90 InspectorTest.domModel.performSearch("<npu" + "t", false, searchCall
back.bind(this, next)); |
| 91 }, | 91 }, |
| 92 | 92 |
| 93 function testPartialAbsentTagEnd(next) | 93 function testPartialAbsentTagEnd(next) |
| 94 { | 94 { |
| 95 WebInspector.domModel.performSearch("npu" + ">", false, searchCallba
ck.bind(this, next)); | 95 InspectorTest.domModel.performSearch("npu" + ">", false, searchCallb
ack.bind(this, next)); |
| 96 }, | 96 }, |
| 97 | 97 |
| 98 function testFullTag(next) | 98 function testFullTag(next) |
| 99 { | 99 { |
| 100 WebInspector.domModel.performSearch("<inpu" + "t>", false, searchCal
lback.bind(this, next)); | 100 InspectorTest.domModel.performSearch("<inpu" + "t>", false, searchCa
llback.bind(this, next)); |
| 101 }, | 101 }, |
| 102 | 102 |
| 103 function testExactAttributeName(next) | 103 function testExactAttributeName(next) |
| 104 { | 104 { |
| 105 WebInspector.domModel.performSearch("valu" + "e", false, searchCallb
ack.bind(this, next)); | 105 InspectorTest.domModel.performSearch("valu" + "e", false, searchCall
back.bind(this, next)); |
| 106 }, | 106 }, |
| 107 | 107 |
| 108 function testExactAttributeVal_ue(next) | 108 function testExactAttributeVal_ue(next) |
| 109 { | 109 { |
| 110 WebInspector.domModel.performSearch("In" + "putVa" + "l", false, sea
rchCallback.bind(this, next)); | 110 InspectorTest.domModel.performSearch("In" + "putVa" + "l", false, se
archCallback.bind(this, next)); |
| 111 }, | 111 }, |
| 112 | 112 |
| 113 function testExactAttributeVal_ueOnRoot(next) | 113 function testExactAttributeVal_ueOnRoot(next) |
| 114 { | 114 { |
| 115 omitInnerHTML = true; | 115 omitInnerHTML = true; |
| 116 WebInspector.domModel.performSearch("documen" + "tElement", false, s
earchCallback.bind(this, next)); | 116 InspectorTest.domModel.performSearch("documen" + "tElement", false,
searchCallback.bind(this, next)); |
| 117 }, | 117 }, |
| 118 | 118 |
| 119 function testExactAttributeVal_ueWithQuotes(next) | 119 function testExactAttributeVal_ueWithQuotes(next) |
| 120 { | 120 { |
| 121 omitInnerHTML = false; | 121 omitInnerHTML = false; |
| 122 WebInspector.domModel.performSearch("\"fo" + "o\"", false, searchCal
lback.bind(this, next)); | 122 InspectorTest.domModel.performSearch("\"fo" + "o\"", false, searchCa
llback.bind(this, next)); |
| 123 }, | 123 }, |
| 124 | 124 |
| 125 function testPartialAttributeVal_ue(next) | 125 function testPartialAttributeVal_ue(next) |
| 126 { | 126 { |
| 127 WebInspector.domModel.performSearch("n" + "putVa" + "l", false, sear
chCallback.bind(this, next)); | 127 InspectorTest.domModel.performSearch("n" + "putVa" + "l", false, sea
rchCallback.bind(this, next)); |
| 128 }, | 128 }, |
| 129 | 129 |
| 130 function testXPathAttribute(next) | 130 function testXPathAttribute(next) |
| 131 { | 131 { |
| 132 WebInspector.domModel.performSearch("//html" + "//@attr", false, sea
rchCallback.bind(this, next)); | 132 InspectorTest.domModel.performSearch("//html" + "//@attr", false, se
archCallback.bind(this, next)); |
| 133 }, | 133 }, |
| 134 | 134 |
| 135 function testSelector(next) | 135 function testSelector(next) |
| 136 { | 136 { |
| 137 WebInspector.domModel.performSearch("d" + "iv.divclass span", false,
searchCallback.bind(this, next)); | 137 InspectorTest.domModel.performSearch("d" + "iv.divclass span", false
, searchCallback.bind(this, next)); |
| 138 }, | 138 }, |
| 139 | 139 |
| 140 function testCaseUpperFindsLower(next) | 140 function testCaseUpperFindsLower(next) |
| 141 { | 141 { |
| 142 WebInspector.domModel.performSearch("K" +"OO", false, searchCallback
.bind(this, next)); | 142 InspectorTest.domModel.performSearch("K" +"OO", false, searchCallbac
k.bind(this, next)); |
| 143 }, | 143 }, |
| 144 | 144 |
| 145 function testCaseLowerFindsUpper(next) | 145 function testCaseLowerFindsUpper(next) |
| 146 { | 146 { |
| 147 WebInspector.domModel.performSearch("c" + "aseless", false, searchCa
llback.bind(this, next)); | 147 InspectorTest.domModel.performSearch("c" + "aseless", false, searchC
allback.bind(this, next)); |
| 148 }, | 148 }, |
| 149 | 149 |
| 150 function testCaseAttribute(next) | 150 function testCaseAttribute(next) |
| 151 { | 151 { |
| 152 WebInspector.domModel.performSearch("C" + "AMEL", false, searchCallb
ack.bind(this, next)); | 152 InspectorTest.domModel.performSearch("C" + "AMEL", false, searchCall
back.bind(this, next)); |
| 153 }, | 153 }, |
| 154 | 154 |
| 155 function testSearchShadowDOM(next) | 155 function testSearchShadowDOM(next) |
| 156 { | 156 { |
| 157 WebInspector.domModel.performSearch("<c" + "ontent", false, searchCa
llback.bind(this, next)); | 157 InspectorTest.domModel.performSearch("<c" + "ontent", false, searchC
allback.bind(this, next)); |
| 158 }, | 158 }, |
| 159 | 159 |
| 160 function testSearchUAShadowDOM(next) | 160 function testSearchUAShadowDOM(next) |
| 161 { | 161 { |
| 162 InspectorTest.addResult("Searching UA shadow DOM with setting disabl
ed:") | 162 InspectorTest.addResult("Searching UA shadow DOM with setting disabl
ed:") |
| 163 WebInspector.domModel.performSearch("inne" + "r-editor", false, sear
chCallback.bind(this, step2)); | 163 InspectorTest.domModel.performSearch("inne" + "r-editor", false, sea
rchCallback.bind(this, step2)); |
| 164 | 164 |
| 165 function step2() | 165 function step2() |
| 166 { | 166 { |
| 167 InspectorTest.addResult("Searching UA shadow DOM with setting en
abled:") | 167 InspectorTest.addResult("Searching UA shadow DOM with setting en
abled:") |
| 168 WebInspector.domModel.performSearch("inne" + "r-editor", true, s
earchCallback.bind(this, next)); | 168 InspectorTest.domModel.performSearch("inne" + "r-editor", true,
searchCallback.bind(this, next)); |
| 169 } | 169 } |
| 170 }, | 170 }, |
| 171 | 171 |
| 172 function testSearchShadowHostChildren(next) | 172 function testSearchShadowHostChildren(next) |
| 173 { | 173 { |
| 174 WebInspector.domModel.performSearch("shadow-host-c" + "ontent", fals
e, searchCallback.bind(this, next)); | 174 InspectorTest.domModel.performSearch("shadow-host-c" + "ontent", fal
se, searchCallback.bind(this, next)); |
| 175 }, | 175 }, |
| 176 ]); | 176 ]); |
| 177 | 177 |
| 178 } | 178 } |
| 179 </script> | 179 </script> |
| 180 </head> | 180 </head> |
| 181 | 181 |
| 182 <body onload="runTest()"> | 182 <body onload="runTest()"> |
| 183 <p> | 183 <p> |
| 184 Tests that elements panel search is returning proper results. | 184 Tests that elements panel search is returning proper results. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 198 <template id="shadow-dom-template"> | 198 <template id="shadow-dom-template"> |
| 199 <div id="shadow-dom-outer"> | 199 <div id="shadow-dom-outer"> |
| 200 <content></content> | 200 <content></content> |
| 201 </div> | 201 </div> |
| 202 </div> | 202 </div> |
| 203 </template> | 203 </template> |
| 204 <textarea></textarea> | 204 <textarea></textarea> |
| 205 | 205 |
| 206 </body> | 206 </body> |
| 207 </html> | 207 </html> |
| OLD | NEW |