| <html> |
| <head> |
| <script src="../../http/tests/inspector/inspector-test.js"></script> |
| <script src="device-mode-test.js"></script> |
| <script type="text/javascript"> |
| function test() |
| { |
| var phone0 = InspectorTest.buildFakePhone(); |
| var phone1 = InspectorTest.buildFakePhone(); |
| |
| var view = new WebInspector.DeviceModeView(); |
| var toolbar = view._toolbar; |
| var model = view._model; |
| var viewportSize = new Size(320, 480); |
| model.setAvailableSize(viewportSize, viewportSize); |
| |
| InspectorTest.addResult("\nSetting device mode to responsive mode with viewport of size: " + JSON.stringify(viewportSize)); |
| toolbar._switchToResponsive(); |
| dumpModelInfo(); |
| |
| var width = viewportSize.width - 1; |
| InspectorTest.addResult("Setting width to " + width); |
| toolbar._applyWidth(width); |
| dumpModelInfo(); |
| |
| width = viewportSize.width + 1; |
| InspectorTest.addResult("Setting width to " + width); |
| toolbar._applyWidth(width); |
| dumpModelInfo(); |
| |
| InspectorTest.addResult("Setting width to " + viewportSize.width); |
| toolbar._applyWidth(viewportSize.width); |
| dumpModelInfo(); |
| |
| |
| var height = viewportSize.height - 1; |
| InspectorTest.addResult("Setting height to " + height); |
| toolbar._applyHeight(height); |
| dumpModelInfo(); |
| |
| height = viewportSize.height + 1; |
| InspectorTest.addResult("Setting height to " + height); |
| toolbar._applyHeight(height); |
| dumpModelInfo(); |
| |
| InspectorTest.addResult("Setting height to " + viewportSize.height); |
| toolbar._applyHeight(viewportSize.height); |
| dumpModelInfo(); |
| |
| |
| InspectorTest.addResult("\nSetting scale to 0.5"); |
| toolbar._onScaleMenuChanged(0.5); |
| dumpModelInfo(); |
| |
| InspectorTest.addResult("Setting scale to 1"); |
| toolbar._onScaleMenuChanged(1); |
| dumpModelInfo(); |
| |
| InspectorTest.addResult("Setting scale to 1.25"); |
| toolbar._onScaleMenuChanged(1.25); |
| dumpModelInfo(); |
| |
| InspectorTest.completeTest(); |
| |
| function dumpModelInfo() |
| { |
| InspectorTest.addResult("Scale: " + model.scale() + ", appliedDeviceSize: " + JSON.stringify(model.appliedDeviceSize()) + ", screenRect: " + JSON.stringify(model.screenRect()) + ", visiblePageRect: " + JSON.stringify(model.visiblePageRect()) + ", outlineRect: " + JSON.stringify(model.outlineRect())); |
| } |
| } |
| |
| |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>Test that device mode's responsive mode behaves correctly when adjusting inputs.</p> |
| </body> |
| </html> |