| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 | 3 |
| 4 <style type="text/css" media="screen"> | 4 <style type="text/css" media="screen"> |
| 5 #main { background:blue; } | 5 #main { background:blue; } |
| 6 </style> | 6 </style> |
| 7 | 7 |
| 8 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 8 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 9 <script src="../../../http/tests/inspector/elements-test.js"></script> | 9 <script src="../../../http/tests/inspector/elements-test.js"></script> |
| 10 <script> | 10 <script> |
| 11 | 11 |
| 12 function injectStyleSheet() | 12 function injectStyleSheet(context) |
| 13 { | 13 { |
| 14 var styleSheet = "#main { color: red; -webkit-border-image: url(data:image/p
ng;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQVR42r2RsQrDMAxEBR
dl8SDcX8lQPGg1GBI6lvz/h7QyRRXV0qUULwfvwZ1tenw5PxToRPWMC52eA9+WDnlh3HFQ/xBQl86NFY
JqeGflkiogrOvVlIFhqURFVho3x1moGAa3deMs+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs5
4f0sZFUVAMigAAAABJRU5ErkJggg==) } #iframeBody { background: red }"; | 14 var styleSheet = "#main { color: red; -webkit-border-image: url(data:image/p
ng;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQVR42r2RsQrDMAxEBR
dl8SDcX8lQPGg1GBI6lvz/h7QyRRXV0qUULwfvwZ1tenw5PxToRPWMC52eA9+WDnlh3HFQ/xBQl86NFY
JqeGflkiogrOvVlIFhqURFVho3x1moGAa3deMs+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs5
4f0sZFUVAMigAAAABJRU5ErkJggg==) } #iframeBody { background: red }"; |
| 15 if (window.testRunner) | 15 if (context.testRunner) |
| 16 window.testRunner.injectStyleSheet(styleSheet, true); | 16 context.testRunner.insertStyleSheet(styleSheet); |
| 17 } |
| 18 |
| 19 function preRunTest() { |
| 20 injectStyleSheet(window); |
| 21 runTest(); |
| 17 } | 22 } |
| 18 | 23 |
| 19 function loadIframe() | 24 function loadIframe() |
| 20 { | 25 { |
| 21 var iframe = document.createElement("iframe"); | 26 var iframe = document.createElement("iframe"); |
| 22 iframe.src = "resources/inject-stylesheet-iframe-data.html"; | 27 iframe.src = "resources/inject-stylesheet-iframe-data.html"; |
| 23 document.getElementById("main").appendChild(iframe); | 28 document.getElementById("main").appendChild(iframe); |
| 24 } | 29 } |
| 25 | 30 |
| 26 function test() | 31 function test() |
| 27 { | 32 { |
| 28 InspectorTest.evaluateInPage("injectStyleSheet()", init); | 33 InspectorTest.selectNodeAndWaitForStylesWithComputed("main", step0); |
| 29 | |
| 30 function init() | |
| 31 { | |
| 32 InspectorTest.selectNodeAndWaitForStylesWithComputed("main", step0); | |
| 33 } | |
| 34 | 34 |
| 35 function step0() | 35 function step0() |
| 36 { | 36 { |
| 37 InspectorTest.addResult("Main frame style:"); | 37 InspectorTest.addResult("Main frame style:"); |
| 38 InspectorTest.dumpSelectedElementStyles(); | 38 InspectorTest.dumpSelectedElementStyles(); |
| 39 InspectorTest.evaluateInPage("loadIframe()"); | 39 InspectorTest.evaluateInPage("loadIframe()"); |
| 40 InspectorTest.addConsoleSniffer(step1); | 40 InspectorTest.addConsoleSniffer(step1); |
| 41 } | 41 } |
| 42 | 42 |
| 43 function step1() | 43 function step1() |
| 44 { | 44 { |
| 45 InspectorTest.selectNodeAndWaitForStylesWithComputed("iframeBody", step2
); | 45 InspectorTest.selectNodeAndWaitForStylesWithComputed("iframeBody", step2
); |
| 46 } | 46 } |
| 47 | 47 |
| 48 function step2() | 48 function step2() |
| 49 { | 49 { |
| 50 InspectorTest.addResult("iframe style:"); | 50 InspectorTest.addResult("iframe style:"); |
| 51 InspectorTest.dumpSelectedElementStyles(); | 51 InspectorTest.dumpSelectedElementStyles(); |
| 52 InspectorTest.completeTest(); | 52 InspectorTest.completeTest(); |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 </script> | 55 </script> |
| 56 </head> | 56 </head> |
| 57 | 57 |
| 58 <body onload="runTest()"> | 58 <body onload="preRunTest()"> |
| 59 <p> | 59 <p> |
| 60 Tests that injected user stylesheets are reflected in the Styles pane. | 60 Tests that injected user stylesheets are reflected in the Styles pane. |
| 61 </p> | 61 </p> |
| 62 | 62 |
| 63 <div id="main"></div> | 63 <div id="main"></div> |
| 64 </body> | 64 </body> |
| 65 </html> | 65 </html> |
| OLD | NEW |