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 view = new WebInspector.DeviceModeView(); |
| 23 var toolbar = view._toolbar; |
| 24 var model = view._model; |
| 25 var viewportSize = new Size(800, 600); |
| 26 model.setAvailableSize(viewportSize, viewportSize); |
| 27 |
| 28 InspectorTest.addResult("Testing orientation preservation."); |
| 29 |
| 30 toolbar._emulateDevice(phone0); |
| 31 InspectorTest.addResult("Phone0 Orientation: " + model._mode.orientation); |
| 32 InspectorTest.addResult("Setting mode to horizontal"); |
| 33 model.emulate(WebInspector.DeviceModeModel.Type.Device, phone0, horizontalMo
de); |
| 34 InspectorTest.addResult("Switch to phone 1"); |
| 35 toolbar._emulateDevice(phone1); |
| 36 InspectorTest.addResult("Phone1 Orientation: " + model._mode.orientation); |
| 37 toolbar._emulateDevice(phoneWithoutHorizontal); |
| 38 InspectorTest.addResult("Phone without horizontal mode Orientation: " + mode
l._mode.orientation); |
| 39 |
| 40 InspectorTest.addResult("Switch to phone 0"); |
| 41 toolbar._emulateDevice(phone0); |
| 42 |
| 43 InspectorTest.addResult("\nTest that devices remember their scale."); |
| 44 InspectorTest.addResult("Setting scale to 0.5"); |
| 45 toolbar._onScaleMenuChanged(0.5); |
| 46 InspectorTest.addResult("Phone0 Scale: " + model._scaleSetting.get()); |
| 47 InspectorTest.addResult("Switch to phone 1"); |
| 48 toolbar._emulateDevice(phone1); |
| 49 InspectorTest.addResult("Phone1 Scale: " + model._scaleSetting.get()); |
| 50 InspectorTest.addResult("Switch to phone 0"); |
| 51 toolbar._emulateDevice(phone0); |
| 52 InspectorTest.addResult("Phone0 Scale: " + model._scaleSetting.get()); |
| 53 |
| 54 InspectorTest.completeTest(); |
| 55 } |
| 56 |
| 57 </script> |
| 58 </head> |
| 59 <body onload="runTest()"> |
| 60 <p>Test preservation of orientation and scale when that switching devices in dev
ice mode.</p> |
| 61 </body> |
| 62 </html> |
OLD | NEW |