Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/inspector/device-mode-switching-devices.html |
| diff --git a/third_party/WebKit/LayoutTests/inspector/device-mode-switching-devices.html b/third_party/WebKit/LayoutTests/inspector/device-mode-switching-devices.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..272d5c3e4f91dbfddac9e6ea32b37c16f6f34e37 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/inspector/device-mode-switching-devices.html |
| @@ -0,0 +1,55 @@ |
| +<html> |
| +<head> |
| +<script src="../http/tests/inspector/inspector-test.js"></script> |
| +<script src="device-mode.js"></script> |
| +<script type="text/javascript"> |
| +function test() |
| +{ |
| + var verticalMode = { |
| + "title": "default", |
| + "orientation": "vertical", |
| + "insets": { "left": 0, "top": 0, "right": 0, "bottom": 0 } |
| + }; |
| + var horizontalMode = { |
| + "title": "default", |
| + "orientation": "horizontal", |
| + "insets": { "left": 0, "top": 0, "right": 0, "bottom": 0 } |
| + }; |
| + var phone0 = InspectorTest.buildFakePhone({ "modes": [verticalMode, horizontalMode] }); |
| + var phone1 = InspectorTest.buildFakePhone({ "modes": [verticalMode, horizontalMode] }); |
| + var phoneWithoutHorizontal = InspectorTest.buildFakePhone({ "modes": [verticalMode] }); |
| + |
| + var dmv = new WebInspector.DeviceModeView(); |
|
dgozman
2016/10/19 00:42:45
We use no abbreviations. I'd propose view, toolbar
luoe
2016/10/20 00:17:08
Done.
|
| + var dmtoolbar = dmv._toolbar; |
| + var dmmodel = dmv._model; |
| + |
| + InspectorTest.addResult("Testing orientation preservation."); |
| + |
| + dmtoolbar._emulateDevice(phone0); |
| + InspectorTest.addResult("Phone0 Orientation: " + dmmodel._mode.orientation); |
| + InspectorTest.addResult("Setting mode to horizontal"); |
| + dmmodel.emulate(WebInspector.DeviceModeModel.Type.Device, phone0, horizontalMode); |
| + dmtoolbar._emulateDevice(phone1); |
| + InspectorTest.addResult("Phone1 Orientation: " + dmmodel._mode.orientation); |
| + dmtoolbar._emulateDevice(phoneWithoutHorizontal); |
| + InspectorTest.addResult("Phone without horizontal mode Orientation: " + dmmodel._mode.orientation); |
| + |
| + InspectorTest.addResult("\nTesting scale preservation."); |
| + InspectorTest.addResult("Setting scale to 1"); |
| + dmmodel._scaleSetting.set(1); |
| + dmtoolbar._emulateDevice(phone0); |
| + InspectorTest.addResult("Phone0 Scale: " + dmmodel._scaleSetting.get()); |
| + InspectorTest.addResult("Setting scale to 0.5"); |
| + dmmodel._scaleSetting.set(0.5); |
| + dmtoolbar._emulateDevice(phone1); |
| + InspectorTest.addResult("Phone1 Scale: " + dmmodel._scaleSetting.get()); |
| + |
| + InspectorTest.completeTest(); |
| +} |
| + |
| +</script> |
| +</head> |
| +<body onload="runTest()"> |
| +<p>Test that switching devices in device mode should preserve the orientation if possible.</p> |
| +</body> |
| +</html> |