Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script src="device-mode.js"></script> | |
| 5 <script type="text/javascript"> | |
| 6 function test() | |
| 7 { | |
| 8 var verticalMode = { | |
| 9 "title": "default", | |
| 10 "orientation": "vertical", | |
| 11 "insets": { "left": 0, "top": 0, "right": 0, "bottom": 0 } | |
| 12 }; | |
| 13 var horizontalMode = { | |
| 14 "title": "default", | |
| 15 "orientation": "horizontal", | |
| 16 "insets": { "left": 0, "top": 0, "right": 0, "bottom": 0 } | |
| 17 }; | |
| 18 var phone0 = InspectorTest.buildFakePhone({ "modes": [verticalMode, horizont alMode] }); | |
| 19 var phone1 = InspectorTest.buildFakePhone({ "modes": [verticalMode, horizont alMode] }); | |
| 20 var phoneWithoutHorizontal = InspectorTest.buildFakePhone({ "modes": [vertic alMode] }); | |
| 21 | |
| 22 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.
| |
| 23 var dmtoolbar = dmv._toolbar; | |
| 24 var dmmodel = dmv._model; | |
| 25 | |
| 26 InspectorTest.addResult("Testing orientation preservation."); | |
| 27 | |
| 28 dmtoolbar._emulateDevice(phone0); | |
| 29 InspectorTest.addResult("Phone0 Orientation: " + dmmodel._mode.orientation); | |
| 30 InspectorTest.addResult("Setting mode to horizontal"); | |
| 31 dmmodel.emulate(WebInspector.DeviceModeModel.Type.Device, phone0, horizontal Mode); | |
| 32 dmtoolbar._emulateDevice(phone1); | |
| 33 InspectorTest.addResult("Phone1 Orientation: " + dmmodel._mode.orientation); | |
| 34 dmtoolbar._emulateDevice(phoneWithoutHorizontal); | |
| 35 InspectorTest.addResult("Phone without horizontal mode Orientation: " + dmmo del._mode.orientation); | |
| 36 | |
| 37 InspectorTest.addResult("\nTesting scale preservation."); | |
| 38 InspectorTest.addResult("Setting scale to 1"); | |
| 39 dmmodel._scaleSetting.set(1); | |
| 40 dmtoolbar._emulateDevice(phone0); | |
| 41 InspectorTest.addResult("Phone0 Scale: " + dmmodel._scaleSetting.get()); | |
| 42 InspectorTest.addResult("Setting scale to 0.5"); | |
| 43 dmmodel._scaleSetting.set(0.5); | |
| 44 dmtoolbar._emulateDevice(phone1); | |
| 45 InspectorTest.addResult("Phone1 Scale: " + dmmodel._scaleSetting.get()); | |
| 46 | |
| 47 InspectorTest.completeTest(); | |
| 48 } | |
| 49 | |
| 50 </script> | |
| 51 </head> | |
| 52 <body onload="runTest()"> | |
| 53 <p>Test that switching devices in device mode should preserve the orientation if possible.</p> | |
| 54 </body> | |
| 55 </html> | |
| OLD | NEW |