Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <html> | |
| 2 <head> | |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource s/protocol-test.js"></script> | |
| 4 <script type="text/javascript" src="css-protocol-test.js"></script> | |
| 5 <link rel="stylesheet" type="text/css" href="resources/stylesheet.css"></link> | |
| 6 <script type="text/javascript"> | |
| 7 function test() | |
| 8 { | |
| 9 var frameId; | |
| 10 var styleSheetHeader; | |
| 11 | |
| 12 setTimeout(InspectorTest.completeTest.bind(InspectorTest), 2000); | |
|
lushnikov
2014/03/03 12:43:09
1. not needed
2. bad indentation
| |
| 13 | |
| 14 InspectorTest.requestMainFrameId(step2); | |
| 15 | |
| 16 function step2(mainFrameId) | |
| 17 { | |
| 18 frameId = mainFrameId; | |
| 19 InspectorTest.eventHandler["CSS.styleSheetAdded"] = styleSheetAdded; | |
| 20 InspectorTest.sendCSSCommand("enable", {}, function() {}) | |
| 21 } | |
| 22 | |
| 23 function styleSheetAdded(response) | |
| 24 { | |
| 25 var header = response.params.header; | |
| 26 var urlString = header.sourceURL ? " (" + InspectorTest.displayName(head er.sourceURL) + ")" : ""; | |
| 27 InspectorTest.log("Style sheet added: " + header.origin + urlString); | |
| 28 if (styleSheetHeader) | |
| 29 return; | |
|
lushnikov
2014/03/03 12:43:09
don't we want to die here?
InspectorTest.log("Err
| |
| 30 | |
| 31 styleSheetHeader = header; | |
| 32 InspectorTest.loadAndDumpMatchingRules("#inspected", step3); | |
| 33 } | |
| 34 | |
| 35 function step3() | |
| 36 { | |
| 37 InspectorTest.log("Adding a rule to the existing stylesheet."); | |
|
lushnikov
2014/03/03 12:43:09
FYI: there's a InspectorTest.runTestSuite method w
| |
| 38 InspectorTest.sendCSSCommand("addRule", { styleSheetId: styleSheetHeader .styleSheetId, selector: "#inspected" }, step4); | |
| 39 } | |
| 40 | |
| 41 function step4() | |
| 42 { | |
| 43 InspectorTest.loadAndDumpMatchingRules("#inspected", step5); | |
| 44 } | |
| 45 | |
| 46 function step5() | |
| 47 { | |
| 48 InspectorTest.log("Creating inspector stylesheet."); | |
| 49 InspectorTest.sendCSSCommand("createStyleSheet", { frameId: frameId }, s tep6); | |
| 50 } | |
| 51 | |
| 52 function step6(result) | |
| 53 { | |
| 54 InspectorTest.log("Adding a rule to the inspector stylesheet."); | |
| 55 InspectorTest.sendCSSCommand("addRule", { styleSheetId: result.styleShee tId, selector: "#inspected" }, step7); | |
| 56 } | |
| 57 | |
| 58 function step7() | |
| 59 { | |
| 60 InspectorTest.loadAndDumpMatchingRules("#inspected", step8); | |
| 61 } | |
| 62 | |
| 63 function step8() | |
| 64 { | |
| 65 InspectorTest.completeTest(); | |
| 66 } | |
| 67 }; | |
| 68 | |
| 69 window.addEventListener("DOMContentLoaded", function () { | |
| 70 runTest(); | |
| 71 }, false); | |
| 72 | |
| 73 </script> | |
| 74 </head> | |
| 75 <body> | |
| 76 <div id="inspected">Inspected contents</div> | |
| 77 </body> | |
| 78 </html> | |
| OLD | NEW |