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 var inspectorResource; |
11 | 11 |
12 WebInspector.showPanel("elements"); | 12 WebInspector.showPanel("elements"); |
13 InspectorTest.selectNodeAndWaitForStyles("inspected", step1); | 13 InspectorTest.selectNodeAndWaitForStyles("inspected", step1); |
14 | 14 |
15 function step1(node) | 15 function step1(node) |
16 { | 16 { |
17 WebInspector.cssModel.addRule(node.id, "#inspected", successCallback, fa
ilureCallback); | 17 InspectorTest.addNewRule("#inspected", stylesReceived); |
18 | |
19 function successCallback() | |
20 { | |
21 InspectorTest.waitForStyles("inspected", stylesReceived, true); | |
22 } | |
23 | 18 |
24 function stylesReceived() | 19 function stylesReceived() |
25 { | 20 { |
26 // UISourceCode.prototype.addRevision() must finish before step2 is
called. | 21 // UISourceCode.prototype.addRevision() must finish before step2 is
called. |
27 InspectorTest.showScriptSource("inspector-stylesheet", step2); | 22 InspectorTest.showScriptSource("inspector-stylesheet", step2); |
28 } | 23 } |
29 | |
30 function failureCallback() | |
31 { | |
32 InspectorTest.addResult("Failed to add rule."); | |
33 InspectorTest.completeTest(); | |
34 } | |
35 } | 24 } |
36 | 25 |
37 function step2(sourceFrame) | 26 function step2(sourceFrame) |
38 { | 27 { |
39 var uiSourceCode = sourceFrame._uiSourceCode; | 28 var uiSourceCode = sourceFrame._uiSourceCode; |
40 InspectorTest.addResult("Inspector stylesheet URL: " + uiSourceCode.disp
layName()); | 29 InspectorTest.addResult("Inspector stylesheet URL: " + uiSourceCode.disp
layName()); |
41 uiSourceCode.requestContent(printContent()); | 30 uiSourceCode.requestContent(printContent()); |
42 | 31 |
43 InspectorTest.addResult("\nSetting new content"); | 32 InspectorTest.addResult("\nSetting new content"); |
44 uiSourceCode.setWorkingCopy("#inspected { background-color: green; }"); | 33 uiSourceCode.setWorkingCopy("#inspected { background-color: green; }"); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 66 |
78 <body onload="runTest()"> | 67 <body onload="runTest()"> |
79 <p> | 68 <p> |
80 Tests that adding a new rule creates inspector stylesheet resource and allows it
s live editing. | 69 Tests that adding a new rule creates inspector stylesheet resource and allows it
s live editing. |
81 </p> | 70 </p> |
82 | 71 |
83 <div id="inspected">Text</div> | 72 <div id="inspected">Text</div> |
84 | 73 |
85 </body> | 74 </body> |
86 </html> | 75 </html> |
OLD | NEW |