| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../../http/tests/inspector/elements-test.js"></script> | 4 <script src="../../../http/tests/inspector/elements-test.js"></script> |
| 5 <script src="../../../http/tests/inspector/debugger-test.js"></script> | 5 <script src="../../../http/tests/inspector/debugger-test.js"></script> |
| 6 <script> | 6 <script> |
| 7 | 7 |
| 8 function test() | 8 function test() |
| 9 { | 9 { |
| 10 var inspectorResource; | 10 InspectorTest.selectNodeAndWaitForStyles("inspected", onStylesSelected); |
| 11 | 11 |
| 12 InspectorTest.selectNodeAndWaitForStyles("inspected", step1); | 12 function onStylesSelected(node) |
| 13 | |
| 14 function step1(node) | |
| 15 { | 13 { |
| 16 InspectorTest.addNewRule("#inspected", stylesReceived); | 14 WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.Wo
rkingCopyCommitted, onWorkingCopyCommitted); |
| 17 | 15 InspectorTest.addNewRule("#inspected", new Function()); |
| 18 function stylesReceived() | |
| 19 { | |
| 20 // UISourceCode.prototype.addRevision() must finish before step2 is
called. | |
| 21 InspectorTest.showScriptSource("inspector-stylesheet", step2); | |
| 22 } | |
| 23 } | 16 } |
| 24 | 17 |
| 25 function step2(sourceFrame) | 18 function onWorkingCopyCommitted(event) |
| 26 { | 19 { |
| 27 var uiSourceCode = sourceFrame._uiSourceCode; | 20 WebInspector.workspace.removeEventListener(WebInspector.UISourceCode.Eve
nts.WorkingCopyCommitted, onWorkingCopyCommitted); |
| 21 var uiSourceCode = event.data.uiSourceCode; |
| 28 InspectorTest.addResult("Inspector stylesheet URL: " + uiSourceCode.disp
layName()); | 22 InspectorTest.addResult("Inspector stylesheet URL: " + uiSourceCode.disp
layName()); |
| 29 uiSourceCode.requestContent().then(printContent(onContent)) | 23 uiSourceCode.requestContent().then(printContent(onContent)) |
| 30 | 24 |
| 31 function onContent() | 25 function onContent() |
| 32 { | 26 { |
| 33 InspectorTest.addResult("\nSetting new content"); | 27 InspectorTest.addResult("\nSetting new content"); |
| 34 uiSourceCode.setWorkingCopy("#inspected { background-color: green; }
"); | 28 uiSourceCode.setWorkingCopy("#inspected { background-color: green; }
"); |
| 35 uiSourceCode.commitWorkingCopy(); | 29 uiSourceCode.commitWorkingCopy(); |
| 36 step3(uiSourceCode); | 30 onUpdatedWorkingCopy(uiSourceCode); |
| 37 } | 31 } |
| 38 } | 32 } |
| 39 | 33 |
| 40 function step3(uiSourceCode) | 34 function onUpdatedWorkingCopy(uiSourceCode) |
| 41 { | 35 { |
| 42 uiSourceCode.requestContent().then(printContent(selectNode)); | 36 uiSourceCode.requestContent().then(printContent(selectNode)); |
| 43 function selectNode() | 37 function selectNode() |
| 44 { | 38 { |
| 45 InspectorTest.selectNodeAndWaitForStyles("inspected", dumpStyles); | 39 InspectorTest.selectNodeAndWaitForStyles("inspected", dumpStyles); |
| 46 } | 40 } |
| 47 | 41 |
| 48 function dumpStyles() | 42 function dumpStyles() |
| 49 { | 43 { |
| 50 InspectorTest.dumpSelectedElementStyles(true, false, true); | 44 InspectorTest.dumpSelectedElementStyles(true, false, true); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 69 | 63 |
| 70 <body onload="runTest()"> | 64 <body onload="runTest()"> |
| 71 <p> | 65 <p> |
| 72 Tests that adding a new rule creates inspector stylesheet resource and allows it
s live editing. | 66 Tests that adding a new rule creates inspector stylesheet resource and allows it
s live editing. |
| 73 </p> | 67 </p> |
| 74 | 68 |
| 75 <div id="inspected">Text</div> | 69 <div id="inspected">Text</div> |
| 76 | 70 |
| 77 </body> | 71 </body> |
| 78 </html> | 72 </html> |
| OLD | NEW |