| OLD | NEW |
| (Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="device-mode-test.js"></script> |
| 5 <script type="text/javascript"> |
| 6 function test() |
| 7 { |
| 8 var phone0 = InspectorTest.buildFakePhone(); |
| 9 var phone1 = InspectorTest.buildFakePhone(); |
| 10 |
| 11 var view = new WebInspector.DeviceModeView(); |
| 12 var toolbar = view._toolbar; |
| 13 var model = view._model; |
| 14 var viewportSize = new Size(320, 480); |
| 15 model.setAvailableSize(viewportSize, viewportSize); |
| 16 |
| 17 InspectorTest.addResult("\nSetting device mode to responsive mode with viewp
ort of size: " + JSON.stringify(viewportSize)); |
| 18 toolbar._switchToResponsive(); |
| 19 dumpModelInfo(); |
| 20 |
| 21 var width = viewportSize.width - 1; |
| 22 InspectorTest.addResult("Setting width to " + width); |
| 23 toolbar._applyWidth(width); |
| 24 dumpModelInfo(); |
| 25 |
| 26 width = viewportSize.width + 1; |
| 27 InspectorTest.addResult("Setting width to " + width); |
| 28 toolbar._applyWidth(width); |
| 29 dumpModelInfo(); |
| 30 |
| 31 InspectorTest.addResult("Setting width to " + viewportSize.width); |
| 32 toolbar._applyWidth(viewportSize.width); |
| 33 dumpModelInfo(); |
| 34 |
| 35 |
| 36 var height = viewportSize.height - 1; |
| 37 InspectorTest.addResult("Setting height to " + height); |
| 38 toolbar._applyHeight(height); |
| 39 dumpModelInfo(); |
| 40 |
| 41 height = viewportSize.height + 1; |
| 42 InspectorTest.addResult("Setting height to " + height); |
| 43 toolbar._applyHeight(height); |
| 44 dumpModelInfo(); |
| 45 |
| 46 InspectorTest.addResult("Setting height to " + viewportSize.height); |
| 47 toolbar._applyHeight(viewportSize.height); |
| 48 dumpModelInfo(); |
| 49 |
| 50 |
| 51 InspectorTest.addResult("\nSetting scale to 0.5"); |
| 52 toolbar._onScaleMenuChanged(0.5); |
| 53 dumpModelInfo(); |
| 54 |
| 55 InspectorTest.addResult("Setting scale to 1"); |
| 56 toolbar._onScaleMenuChanged(1); |
| 57 dumpModelInfo(); |
| 58 |
| 59 InspectorTest.addResult("Setting scale to 1.25"); |
| 60 toolbar._onScaleMenuChanged(1.25); |
| 61 dumpModelInfo(); |
| 62 |
| 63 InspectorTest.completeTest(); |
| 64 |
| 65 function dumpModelInfo() |
| 66 { |
| 67 InspectorTest.addResult("Scale: " + model.scale() + ", appliedDeviceSize
: " + JSON.stringify(model.appliedDeviceSize()) + ", screenRect: " + JSON.string
ify(model.screenRect()) + ", visiblePageRect: " + JSON.stringify(model.visiblePa
geRect()) + ", outlineRect: " + JSON.stringify(model.outlineRect())); |
| 68 } |
| 69 } |
| 70 |
| 71 |
| 72 </script> |
| 73 </head> |
| 74 <body onload="runTest()"> |
| 75 <p>Test that device mode's responsive mode behaves correctly when adjusting inpu
ts.</p> |
| 76 </body> |
| 77 </html> |
| OLD | NEW |