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

Unified Diff: LayoutTests/inspector/elements/styles/styles-update-links.html

Issue 1158883003: DevTools: shard inspector/elements tests for faster execution. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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/styles-update-links.html
diff --git a/LayoutTests/inspector/elements/styles/styles-update-links.html b/LayoutTests/inspector/elements/styles/styles-update-links.html
deleted file mode 100644
index e0473fe6b10293c8c6bdbfe45feb1a686b36f486..0000000000000000000000000000000000000000
--- a/LayoutTests/inspector/elements/styles/styles-update-links.html
+++ /dev/null
@@ -1,228 +0,0 @@
-<html>
-<head>
-<script src="../../../http/tests/inspector/inspector-test.js"></script>
-<script src="../../../http/tests/inspector/elements-test.js"></script>
-<style>
-#pseudo::after {
- pseudo-property: "12";
- color: red;
-}
-
-#pseudo::after {
- border: 1px solid black;
-}
-
-#pseudo::before {
- color: blue;
-}
-</style>
-<script>
-
-function test()
-{
- function flattenRuleRanges(rule)
- {
- var ranges = [];
- var medias = rule.media || [];
- for (var i = 0; i < medias.length; ++i) {
- var media = medias[i];
- if (!media.range)
- continue;
- ranges.push({
- range: media.range,
- name: "media #" + i
- });
- }
- for (var i = 0; i < rule.selectors.length; ++i) {
- var selector = rule.selectors[i];
- if (!selector.range)
- continue;
- ranges.push({
- range: selector.range,
- name: "selector #" + i
- });
- }
- if (rule.style.range) {
- ranges.push({
- range: rule.style.range,
- name: "style range"
- });
- }
- var properties = rule.style.allProperties;
- for (var i = 0; i < properties.length; ++i) {
- var property = properties[i];
- if (!property.range)
- continue;
- ranges.push({
- range: property.range,
- name: "property >>" + property.text + "<<"
- });
- }
- return ranges;
- }
-
- function compareRuleRanges(lazyRule, originalRule)
- {
- if (lazyRule.selectorText !== originalRule.selectorText) {
- InspectorTest.addResult("Error: rule selectors are not equal: " + lazyRule.selectorText + " != " + originalRule.selectorText);
- return false;
- }
- var flattenLazy = flattenRuleRanges(lazyRule);
- var flattenOriginal = flattenRuleRanges(originalRule);
- if (flattenLazy.length !== flattenOriginal.length) {
- InspectorTest.addResult("Error: rule range amount is not equal: " + flattenLazy.length + " != " + flattenOriginal.length);
- return false
- }
- for (var i = 0; i < flattenLazy.length; ++i) {
- var lazyRange = flattenLazy[i];
- var originalRange = flattenOriginal[i];
- if (lazyRange.name !== originalRange.name) {
- InspectorTest.addResult("Error: rule names are not equal: " + lazyRange.name + " != " + originalRange.name);
- return false;
- }
- if (!lazyRange.range.equal(originalRange.range)) {
- InspectorTest.addResult("Error: ranges '" + lazyRange.name + "' are not equal: " + lazyRange.range.toString() + " != " + originalRange.range.toString());
- return false;
- }
- }
- InspectorTest.addResult(flattenLazy.length + " rule ranges are equal.");
- return true;
- }
-
- function validateRuleRanges(selector, rules, callback)
- {
- InspectorTest.selectNodeAndWaitForStyles("other", onOtherSelected);
-
- function onOtherSelected()
- {
- InspectorTest.selectNodeAndWaitForStyles(selector, onContainerSelected);
- }
-
- function onContainerSelected()
- {
- var fetchedRules = getMatchedRules();
- if (fetchedRules.length !== rules.length) {
- InspectorTest.addResult(String.sprintf("Error: rules sizes are not equal! Expected: %d, actual: %d", fetchedRules.length, rules.length));
- InspectorTest.completeTest();
- return;
- }
- for (var i = 0; i < fetchedRules.length; ++i) {
- if (!compareRuleRanges(rules[i], fetchedRules[i])) {
- InspectorTest.completeTest();
- return;
- }
- }
- callback();
- }
- }
-
- function getMatchedRules()
- {
- var rules = [];
- for (var block of WebInspector.panels.elements.sidebarPanes.styles._sectionBlocks) {
- for (var section of block.sections) {
- var rule = section.rule();
- if (rule)
- rules.push(rule);
- }
- }
- return rules;
- }
-
- InspectorTest.runTestSuite([
- function selectInitialNode(next)
- {
- InspectorTest.selectNodeAndWaitForStyles("container", next);
- },
-
- function testInsertProperty(next)
- {
- InspectorTest.dumpSelectedElementStyles(true, false, true);
- var treeItem = InspectorTest.getMatchedStylePropertyTreeItem("color");
- var treeElement = treeItem.section().addNewBlankProperty(1);
- InspectorTest.waitForStyleApplied(onPropertyInserted);
- treeElement.applyStyleText("PROPERTY: INSERTED;", true);
-
- function onPropertyInserted()
- {
- InspectorTest.addResult("\n\n#### AFTER PROPERTY INSERTION ####\n\n");
- InspectorTest.dumpSelectedElementStyles(true, false, true);
- var rules = getMatchedRules();
- validateRuleRanges("container", rules, next);
- }
- },
-
- function testEditSelector(next)
- {
- var section = WebInspector.panels.elements.sidebarPanes.styles._sectionBlocks[0].sections[3];
- section.startEditingSelector();
- section._selectorElement.textContent = ".should-change, .INSERTED-OTHER-SELECTOR";
- InspectorTest.waitForSelectorCommitted(onSelectorEdited);
- section._selectorElement.dispatchEvent(InspectorTest.createKeyEvent("Enter"));
-
- function onSelectorEdited()
- {
- InspectorTest.addResult("\n\n#### AFTER SELECTOR EDIT ####\n\n");
- InspectorTest.dumpSelectedElementStyles(true, false, true);
- var rules = getMatchedRules();
- validateRuleRanges("container", rules, next);
- }
- },
-
- function testDisableProperty(next)
- {
- var treeItem = InspectorTest.getMatchedStylePropertyTreeItem("border");
- InspectorTest.waitForStyleApplied(onPropertyDisabled);
- treeItem._toggleEnabled({ target: { checked: false }, consume: function() { } });
-
- function onPropertyDisabled()
- {
- InspectorTest.addResult("\n\n#### AFTER PROPERTY DISABLED ####\n\n");
- InspectorTest.dumpSelectedElementStyles(true, false, true);
- var rules = getMatchedRules();
- validateRuleRanges("container", rules, next);
- }
- },
-
- function selectNodeWithPseudoElements(next)
- {
- InspectorTest.selectNodeAndWaitForStyles("pseudo", next);
- },
-
- function testPseudoSectionPropertyEdit(next)
- {
- var treeItem = InspectorTest.getMatchedStylePropertyTreeItem("pseudo-property");
- var treeElement = treeItem.section().addNewBlankProperty(1);
- InspectorTest.waitForStyleApplied(onPropertyInserted);
- treeElement.applyStyleText("PROPERTY: INSERTED;", true);
-
- function onPropertyInserted()
- {
- InspectorTest.addResult("\n\n#### AFTER PROPERTY INSERTED ####\n\n");
- InspectorTest.dumpSelectedElementStyles(true, false, true);
- var rules = getMatchedRules();
- validateRuleRanges("pseudo", rules, next);
- }
- },
- ]);
-}
-</script>
-<link rel="stylesheet" href="resources/styles-update-links-2.css"></link>
-<link rel="stylesheet" href="resources/styles-update-links.css"></link>
-</head>
-
-<body onload="runTest()">
-<p>
-Tests that removal of property following its disabling works.
-</p>
-
-<div id="container" class="left-intact should-change">
-Red text here.
-</div>
-
-<div id="other"></div>
-
-<section id="pseudo"></div>
-
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698