Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
| 2 <html> | |
|
Rick Byers
2014/11/18 20:53:31
nit: omit html, head and body tags: http://www.chr
bokan
2014/11/18 23:21:50
Done.
| |
| 3 <head> | |
| 4 <script src="../../../resources/js-test.js"></script> | |
| 5 <style> | |
| 6 body { | |
| 7 padding: 0px; | |
| 8 margin: 0px; | |
| 9 } | |
| 10 | |
| 11 .spacer { | |
| 12 position: absolute; | |
| 13 left: 0px; | |
| 14 top: 0px; | |
| 15 margin: 0px; | |
| 16 padding: 0px; | |
| 17 width: 2000px; | |
| 18 height: 1500px; | |
| 19 } | |
| 20 </style> | |
| 21 </head> | |
| 22 <body> | |
| 23 <script language="JavaScript" type="text/javascript"> | |
| 24 if (window.testRunner && window.internals) { | |
| 25 window.jsTestIsAsync = true; | |
| 26 window.eventSender.setPageScaleFactorLimits(0.25, 4.0); | |
| 27 testRunner.dumpAsText(); | |
| 28 testRunner.waitUntilDone(); | |
| 29 } | |
| 30 | |
| 31 description("This test makes sure the window properties related to the\ | |
| 32 viewport remain correct under pinch-to-zoom."); | |
| 33 | |
| 34 debug('===Unscaled==='); | |
| 35 shouldBe('window.innerWidth', '800'); | |
| 36 shouldBe('window.innerHeight', '600'); | |
| 37 | |
| 38 function testPinchedIn() { | |
| 39 debug(''); | |
| 40 debug('===Pinch Zoom in to 2X==='); | |
| 41 debug(''); | |
| 42 window.eventSender.setPageScaleFactor(2.0, 0, 0); | |
| 43 shouldBe('window.innerWidth', '400'); | |
| 44 shouldBe('window.innerHeight', '300'); | |
| 45 shouldBe('window.scrollX', '0'); | |
| 46 shouldBe('window.scrollY', '0'); | |
| 47 | |
| 48 window.scrollBy(10, 20); | |
| 49 shouldBe('window.scrollX', '10'); | |
| 50 shouldBe('window.scrollY', '20'); | |
| 51 window.scrollBy(1590, 1180); | |
| 52 shouldBe('window.scrollX', '1600'); | |
| 53 shouldBe('window.scrollY', '1200'); | |
| 54 window.scrollBy(-1600, -1200); | |
| 55 shouldBe('window.scrollX', '0'); | |
| 56 shouldBe('window.scrollY', '0'); | |
| 57 window.scrollTo(1600, 1200); | |
| 58 shouldBe('window.scrollX', '1600'); | |
| 59 shouldBe('window.scrollY', '1200'); | |
| 60 window.scrollTo(0, 0); | |
| 61 shouldBe('window.scrollX', '0'); | |
| 62 shouldBe('window.scrollY', '0'); | |
| 63 } | |
| 64 | |
| 65 function testPinchedOut() { | |
| 66 debug(''); | |
| 67 debug('===Pinch Out to 0.5X==='); | |
| 68 debug(''); | |
| 69 window.eventSender.setPageScaleFactor(0.5, 0, 0); | |
| 70 shouldBe('window.innerWidth', '1600'); | |
| 71 shouldBe('window.innerHeight', '1200'); | |
| 72 shouldBe('window.scrollX', '0'); | |
| 73 shouldBe('window.scrollY', '0'); | |
| 74 | |
| 75 window.scrollBy(10, 20); | |
| 76 shouldBe('window.scrollX', '10'); | |
| 77 shouldBe('window.scrollY', '20'); | |
| 78 window.scrollBy(390, 280); | |
| 79 shouldBe('window.scrollX', '400'); | |
| 80 shouldBe('window.scrollY', '300'); | |
| 81 window.scrollBy(-400, -300); | |
| 82 shouldBe('window.scrollX', '0'); | |
| 83 shouldBe('window.scrollY', '0'); | |
| 84 window.scrollTo(400, 300); | |
| 85 shouldBe('window.scrollX', '400'); | |
| 86 shouldBe('window.scrollY', '300'); | |
| 87 window.scrollTo(0, 0); | |
| 88 shouldBe('window.scrollX', '0'); | |
| 89 shouldBe('window.scrollY', '0'); | |
| 90 } | |
| 91 | |
| 92 function testMaximallyPinchedOut() { | |
| 93 debug(''); | |
| 94 debug('===Pinch Out to 0.4X (Minimum Scale)==='); | |
| 95 debug(''); | |
| 96 window.eventSender.setPageScaleFactor(0.4, 0, 0); | |
| 97 shouldBe('window.innerWidth', '2000'); | |
| 98 shouldBe('window.innerHeight', '1500'); | |
| 99 shouldBe('window.scrollX', '0'); | |
| 100 shouldBe('window.scrollY', '0'); | |
| 101 | |
| 102 window.scrollBy(10000, 10000); | |
| 103 shouldBe('window.scrollX', '0'); | |
| 104 shouldBe('window.scrollY', '0'); | |
| 105 window.scrollTo(10000, 10000); | |
| 106 shouldBe('window.scrollX', '0'); | |
| 107 shouldBe('window.scrollY', '0'); | |
| 108 } | |
| 109 | |
| 110 function runTests() { | |
| 111 if (window.testRunner && window.internals) { | |
| 112 testPinchedIn(); | |
| 113 testPinchedOut(); | |
| 114 testMaximallyPinchedOut(); | |
| 115 testRunner.notifyDone(); | |
| 116 } | |
| 117 } | |
| 118 | |
| 119 setTimeout(runTests, 100); | |
|
Rick Byers
2014/11/18 20:53:31
where does this 100 come from? You should be able
bokan
2014/11/18 23:21:50
Yah, I was worried about flakiness but there's som
Rick Byers
2014/11/20 19:23:30
Great. Note that there are lots of tests that exp
| |
| 120 | |
| 121 </script> | |
|
Rick Byers
2014/11/18 20:53:31
you also fixed a bug with firing missing 'scroll'
bokan
2014/11/18 23:21:50
Right, thanks, added. The only issue is that scrol
Rick Byers
2014/11/20 19:23:30
I'm a little worried about this being flaky - eg.
bokan
2014/11/20 20:30:41
That worked perfectly. Thanks for keeping us hones
| |
| 122 <div class="spacer"></div> | |
| 123 </body> | |
| 124 </html> | |
| OLD | NEW |