diff options
| author | dcheng@chromium.org <dcheng@chromium.org> | 2015-04-04 02:28:39 +0000 |
|---|---|---|
| committer | dcheng@chromium.org <dcheng@chromium.org> | 2015-04-04 02:28:39 +0000 |
| commit | defd48a3234dd73d4a24cef95e35f7ae1879e704 (patch) | |
| tree | 60a41f8144bfb4ab7cb1a99c17914b560efa80f4 | |
| parent | cac0c7c928c7f4c02e5572062ae287396de3269b (diff) | |
| download | chromium_src-defd48a3234dd73d4a24cef95e35f7ae1879e704.zip chromium_src-defd48a3234dd73d4a24cef95e35f7ae1879e704.tar.gz chromium_src-defd48a3234dd73d4a24cef95e35f7ae1879e704.tar.bz2 | |
Remove testRunner.injectStyleSheet usage from layout tests.
BUG=
Review URL: https://codereview.chromium.org/1058723002
git-svn-id: svn://svn.chromium.org/blink/trunk@193155 bbb929c8-8fbe-4397-9dbb-9b2b20218538
22 files changed, 32 insertions, 168 deletions
diff --git a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-height-extend-to-zoom.html b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-height-extend-to-zoom.html index b5279d7..cdb68c3 100644 --- a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-height-extend-to-zoom.html +++ b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-height-extend-to-zoom.html @@ -8,15 +8,6 @@ html, body { width: 100%; height: 100%; margin: 0 } @viewport { height: -internal-extend-to-zoom; zoom: 2.0; } </style> - <script> - test(function(){ - assert_own_property(window, "testRunner"); - }, "Check that window.testRunner is present. Required to add a user stylesheet."); - - if (window.testRunner) { - testRunner.injectStyleSheet("@viewport { width: -internal-extend-to-zoom 980px; min-zoom: 0.25; max-zoom: 5; height: auto ; zoom: auto; user-zoom: zoom; orientation: auto }", true); - } - </script> </head> <body> <div id="log"></div> diff --git a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-initial-height-zero-expected.txt b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-initial-height-zero-expected.txt index 2006599..175bd6d 100644 --- a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-initial-height-zero-expected.txt +++ b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-initial-height-zero-expected.txt @@ -1,2 +1,2 @@ -ALERT: viewport size 200x100 scale 1 with limits [1, 5] and userScalable true +ALERT: viewport size 200x100 scale 1 with limits [1, -1] and userScalable true diff --git a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-initial-height-zero.html b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-initial-height-zero.html index 1e482f5..906d2be 100644 --- a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-initial-height-zero.html +++ b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-initial-height-zero.html @@ -10,9 +10,6 @@ } </style> <script type="text/javascript"> - if (window.testRunner) - testRunner.injectStyleSheet("@viewport { width: extend-to-zoom 980px; min-zoom: 0.25; max-zoom: 5; height: auto; zoom: auto; user-zoom: zoom; orientation: auto }", true); - function test() { if (window.testRunner) { testRunner.dumpAsText(); diff --git a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-initial-width-zero-expected.txt b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-initial-width-zero-expected.txt index 76952fc..add97bc 100644 --- a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-initial-width-zero-expected.txt +++ b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-initial-width-zero-expected.txt @@ -1,2 +1,2 @@ -ALERT: viewport size 100x200 scale 0.25 with limits [0.25, 5] and userScalable true +ALERT: viewport size 100x200 scale -1 with limits [-1, -1] and userScalable true diff --git a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-initial-width-zero.html b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-initial-width-zero.html index 63c32c4..8fa624c 100644 --- a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-initial-width-zero.html +++ b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-initial-width-zero.html @@ -10,9 +10,6 @@ } </style> <script type="text/javascript"> - if (window.testRunner) - testRunner.injectStyleSheet("@viewport { width: extend-to-zoom 980px; min-zoom: 0.25; max-zoom: 5; height: auto; zoom: auto; user-zoom: zoom; orientation: auto }", true); - function test() { if (window.testRunner) { testRunner.dumpAsText(); diff --git a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-insert-rule-after-expected.txt b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-insert-rule-after-expected.txt index 5865bbd..65b91df 100644 --- a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-insert-rule-after-expected.txt +++ b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-insert-rule-after-expected.txt @@ -1,2 +1,2 @@ -ALERT: viewport size 1000x1100 scale 0.32 with limits [0.32, 5] and userScalable true +ALERT: viewport size 1000x1100 scale 0.32 with limits [0.32, -1] and userScalable true diff --git a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-insert-rule-after.html b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-insert-rule-after.html index af10049..60a419b 100644 --- a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-insert-rule-after.html +++ b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-insert-rule-after.html @@ -5,12 +5,8 @@ <style> @viewport { width: 500px; -} </style> <script> - if (window.testRunner) - testRunner.injectStyleSheet("@viewport { width: extend-to-zoom 980px; min-zoom: 0.25; max-zoom: 5; height: auto; zoom: auto; user-zoom: zoom; orientation: auto }", true); - function test() { if (window.testRunner) { testRunner.dumpAsText(); diff --git a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-insert-rule-before-expected.txt b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-insert-rule-before-expected.txt index 5ff9e75..ee27e2d 100644 --- a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-insert-rule-before-expected.txt +++ b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-insert-rule-before-expected.txt @@ -1,2 +1,2 @@ -ALERT: viewport size 500x550 scale 0.64 with limits [0.64, 5] and userScalable true +ALERT: viewport size 500x550 scale 0.64 with limits [0.64, -1] and userScalable true diff --git a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-insert-rule-before.html b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-insert-rule-before.html index acbdd48..b2c06a0 100644 --- a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-insert-rule-before.html +++ b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-insert-rule-before.html @@ -8,9 +8,6 @@ } </style> <script> - if (window.testRunner) - testRunner.injectStyleSheet("@viewport { width: extend-to-zoom 980px; min-zoom: 0.25; max-zoom: 5; height: auto; zoom: auto; user-zoom: zoom; orientation: auto }", true); - function test() { if (window.testRunner) { testRunner.dumpAsText(); diff --git a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-min-width-extend-to-zoom.html b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-min-width-extend-to-zoom.html index f04166c..4ba0b1f 100644 --- a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-min-width-extend-to-zoom.html +++ b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-min-width-extend-to-zoom.html @@ -6,17 +6,8 @@ <script src="../../resources/testharnessreport.js"></script> <style> html, body { width: 100%; height: 100%; margin: 0 } - @viewport { width: -internal-extend-to-zoom 200px; zoom: 1.0; } + @viewport { min-width: -internal-extend-to-zoom 200px; zoom: 1.0; } </style> - <script> - test(function(){ - assert_own_property(window, "testRunner"); - }, "Check that window.testRunner is present. Required to add a user stylesheet."); - - if (window.testRunner) { - testRunner.injectStyleSheet("@viewport { width: -internal-extend-to-zoom 980px; min-zoom: 0.25; max-zoom: 5; height: auto; zoom: auto; user-zoom: zoom; orientation: auto }", true); - } - </script> </head> <body> <div id="log"></div> diff --git a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-relative-font-expected.txt b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-relative-font-expected.txt index 9d2cc92..2f07e19 100644 --- a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-relative-font-expected.txt +++ b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-relative-font-expected.txt @@ -1,2 +1,2 @@ -ALERT: viewport size 160x160 scale 2 with limits [2, 5] and userScalable true +ALERT: viewport size 160x160 scale 2 with limits [2, -1] and userScalable true diff --git a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-relative-font.html b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-relative-font.html index baad786..34b0d06 100644 --- a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-relative-font.html +++ b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-relative-font.html @@ -18,7 +18,6 @@ </style> <script> if (window.testRunner) { - testRunner.injectStyleSheet("@viewport { width: extend-to-zoom 980px; min-zoom: 0.25; max-zoom: 5; height: auto; zoom: auto; user-zoom: zoom; orientation: auto }", true); testRunner.dumpAsText(); document.body.offsetWidth; // Trigger style resolving alert(internals.viewportAsText(document, 1, 320, 352)); diff --git a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-user-agent-style.html b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-user-agent-style.html index 9d6aff9..a4830f0 100644 --- a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-user-agent-style.html +++ b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-user-agent-style.html @@ -6,10 +6,8 @@ <script src="../../resources/testharnessreport.js"></script> <script> if (window.testRunner) { - // FIXME: Emulate the android viewport UA stylesheet. We should test this - // based on the platform we're building for - testRunner.injectStyleSheet("@viewport {min-width: 980px}", true); internals.settings.setViewportEnabled(true); + internals.settings.setUseMobileViewportStyle(true); } </script> <style> diff --git a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-user-style.html b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-user-style.html deleted file mode 100644 index f00869e..0000000 --- a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-user-style.html +++ /dev/null @@ -1,53 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <title>User stylesheet containing an @viewport rule</title> - <script src="../../resources/testharness.js"></script> - <script src="../../resources/testharnessreport.js"></script> - <style> - html, body { width: 100%; height: 100%; margin: 0 } - - @viewport { - height: 2000px; - } - </style> - <script> - test(function(){ - assert_own_property(window, "testRunner"); - }, "Check that window.testRunner is present. Required to add a user stylesheet."); - - if (window.testRunner) { - testRunner.injectStyleSheet("@viewport { width: 450px; height: auto; zoom: auto; min-zoom: auto; max-zoom: auto }", true); - } - </script> -</head> -<body> - <div id="log"></div> - <script> - test(function(){ - assert_own_property(window, "internals"); - }, "Check that window.internals is present. Required to call viewportAsText."); - - var actualWidth; - var actualHeight; - - document.body.offsetHeight; - - var vpString = internals.viewportAsText(document, 1, 320, 352); - var match = /viewport size (.+)x(.+) scale (.+ )/.exec(vpString); - - if (match) { - actualWidth = parseFloat(match[1]); - actualHeight = parseFloat(match[2]); - } - - test(function(){ - assert_equals(actualWidth, 450); - }, "Check that we get the viewport width from the user stylesheet."); - - test(function(){ - assert_equals(actualHeight, 2000); - }, "Check that we get the viewport height from the author stylesheet."); - </script> -</body> -</html> diff --git a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-width-extend-to-zoom.html b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-width-extend-to-zoom.html index cfdbef5..9810fae 100644 --- a/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-width-extend-to-zoom.html +++ b/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-width-extend-to-zoom.html @@ -8,15 +8,6 @@ html, body { width: 100%; height: 100%; margin: 0 } @viewport { width: -internal-extend-to-zoom; zoom: 0.5; } </style> - <script> - test(function(){ - assert_own_property(window, "testRunner"); - }, "Check that window.testRunner is present. Required to add a user stylesheet."); - - if (window.testRunner) { - testRunner.injectStyleSheet("@viewport { width: -internal-extend-to-zoom 980px; min-zoom: 0.25; max-zoom: 5; height: auto; zoom: auto; user-zoom: zoom; orientation: auto }", true); - } - </script> </head> <body> <div id="log"></div> diff --git a/third_party/WebKit/LayoutTests/inspector/elements/styles/inject-stylesheet-expected.txt b/third_party/WebKit/LayoutTests/inspector/elements/styles/inject-stylesheet-expected.txt index c30a80b..789b209 100644 --- a/third_party/WebKit/LayoutTests/inspector/elements/styles/inject-stylesheet-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector/elements/styles/inject-stylesheet-expected.txt @@ -1,4 +1,4 @@ -CONSOLE MESSAGE: line 9: iframe loaded +CONSOLE MESSAGE: line 10: iframe loaded Tests that injected user stylesheets are reflected in the Styles pane. diff --git a/third_party/WebKit/LayoutTests/inspector/elements/styles/inject-stylesheet.html b/third_party/WebKit/LayoutTests/inspector/elements/styles/inject-stylesheet.html index a45ab6c..4cc2560f 100644 --- a/third_party/WebKit/LayoutTests/inspector/elements/styles/inject-stylesheet.html +++ b/third_party/WebKit/LayoutTests/inspector/elements/styles/inject-stylesheet.html @@ -9,11 +9,16 @@ <script src="../../../http/tests/inspector/elements-test.js"></script> <script> -function injectStyleSheet() +function injectStyleSheet(context) { var styleSheet = "#main { color: red; -webkit-border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQVR42r2RsQrDMAxEBRdl8SDcX8lQPGg1GBI6lvz/h7QyRRXV0qUULwfvwZ1tenw5PxToRPWMC52eA9+WDnlh3HFQ/xBQl86NFYJqeGflkiogrOvVlIFhqURFVho3x1moGAa3deMs+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs54f0sZFUVAMigAAAABJRU5ErkJggg==) } #iframeBody { background: red }"; - if (window.testRunner) - window.testRunner.injectStyleSheet(styleSheet, true); + if (context.testRunner) + context.testRunner.insertStyleSheet(styleSheet); +} + +function preRunTest() { + injectStyleSheet(window); + runTest(); } function loadIframe() @@ -25,12 +30,7 @@ function loadIframe() function test() { - InspectorTest.evaluateInPage("injectStyleSheet()", init); - - function init() - { - InspectorTest.selectNodeAndWaitForStylesWithComputed("main", step0); - } + InspectorTest.selectNodeAndWaitForStylesWithComputed("main", step0); function step0() { @@ -55,7 +55,7 @@ function test() </script> </head> -<body onload="runTest()"> +<body onload="preRunTest()"> <p> Tests that injected user stylesheets are reflected in the Styles pane. </p> diff --git a/third_party/WebKit/LayoutTests/inspector/elements/styles/resources/inject-stylesheet-iframe-data.html b/third_party/WebKit/LayoutTests/inspector/elements/styles/resources/inject-stylesheet-iframe-data.html index 5f3e7e62..9c62e23 100644 --- a/third_party/WebKit/LayoutTests/inspector/elements/styles/resources/inject-stylesheet-iframe-data.html +++ b/third_party/WebKit/LayoutTests/inspector/elements/styles/resources/inject-stylesheet-iframe-data.html @@ -6,6 +6,7 @@ <script> function iframeOnload() { + window.parent.injectStyleSheet(window); console.log("iframe loaded"); } </script> diff --git a/third_party/WebKit/LayoutTests/inspector/elements/styles/styles-disable-then-enable-overriden-ua-expected.txt b/third_party/WebKit/LayoutTests/inspector/elements/styles/styles-disable-then-enable-overriden-ua-expected.txt index 717d80d..a25ffad 100644 --- a/third_party/WebKit/LayoutTests/inspector/elements/styles/styles-disable-then-enable-overriden-ua-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector/elements/styles/styles-disable-then-enable-overriden-ua-expected.txt @@ -6,12 +6,9 @@ element.style { () margin: 10px; [expanded] -#container { (injected stylesheet) -/-- overloaded --/ margin: 8px; - -[expanded] -div { (user agent stylesheet) +body { (user agent stylesheet) display: block; +/-- overloaded --/ margin: 8px; After disable [expanded] @@ -19,12 +16,9 @@ element.style { () /-- overloaded --/ /-- disabled --/ /* margin: 10px; */ [expanded] -#container { (injected stylesheet) - margin: 8px; - -[expanded] -div { (user agent stylesheet) +body { (user agent stylesheet) display: block; + margin: 8px; After enable [expanded] @@ -32,11 +26,8 @@ element.style { () margin: 10px; [expanded] -#container { (injected stylesheet) -/-- overloaded --/ margin: 8px; - -[expanded] -div { (user agent stylesheet) +body { (user agent stylesheet) display: block; +/-- overloaded --/ margin: 8px; diff --git a/third_party/WebKit/LayoutTests/inspector/elements/styles/styles-disable-then-enable-overriden-ua.html b/third_party/WebKit/LayoutTests/inspector/elements/styles/styles-disable-then-enable-overriden-ua.html index dfc9fa7..64acd8b 100644 --- a/third_party/WebKit/LayoutTests/inspector/elements/styles/styles-disable-then-enable-overriden-ua.html +++ b/third_party/WebKit/LayoutTests/inspector/elements/styles/styles-disable-then-enable-overriden-ua.html @@ -1,3 +1,4 @@ +<!DOCTYPE html> <html> <head> <script src="../../../http/tests/inspector/inspector-test.js"></script> @@ -5,44 +6,27 @@ <script> -function injectStyleSheet() -{ - var styleSheet = "#container { margin: 8px }"; - if (window.testRunner) - window.testRunner.injectStyleSheet(styleSheet, true); -} - function test() { - InspectorTest.selectNodeAndWaitForStyles("container", step0); - - function step0() - { - InspectorTest.evaluateInPage("injectStyleSheet()", step1); - } + InspectorTest.selectNodeAndWaitForStyles("body-id", step1); function step1() { - InspectorTest.waitForStyles("container", step2); - } - - function step2() - { InspectorTest.addResult("Before disable"); InspectorTest.dumpSelectedElementStyles(true, false, true); InspectorTest.toggleStyleProperty("margin", false); - InspectorTest.waitForStyles("container", step3); + InspectorTest.waitForStyles("body-id", step2); } - function step3() + function step2() { InspectorTest.addResult("After disable"); InspectorTest.dumpSelectedElementStyles(true, false, true); InspectorTest.toggleStyleProperty("margin", true); - InspectorTest.waitForStyles("container", step4); + InspectorTest.waitForStyles("body-id", step3); } - function step4() + function step3() { InspectorTest.addResult("After enable"); InspectorTest.dumpSelectedElementStyles(true, false, true); @@ -52,12 +36,10 @@ function test() </script> </head> -<body onload="runTest()" id="body-id"> +<body onload="runTest()" id="body-id" style="margin: 10px"> <p> Tests that disabling shorthand removes the "overriden" mark from the UA shorthand it overrides. </p> -<div id="container" style="margin: 10px"></div> - </body> </html> diff --git a/third_party/WebKit/LayoutTests/printing/page-rule-selection-expected.txt b/third_party/WebKit/LayoutTests/printing/page-rule-selection-expected.txt index 8550833..6d56696 100644 --- a/third_party/WebKit/LayoutTests/printing/page-rule-selection-expected.txt +++ b/third_party/WebKit/LayoutTests/printing/page-rule-selection-expected.txt @@ -9,12 +9,6 @@ PASS internals.pageProperty('margin-left', 1) is "auto" PASS internals.pageProperty('margin-left', 2) is "auto" PASS internals.pageProperty('margin-left', 3) is "auto" PASS internals.pageProperty('margin-left', 4) is "auto" -Set margin to 200px via user style sheet. -PASS internals.pageProperty('margin-left', 0) is "200" -PASS internals.pageProperty('margin-left', 1) is "200" -PASS internals.pageProperty('margin-left', 2) is "200" -PASS internals.pageProperty('margin-left', 3) is "200" -PASS internals.pageProperty('margin-left', 4) is "200" Set margin to 100px. PASS internals.pageProperty('margin-left', 0) is "100" PASS internals.pageProperty('margin-left', 1) is "100" diff --git a/third_party/WebKit/LayoutTests/printing/page-rule-selection.html b/third_party/WebKit/LayoutTests/printing/page-rule-selection.html index 074c4a8..7cd0c7b 100644 --- a/third_party/WebKit/LayoutTests/printing/page-rule-selection.html +++ b/third_party/WebKit/LayoutTests/printing/page-rule-selection.html @@ -26,14 +26,6 @@ shouldBeEqualToString("internals.pageProperty('margin-left', 3)", "auto"); shouldBeEqualToString("internals.pageProperty('margin-left', 4)", "auto"); - debug("Set margin to 200px via user style sheet."); - testRunner.injectStyleSheet("@page { margin:200px; }", true); - shouldBeEqualToString("internals.pageProperty('margin-left', 0)", "200"); - shouldBeEqualToString("internals.pageProperty('margin-left', 1)", "200"); - shouldBeEqualToString("internals.pageProperty('margin-left', 2)", "200"); - shouldBeEqualToString("internals.pageProperty('margin-left', 3)", "200"); - shouldBeEqualToString("internals.pageProperty('margin-left', 4)", "200"); - debug("Set margin to 100px."); appendStyle("@page { margin:100px; }"); shouldBeEqualToString("internals.pageProperty('margin-left', 0)", "100"); |
