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

Side by Side Diff: LayoutTests/css3/device-adapt/viewport-user-style.html

Issue 23101004: Make configurationForViewport match production code (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Renamed configurationForViewport to viewportAsText Created 7 years, 4 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>User stylesheet containing an @viewport rule</title> 4 <title>User stylesheet containing an @viewport rule</title>
5 <script src="../../resources/testharness.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script> 6 <script src="../../resources/testharnessreport.js"></script>
7 <style> 7 <style>
8 html, body { width: 100%; height: 100%; margin: 0 } 8 html, body { width: 100%; height: 100%; margin: 0 }
9 9
10 @viewport { 10 @viewport {
11 height: 2000px; 11 height: 2000px;
12 } 12 }
13 </style> 13 </style>
14 <script> 14 <script>
15 test(function(){ 15 test(function(){
16 assert_own_property(window, "testRunner"); 16 assert_own_property(window, "testRunner");
17 }, "Check that window.testRunner is present. Required to add a user styl esheet."); 17 }, "Check that window.testRunner is present. Required to add a user styl esheet.");
18 18
19 if (window.testRunner) { 19 if (window.testRunner) {
20 testRunner.addUserStyleSheet("@viewport { width: 450px; height: auto ; zoom: auto; min-zoom: auto; max-zoom: auto }", true); 20 testRunner.addUserStyleSheet("@viewport { width: 450px; height: auto ; zoom: auto; min-zoom: auto; max-zoom: auto }", true);
21 } 21 }
22 </script> 22 </script>
23 </head> 23 </head>
24 <body> 24 <body>
25 <div id="log"></div> 25 <div id="log"></div>
26 <script> 26 <script>
27 test(function(){ 27 test(function(){
28 assert_own_property(window, "internals"); 28 assert_own_property(window, "internals");
29 }, "Check that window.internals is present. Required to call configurati onForViewport."); 29 }, "Check that window.internals is present. Required to call viewportAsT ext.");
30 30
31 var actualWidth; 31 var actualWidth;
32 var actualHeight; 32 var actualHeight;
33 33
34 var vpString = internals.configurationForViewport(document, 1, 320, 480, 320, 352); 34 var vpString = internals.viewportAsText(document, 1, 320, 352);
35 var match = /viewport size (.+)x(.+) scale (.+ )/.exec(vpString); 35 var match = /viewport size (.+)x(.+) scale (.+ )/.exec(vpString);
36 36
37 if (match) { 37 if (match) {
38 actualWidth = parseFloat(match[1]); 38 actualWidth = parseFloat(match[1]);
39 actualHeight = parseFloat(match[2]); 39 actualHeight = parseFloat(match[2]);
40 } 40 }
41 41
42 test(function(){ 42 test(function(){
43 assert_equals(actualWidth, 450); 43 assert_equals(actualWidth, 450);
44 }, "Check that we get the viewport width from the user stylesheet."); 44 }, "Check that we get the viewport width from the user stylesheet.");
45 document.body.offsetHeight; 45 document.body.offsetHeight;
46 46
47 test(function(){ 47 test(function(){
48 assert_equals(actualHeight, 2000); 48 assert_equals(actualHeight, 2000);
49 }, "Check that we get the viewport height from the author stylesheet."); 49 }, "Check that we get the viewport height from the author stylesheet.");
50 </script> 50 </script>
51 </body> 51 </body>
52 </html> 52 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698