Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / css3 / device-adapt / viewport-delete-rule.html
blob159f35269ca3470869ece2e03f8079861e160cd4
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Insert and delete @viewport rule</title>
5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script>
7 <style>
8 html { width: 100%; height: 100%; }
9 </style>
10 <script>
11 if (window.testRunner) {
12 internals.settings.setViewportEnabled(true);
15 var t1 = async_test("Check that added @viewport rule is applied.");
16 var t2 = async_test("Check that @viewport rule is not applied after removal.");
18 onload = function(){
20 var origWidth = document.documentElement.offsetWidth;
21 var origHeight = document.documentElement.offsetHeight;
23 document.styleSheets[0].insertRule("@viewport { width: 400px; height: 400px; }", 0);
25 t1.step(function(){
26 assert_equals(document.documentElement.offsetWidth, 400, "Width is 400px.");
27 assert_equals(document.documentElement.offsetHeight, 400, "Height is 400px.");
28 });
29 t1.done();
31 document.styleSheets[0].deleteRule(0);
33 t2.step(function(){
34 assert_equals(document.documentElement.offsetWidth, origWidth, "Width is default width.");
35 assert_equals(document.documentElement.offsetHeight, origHeight, "Height is default height.");
36 });
37 t2.done();
39 </script>
40 </head>
41 <body style="overflow: hidden">
42 <div id="log"></div>
43 </body>
44 </html>