OLD | NEW |
(Empty) | |
| 1 (async function(testRunner) { |
| 2 let {page, session, dp} = await testRunner.startBlank(` |
| 3 Tests that turning on device emulation with a non-1 device pixel ratio sets
the |
| 4 appropriate initial scale. Page scale is reflected by the innerWidth and |
| 5 innerHeight properties. Since the layout width is set to 980 (in the viewpor
t |
| 6 meta tag), and the emulated viewport width is 490 px, the initial scale shou
ld |
| 7 be 490/980 = 0.5. i.e. innerWidth=980 innerHeight=640.`); |
| 8 |
| 9 var DeviceEmulator = await testRunner.loadScript('../resources/device-emulator
.js'); |
| 10 var deviceEmulator = new DeviceEmulator(testRunner, session); |
| 11 // 980px viewport loaded into a 490x320 screen should load at 0.5 scale. |
| 12 await deviceEmulator.emulate(490, 320, 3); |
| 13 |
| 14 var viewport = 'w=980'; |
| 15 testRunner.log(`Loading page with viewport=${viewport}`); |
| 16 await session.navigate('../resources/device-emulation.html?' + viewport); |
| 17 |
| 18 testRunner.log(await session.evaluate(`dumpMetrics(true)`)); |
| 19 testRunner.completeTest(); |
| 20 }) |
OLD | NEW |