| OLD | NEW |
| 1 (async function(testRunner) { |
| 2 let {page, session, dp} = await testRunner.startHTML(` |
| 1 <html> | 3 <html> |
| 2 <head> | 4 <head> |
| 3 <style> | 5 <style> |
| 4 @font-face { | 6 @font-face { |
| 5 font-family: 'ahem'; | 7 font-family: 'ahem'; |
| 6 src: url(../../resources/Ahem.ttf); | 8 src: url(${testRunner.url('../../resources/Ahem.ttf')}); |
| 7 } | 9 } |
| 8 </style> | 10 </style> |
| 9 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> | |
| 10 <script> | |
| 11 | |
| 12 async function test() { | |
| 13 function stabilize(key, value) { | |
| 14 var unstableKeys = ["documentURL", "baseURL", "frameId"]; | |
| 15 if (unstableKeys.indexOf(key) !== -1) | |
| 16 return "<" + typeof(value) + ">"; | |
| 17 return value; | |
| 18 } | |
| 19 | |
| 20 var whitelist = ["transform", "transform-origin", "height", "width", "displa
y", "outline-color", "color"]; | |
| 21 var response = await InspectorTest.sendCommandOrDie("DOMSnapshot.getSnapshot
", {"computedStyleWhitelist": whitelist}); | |
| 22 InspectorTest.log(JSON.stringify(response, stabilize, 2)); | |
| 23 InspectorTest.completeTest(); | |
| 24 } | |
| 25 | |
| 26 </script> | |
| 27 <template id="shadow-template"> | 11 <template id="shadow-template"> |
| 28 <style> | 12 <style> |
| 29 :host { | 13 :host { |
| 30 color: red; | 14 color: red; |
| 31 } | 15 } |
| 32 </style> | 16 </style> |
| 33 <div style="font-family: ahem;"><h1>Hi!</h1></div> | 17 <div style="font-family: ahem;"><h1>Hi!</h1></div> |
| 34 </template> | 18 </template> |
| 35 </head> | 19 </head> |
| 36 <body class="body-class"> | 20 <body class="body-class"> |
| 37 <div style="font-family: ahem;"> | 21 <div style="font-family: ahem;"> |
| 38 <div class="class1">Some Text</div> And More Text | 22 <div class="class1">Some Text</div> And More Text |
| 39 <div style="display:inline-block; width: 200px"> | 23 <div style="display:inline-block; width: 200px"> |
| 40 <p> | 24 <p> |
| 41 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque si
t amet est sem. | 25 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque si
t amet est sem. |
| 42 Aenean ut neque volutpat, posuere odio at, mollis nibh. Aenean sodales n
ulla et | 26 Aenean ut neque volutpat, posuere odio at, mollis nibh. Aenean sodales n
ulla et |
| 43 ligula efficitur sollicitudin blandit sed lectus. Duis orci enim, sodale
s ac lectus sed, | 27 ligula efficitur sollicitudin blandit sed lectus. Duis orci enim, sodale
s ac lectus sed, |
| 44 hendrerit efficitur est. Quisque gravida facilisis viverra. | 28 hendrerit efficitur est. Quisque gravida facilisis viverra. |
| 45 </p> | 29 </p> |
| 46 <ul class="class3"> | 30 <ul class="class3"> |
| 47 <li class="class4"></li> | 31 <li class="class4"></li> |
| 48 <span>Lets have a span</span> | 32 <span>Lets have a span</span> |
| 49 </ul> | 33 </ul> |
| 50 </div> | 34 </div> |
| 51 <div style="transform: rotateZ(90deg); width: 200px">Rotated text!</div> | 35 <div style="transform: rotateZ(90deg); width: 200px">Rotated text!</div> |
| 52 <iframe src="../dom/resources/simple-iframe.html" width="400" height="200"><
/iframe> | 36 <iframe src='${testRunner.url('../resources/simple-iframe.html')}' width="40
0" height="200"></iframe> |
| 53 <div id="shadow-host"></div> | 37 <div id="shadow-host"></div> |
| 54 <script type="text/javascript"> | |
| 55 var host = document.querySelector("#shadow-host").createShadowRoot(); | |
| 56 var template = document.querySelector("#shadow-template"); | |
| 57 host.appendChild(template.content); | |
| 58 template.remove(); | |
| 59 window.onload = runTest; | |
| 60 </script> | |
| 61 </div> | 38 </div> |
| 62 </body> | 39 </body> |
| 63 </html> | 40 </html> |
| 41 `, 'Tests DOMSnapshot.getSnapshot method.'); |
| 42 |
| 43 await session.evaluate(` |
| 44 var host = document.querySelector('#shadow-host').createShadowRoot(); |
| 45 var template = document.querySelector('#shadow-template'); |
| 46 host.appendChild(template.content); |
| 47 template.remove(); |
| 48 `); |
| 49 |
| 50 function stabilize(key, value) { |
| 51 var unstableKeys = ['documentURL', 'baseURL', 'frameId']; |
| 52 if (unstableKeys.indexOf(key) !== -1) |
| 53 return '<' + typeof(value) + '>'; |
| 54 if (typeof value === 'string' && value.indexOf('/dom-snapshot/') !== -1) |
| 55 value = '<value>'; |
| 56 return value; |
| 57 } |
| 58 |
| 59 var whitelist = ['transform', 'transform-origin', 'height', 'width', 'display'
, 'outline-color', 'color']; |
| 60 var response = await dp.DOMSnapshot.getSnapshot({'computedStyleWhitelist': whi
telist}); |
| 61 if (response.error) |
| 62 testRunner.log(response); |
| 63 else |
| 64 testRunner.log(JSON.stringify(response.result, stabilize, 2)); |
| 65 testRunner.completeTest(); |
| 66 }) |
| 67 |
| OLD | NEW |