Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / elements / styles-1 / edit-inspector-stylesheet.html
blob81879a110c808b8e3ba415af752bed2a92875b94
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/elements-test.js"></script>
5 <script src="../../../http/tests/inspector/debugger-test.js"></script>
6 <script>
8 function test()
10 var inspectorResource;
12 InspectorTest.selectNodeAndWaitForStyles("inspected", step1);
14 function step1(node)
16 InspectorTest.addNewRule("#inspected", stylesReceived);
18 function stylesReceived()
20 // UISourceCode.prototype.addRevision() must finish before step2 is called.
21 InspectorTest.showScriptSource("inspector-stylesheet", step2);
25 function step2(sourceFrame)
27 var uiSourceCode = sourceFrame._uiSourceCode;
28 InspectorTest.addResult("Inspector stylesheet URL: " + uiSourceCode.displayName());
29 uiSourceCode.requestContent(printContent());
31 InspectorTest.addResult("\nSetting new content");
32 uiSourceCode.setWorkingCopy("#inspected { background-color: green; }");
33 uiSourceCode.commitWorkingCopy();
34 step3(uiSourceCode);
37 function step3(uiSourceCode)
39 uiSourceCode.requestContent(printContent(selectNode));
40 function selectNode()
42 InspectorTest.selectNodeAndWaitForStyles("inspected", dumpStyles);
45 function dumpStyles()
47 InspectorTest.dumpSelectedElementStyles(true, false, true);
48 InspectorTest.completeTest();
52 function printContent(next)
54 function result(content)
56 InspectorTest.addResult("Inspector stylesheet content:");
57 InspectorTest.addResult(content);
58 if (next)
59 next();
61 return result;
64 </script>
65 </head>
67 <body onload="runTest()">
68 <p>
69 Tests that adding a new rule creates inspector stylesheet resource and allows its live editing.
70 </p>
72 <div id="inspected">Text</div>
74 </body>
75 </html>