| Index: LayoutTests/inspector/device-emulation/device-emulation-scale-only.html
|
| diff --git a/LayoutTests/inspector/device-emulation/device-emulation-scale-only.html b/LayoutTests/inspector/device-emulation/device-emulation-scale-only.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f1f09f7658692c75076ff81acb8cbcea6d83d675
|
| --- /dev/null
|
| +++ b/LayoutTests/inspector/device-emulation/device-emulation-scale-only.html
|
| @@ -0,0 +1,86 @@
|
| +<html>
|
| +<head>
|
| +
|
| +<script src="../../http/tests/inspector/inspector-test.js"></script>
|
| +
|
| +<style>
|
| +body {
|
| + margin: 0;
|
| + min-height: 1000px;
|
| +}
|
| +</style>
|
| +
|
| +<script>
|
| +function dumpMetrics()
|
| +{
|
| + return JSON.stringify({
|
| + screen: window.screen.width + "x" + window.screen.height,
|
| + position: window.screenX + "x" + window.screenY,
|
| + inner: window.innerWidth + "x" + window.innerHeight,
|
| + body: document.body.offsetWidth + "x" + document.body.offsetHeight,
|
| + dpr: window.devicePixelRatio
|
| + });
|
| +}
|
| +
|
| +function test()
|
| +{
|
| + function getPageMetrics(callback)
|
| + {
|
| + InspectorTest.evaluateInPage("dumpMetrics()", parse);
|
| +
|
| + function parse(json)
|
| + {
|
| + callback(JSON.parse(json.value));
|
| + }
|
| + }
|
| +
|
| + var initialMetrics;
|
| +
|
| + function applyEmulationAndCheckMetrics(deviceScaleFactor, callback)
|
| + {
|
| + InspectorTest.addResult("Overriding device scale factor: " + deviceScaleFactor);
|
| + PageAgent.setDeviceMetricsOverride(0, 0, deviceScaleFactor, false, false, false, 1, getPageMetrics.bind(null, check));
|
| +
|
| + function check(metrics)
|
| + {
|
| + if (metrics.screen !== initialMetrics.screen)
|
| + InspectorTest.addResult("Wrong screen size: " + metrics.screen + " instead of " + initialMetrics.screen);
|
| + if (metrics.position !== initialMetrics.position)
|
| + InspectorTest.addResult("Wrong screen position: " + metrics.position + " instead of " + initialMetrics.position);
|
| + if (metrics.inner !== initialMetrics.inner)
|
| + InspectorTest.addResult("Wrong window size: " + metrics.inner + " instead of " + initialMetrics.inner);
|
| + if (metrics.body !== initialMetrics.body)
|
| + InspectorTest.addResult("Wrong body size: " + metrics.body + " instead of " + initialMetrics.body);
|
| + if (deviceScaleFactor)
|
| + InspectorTest.addResult("Got device scale factor: " + metrics.dpr);
|
| + callback();
|
| + }
|
| + }
|
| +
|
| + function saveInitialMetrics(callback)
|
| + {
|
| + getPageMetrics(save);
|
| +
|
| + function save(metrics)
|
| + {
|
| + initialMetrics = metrics;
|
| + callback();
|
| + }
|
| + }
|
| +
|
| + var complete = InspectorTest.completeTest.bind(InspectorTest);
|
| + var reset = applyEmulationAndCheckMetrics.bind(null, 0, complete);
|
| + var check3 = applyEmulationAndCheckMetrics.bind(null, 3, reset);
|
| + var check2 = applyEmulationAndCheckMetrics.bind(null, 2, check3);
|
| + var check1 = applyEmulationAndCheckMetrics.bind(null, 1, check2);
|
| + saveInitialMetrics(check1);
|
| +}
|
| +</script>
|
| +
|
| +</head>
|
| +<body onload="runTest()">
|
| +<p>
|
| +Tests that overriding only device scale factor does not affect any other value.
|
| +</p>
|
| +</body>
|
| +</html>
|
|
|