Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Unified Diff: LayoutTests/inspector/elements/styles-4/styles-new-API.html

Issue 1187193005: DevTools: migrate from CSS.setPropertyText to CSS.setStyleText (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: for landing Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/inspector/elements/styles-4/styles-new-API.html
diff --git a/LayoutTests/inspector/elements/styles-4/styles-new-API.html b/LayoutTests/inspector/elements/styles-4/styles-new-API.html
index d4154e6f601acc48de3e87368f91f5397d65fe9c..5c2278d16cf0175ca76c0513fed8490f949b6b31 100644
--- a/LayoutTests/inspector/elements/styles-4/styles-new-API.html
+++ b/LayoutTests/inspector/elements/styles-4/styles-new-API.html
@@ -170,109 +170,6 @@ function test()
InspectorTest.nodeWithId("thetable", nodeCallback);
},
- function test_styleSheets(next)
- {
- var newStyleSheetText =
- "body.mainpage {" +
- " text-decoration: strikethrough;" +
- " badproperty: 2badvalue2;" +
- "}" +
- "body {" +
- " text-align: justify;" +
- "}";
-
- function didSetStyleText(error, style)
- {
- if (error) {
- InspectorTest.addResult("error: " + error);
- InspectorTest.completeTest();
- return;
- }
- InspectorTest.addResult("");
- InspectorTest.addResult("=== After style text set ===");
- loadAndDumpStyleSheet(style.styleSheetId, next);
- }
-
- function collapseToStart(range)
- {
- return {
- startLine: range.startLine,
- startColumn: range.startColumn,
- endLine: range.startLine,
- endColumn: range.startColumn,
- };
- }
-
- function setStyleText(rule)
- {
- InspectorTest.CSSAgent.setPropertyText(rule.style.styleSheetId, rule.style.cssProperties[1].range, "");
- InspectorTest.CSSAgent.setPropertyText(rule.style.styleSheetId, rule.style.cssProperties[0].range, "");
-
- // This operation should not update the style as the new property text is not parsable.
- InspectorTest.CSSAgent.setPropertyText(rule.style.styleSheetId, collapseToStart(rule.style.range), "zzz;");
- InspectorTest.CSSAgent.setPropertyText(rule.style.styleSheetId, collapseToStart(rule.style.range), "color: white; background: black;", didSetStyleText);
- }
-
- function didSetSelector(error, rule)
- {
- if (error) {
- InspectorTest.addResult("error: " + error);
- InspectorTest.completeTest();
- return;
- }
- InspectorTest.addResult("");
- InspectorTest.addResult("=== After selector set ===");
- loadAndDumpStyleSheet(rule.styleSheetId, setStyleText.bind(this, rule));
- }
-
- function setRuleSelector(rule)
- {
- var orm = WebInspector.CSSRule.parsePayload(InspectorTest.cssModel, rule);
- InspectorTest.CSSAgent.setRuleSelector(orm.styleSheetId, orm.selectorRange, "html *, body[foo=\"bar\"]", didSetSelector);
- }
-
- function onMatchedStylesForNode(error, matchedStyles)
- {
- if (error) {
- InspectorTest.addResult("error: " + error);
- InspectorTest.completeTest();
- return;
- }
- for (var i = 0; i < matchedStyles.length; ++i) {
- var rule = matchedStyles[i].rule;
- if (rule.selectorList.text !== "body.mainpage") {
- continue;
- }
- setRuleSelector(rule);
- return;
- }
- InspectorTest.addResult("Error: rule with selector body.mainpage is not found");
- InspectorTest.completeTest();
- }
-
- function didPatchStyleSheet(styleSheetId)
- {
- InspectorTest.CSSAgent.getMatchedStylesForNode(bodyId, true, true, onMatchedStylesForNode);
- }
-
- function patchStyleSheet(styleSheetId)
- {
- InspectorTest.addResult("");
- InspectorTest.addResult("=== Last stylesheet patched ===");
- InspectorTest.CSSAgent.setStyleSheetText(styleSheetId, newStyleSheetText,
- loadAndDumpStyleSheet.bind(null, styleSheetId, didPatchStyleSheet));
- }
-
- function styleSheetInfosLoaded(styleSheets)
- {
- InspectorTest.addResult("");
- InspectorTest.addResult("=== All stylesheets ===");
- for (var i = 0; i < styleSheets.length; ++i)
- loadAndDumpStyleSheet(styleSheets[i].id, (i < styleSheets.length - 1) ? null : patchStyleSheet);
- }
- InspectorTest.waitForStylesheetsOnFrontend(4, styleSheetInfosLoaded);
- },
-
function test_addRule(next)
{
function didGetStyles(error, matchedCSSRules)
@@ -302,7 +199,7 @@ function test()
InspectorTest.addResult("error: " + error);
return;
}
- InspectorTest.CSSAgent.setPropertyText(rule.style.styleSheetId, {
+ InspectorTest.CSSAgent.setStyleText(rule.style.styleSheetId, {
startLine: rule.style.range.startLine,
startColumn: rule.style.range.startColumn,
endLine: rule.style.range.startLine,
@@ -329,117 +226,6 @@ function test()
var frameId = InspectorTest.resourceTreeModel.mainFrame.id;
InspectorTest.CSSAgent.createStyleSheet(frameId, viaInspectorStyleSheetCreated.bind(this));
},
-
- function test_disableProperty(next)
- {
- function didEnableProperty(style)
- {
- InspectorTest.addResult("");
- InspectorTest.addResult("=== After property enabled ===");
- InspectorTest.dumpCSSStyleDeclaration(style);
- next();
- }
-
- function step(style)
- {
- style.propertyAt(8).setDisabled(false, didEnableProperty);
- }
-
- function didDisableProperty(style)
- {
- InspectorTest.addResult("");
- InspectorTest.addResult("=== After property manipulations ===");
- InspectorTest.dumpCSSStyleDeclaration(style);
- style.propertyAt(6).setDisabled(false, step);
- }
-
- function parseStylePayload(callback, error, payload)
- {
- if (error) {
- InspectorTest.addResult(error);
- InspectorTest.completeTest();
- return;
- }
- callback(WebInspector.CSSStyleDeclaration.parsePayload(InspectorTest.cssModel, payload));
- }
-
- function stylesCallback(error, matchedCSSRules)
- {
- if (error) {
- InspectorTest.addResult("error: " + error);
- return;
- }
- // height : 100% ;
- // border: 1px solid;
- // border-width: 2px;
- // background-color : #33FF33;
- // googles: abra;
- // foo: .bar;
- // -moz-goog: 1***;
- // border-width: 0px;
- // padding-top: 1px; [d]
-
- var orm = WebInspector.CSSStyleDeclaration.parsePayload(InspectorTest.cssModel, matchedCSSRules[1].rule.style);
- orm.propertyAt(0).setDisabled(true, step1);
-
- function step1(orm)
- {
- orm.propertyAt(7).setDisabled(true, step2);
- }
-
- function step2(orm)
- {
- InspectorTest.CSSAgent.setPropertyText(orm.styleSheetId, orm.propertyAt(7).range.collapseToStart(), "font-size: 12px;", parseStylePayload.bind(null, step3));
- }
-
- function step3(orm)
- {
- InspectorTest.CSSAgent.setPropertyText(orm.styleSheetId, orm.propertyAt(9).range.collapseToStart(), "font-size: 14px;", parseStylePayload.bind(null, step4));
- }
-
- function step4(orm)
- {
- orm.propertyAt(9).setDisabled(true, step5);
- }
-
- function step5(orm)
- {
- InspectorTest.CSSAgent.setPropertyText(orm.styleSheetId, orm.propertyAt(8).range, "border-width: 1px;", parseStylePayload.bind(null, step6));
- }
-
- function step6(orm)
- {
- orm.propertyAt(8).setDisabled(false, step7);
- }
-
- function step7(orm)
- {
- InspectorTest.CSSAgent.setPropertyText(orm.styleSheetId, orm.propertyAt(3).range, "", parseStylePayload.bind(null, step8));
- }
-
- function step8(orm)
- {
- orm.propertyAt(9).setDisabled(false, didDisableProperty);
- }
-
- // height : 100% ; [d]
- // border: 1px solid;
- // border-width: 2px;
- // googles: abra;
- // foo: .bar;
- // -moz-goog: 1***;
- // font-size: 12px;
- // border-width: 1px;
- // font-size: 14px; [d]
- // padding-top: 1px;
- }
-
- function nodeCallback(node)
- {
- InspectorTest.CSSAgent.getMatchedStylesForNode(node.id, true, true, stylesCallback);
- }
- InspectorTest.nodeWithId("toggle", nodeCallback);
- },
]);
function loadAndDumpStyleSheet(styleSheetId, continuation, error)

Powered by Google App Engine
This is Rietveld 408576698