Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css / import-and-insert-rule-no-update.html
blob631f54facb027a9b85fe2745e389cca9f04e663f
1 <!DOCTYPE html>
2 <html><head>
3 <link rel="stylesheet" href="resources/redimport.css"/>
4 </head><body>
5 <div>Test for bug <a href="https://bugs.webkit.org/show_bug.cgi?id=56981">56981</a>: CSSStyleSheet#insertRule doesn't work well with imported stylesheets</div>
6 <div>You should see one PASS below.</div>
7 <div id="testArea"></div>
8 <script>
9 if (window.testRunner) {
10 testRunner.dumpAsText();
11 testRunner.waitUntilDone();
14 var remainingTests = 20;
16 function test() {
17 try {
18 var testArea = document.getElementById("testArea");
19 if (getComputedStyle(testArea).backgroundColor == "rgb(0, 128, 0)") {
20 testArea.innerHTML = 'PASS';
21 remainingTests = 0;
22 } else {
23 if (--remainingTests)
24 testArea.innerHTML = 'FAIL, backgroundColor was ' + getComputedStyle(testArea).backgroundColor;
26 } catch (e) {
27 testArea.innerHTML = 'FAIL, exception raised (' + e.message + ')';
28 remainingTests = 0;
30 if (!remainingTests)
31 window.setTimeout(test, 25);
32 if (window.testRunner)
33 testRunner.notifyDone();
36 function waitForSheetToFinishLoading()
38 if (document.styleSheets.length && document.styleSheets[0].rules[1].styleSheet) {
39 test();
40 return;
43 window.setTimeout(waitForSheetToFinishLoading, 10)
46 window.onload = function() {
47 document.styleSheets[0].insertRule('@import "green.css";', 1);
49 // We need to wait some time to let the stylesheet load before testing.
50 window.setTimeout(waitForSheetToFinishLoading, 10);
52 </script>
53 </body></html>