Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: third_party/WebKit/LayoutTests/inspector/device-mode/device-mode-switching-devices.html

Issue 2431823002: DevTools: device mode devices remember last used zoom (Closed)
Patch Set: Devices remember last scale Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/inspector/device-mode/device-mode-switching-devices.html
diff --git a/third_party/WebKit/LayoutTests/inspector/device-mode/device-mode-switching-devices.html b/third_party/WebKit/LayoutTests/inspector/device-mode/device-mode-switching-devices.html
new file mode 100644
index 0000000000000000000000000000000000000000..3dfab90a910ce93f191347864481dba687fecebf
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/inspector/device-mode/device-mode-switching-devices.html
@@ -0,0 +1,62 @@
+<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 view = new WebInspector.DeviceModeView();
+ var toolbar = view._toolbar;
+ var model = view._model;
+ var viewportSize = new Size(800, 600);
+ model.setAvailableSize(viewportSize, viewportSize);
+
+ InspectorTest.addResult("Testing orientation preservation.");
+
+ toolbar._emulateDevice(phone0);
+ InspectorTest.addResult("Phone0 Orientation: " + model._mode.orientation);
+ InspectorTest.addResult("Setting mode to horizontal");
+ model.emulate(WebInspector.DeviceModeModel.Type.Device, phone0, horizontalMode);
+ InspectorTest.addResult("Switch to phone 1");
+ toolbar._emulateDevice(phone1);
+ InspectorTest.addResult("Phone1 Orientation: " + model._mode.orientation);
+ toolbar._emulateDevice(phoneWithoutHorizontal);
+ InspectorTest.addResult("Phone without horizontal mode Orientation: " + model._mode.orientation);
+
+ InspectorTest.addResult("Switch to phone 0");
+ toolbar._emulateDevice(phone0);
+
+ InspectorTest.addResult("\nTest that devices remember their scale.");
+ InspectorTest.addResult("Setting scale to 0.5");
+ toolbar._onScaleMenuChanged(0.5);
+ InspectorTest.addResult("Phone0 Scale: " + model._scaleSetting.get());
+ InspectorTest.addResult("Switch to phone 1");
+ toolbar._emulateDevice(phone1);
+ InspectorTest.addResult("Phone1 Scale: " + model._scaleSetting.get());
+ InspectorTest.addResult("Switch to phone 0");
+ toolbar._emulateDevice(phone0);
+ InspectorTest.addResult("Phone0 Scale: " + model._scaleSetting.get());
+
+ InspectorTest.completeTest();
+}
+
+</script>
+</head>
+<body onload="runTest()">
+<p>Test preservation of orientation and scale when that switching devices in device mode.</p>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698