| Index: third_party/WebKit/LayoutTests/inspector/elements/styles/original-content-provider.html
|
| diff --git a/third_party/WebKit/LayoutTests/inspector/elements/styles/original-content-provider.html b/third_party/WebKit/LayoutTests/inspector/elements/styles/original-content-provider.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..91a84b70a65e8cf008785ad2f6542be0da4bd36f
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/inspector/elements/styles/original-content-provider.html
|
| @@ -0,0 +1,123 @@
|
| +<html>
|
| +<head>
|
| +<script src="../../../http/tests/inspector/inspector-test.js"></script>
|
| +<script src="../../../http/tests/inspector/elements-test.js"></script>
|
| +<style>
|
| +div { color: red; }
|
| +/*# sourceURL=set-style.css */
|
| +</style>
|
| +
|
| +<style>
|
| +div {}
|
| +/*# sourceURL=set-selector.css */
|
| +</style>
|
| +
|
| +<style>
|
| +@media (all) { }
|
| +/*# sourceURL=set-media.css */
|
| +</style>
|
| +
|
| +<style>
|
| +@keyframes animation { 100% { color: red; } }
|
| +/*# sourceURL=set-keyframe-key.css */
|
| +</style>
|
| +
|
| +<style>
|
| +div {}
|
| +/*# sourceURL=add-rule.css */
|
| +</style>
|
| +
|
| +<style>
|
| +div {}
|
| +/*# sourceURL=set-text.css */
|
| +</style>
|
| +
|
| +<script>
|
| +
|
| +function test()
|
| +{
|
| + var headers = InspectorTest.cssModel.styleSheetHeaders();
|
| + InspectorTest.runTestSuite([
|
| + function testSetStyle(next)
|
| + {
|
| + var header = headers.find(header => header.sourceURL.endsWith("set-style.css"));
|
| + InspectorTest.cssModel.setStyleText(header.id, new WebInspector.TextRange(1, 5, 1, 18), "EDITED: EDITED", true)
|
| + .then(success => onEdit(header, success))
|
| + .then(next);
|
| + },
|
| +
|
| + function testSetSelector(next)
|
| + {
|
| + var header = headers.find(header => header.sourceURL.endsWith("set-selector.css"));
|
| + InspectorTest.cssModel.setSelectorText(header.id, new WebInspector.TextRange(1, 0, 1, 3), "EDITED")
|
| + .then(success => onEdit(header, success))
|
| + .then(next);
|
| + },
|
| +
|
| + function testSetMedia(next)
|
| + {
|
| + var header = headers.find(header => header.sourceURL.endsWith("set-media.css"));
|
| + InspectorTest.cssModel.setMediaText(header.id, new WebInspector.TextRange(1, 7, 1, 12), "EDITED")
|
| + .then(success => onEdit(header, success))
|
| + .then(next);
|
| + },
|
| +
|
| + function testSetKeyframeKey(next)
|
| + {
|
| + var header = headers.find(header => header.sourceURL.endsWith("set-keyframe-key.css"));
|
| + InspectorTest.cssModel.setKeyframeKey(header.id, new WebInspector.TextRange(1, 23, 1, 27), "from")
|
| + .then(success => onEdit(header, success))
|
| + .then(next);
|
| + },
|
| +
|
| + function testAddRule(next)
|
| + {
|
| + var header = headers.find(header => header.sourceURL.endsWith("add-rule.css"));
|
| + InspectorTest.cssModel.addRule(header.id, "EDITED {}\n", new WebInspector.TextRange(1, 0, 1, 0))
|
| + .then(success => onEdit(header, success))
|
| + .then(next);
|
| + },
|
| +
|
| + function testSetStyleSheetText(next)
|
| + {
|
| + var header = headers.find(header => header.sourceURL.endsWith("set-text.css"));
|
| + InspectorTest.cssModel.setStyleSheetText(header.id, "EDITED {}", true)
|
| + .then(success => onEdit(header, success))
|
| + .then(next);
|
| + },
|
| + ]);
|
| +
|
| + function onEdit(header, success)
|
| + {
|
| + if (success !== null && !success) {
|
| + InspectorTest.addResult("Failed to run edit operation.");
|
| + InspectorTest.completeTest();
|
| + return;
|
| + }
|
| + var contents = [
|
| + header.originalContentProvider().requestContent(),
|
| + header.requestContent(),
|
| + ];
|
| + return Promise.all(contents)
|
| + .then(onContents);
|
| + }
|
| +
|
| + function onContents(contents)
|
| + {
|
| + InspectorTest.addResult("== Original ==");
|
| + InspectorTest.addResult(contents[0].trim());
|
| + InspectorTest.addResult("== Current ==");
|
| + InspectorTest.addResult(contents[1].trim());
|
| + }
|
| +}
|
| +
|
| +</script>
|
| +</head>
|
| +
|
| +<body onload="runTest()">
|
| +<p>Verifies that CSSStyleSheetHeader.originalContentProvider() indeed returns original content.</p>
|
| +
|
| +<div id="inspected"></div>
|
| +
|
| +</body>
|
| +</html>
|
|
|