| Index: third_party/WebKit/LayoutTests/inspector-protocol/emulation/device-emulation-test.js
|
| diff --git a/third_party/WebKit/LayoutTests/inspector/device-emulation/device-emulation-test.js b/third_party/WebKit/LayoutTests/inspector-protocol/emulation/device-emulation-test.js
|
| similarity index 84%
|
| rename from third_party/WebKit/LayoutTests/inspector/device-emulation/device-emulation-test.js
|
| rename to third_party/WebKit/LayoutTests/inspector-protocol/emulation/device-emulation-test.js
|
| index 97281768b7622a14fa3bf7fe7c9033381f4e3a18..b6e7b2167e29359ec112c56df55e95b4faffaee0 100644
|
| --- a/third_party/WebKit/LayoutTests/inspector/device-emulation/device-emulation-test.js
|
| +++ b/third_party/WebKit/LayoutTests/inspector-protocol/emulation/device-emulation-test.js
|
| @@ -9,13 +9,16 @@ function setMetaViewport(override)
|
|
|
| var viewport = VIEWPORTS["none"];
|
| for (var key in VIEWPORTS) {
|
| - if (location.search == "?" + key) {
|
| + if (location.search.indexOf(key) !== -1) {
|
| viewport = VIEWPORTS[key];
|
| + window.__viewport = key;
|
| break;
|
| }
|
| }
|
| - if (override)
|
| + if (override) {
|
| viewport = VIEWPORTS[override];
|
| + window.__viewport = override;
|
| + }
|
| if (viewport != VIEWPORTS["none"])
|
| document.write('<meta name="viewport" content="'+viewport+'">');
|
| }
|
| @@ -55,7 +58,7 @@ function dumpMetrics(full)
|
| testJS("window.screenX");
|
| testJS("window.screenY");
|
|
|
| - writeResult("Viewport:", location.search);
|
| + writeResult("Viewport:", "?" + window.__viewport);
|
|
|
| testMQOrientation();
|
| testJS("window.orientation", "");
|
| @@ -182,8 +185,6 @@ function writeResult(key, val)
|
|
|
| var initialize_DeviceEmulationTest = function() {
|
|
|
| -InspectorTest.preloadPanel("network");
|
| -
|
| InspectorTest.getPageMetrics = function(full, callback)
|
| {
|
| InspectorTest.evaluateInPage("dumpMetrics(" + full + ")", callback);
|
| @@ -191,35 +192,33 @@ InspectorTest.getPageMetrics = function(full, callback)
|
|
|
| InspectorTest.applyEmulationAndReload = function(enabled, width, height, deviceScaleFactor, viewport, insets, noReload, callback)
|
| {
|
| - function PageResizer()
|
| - {
|
| - }
|
| -
|
| - PageResizer.prototype =
|
| - {
|
| - update: function(dipWidth, dipHeight, scale) { },
|
| - __proto__: WebInspector.Object.prototype
|
| - }
|
| -
|
| - InspectorTest.addSniffer(WebInspector.overridesSupport, "_deviceMetricsOverrideAppliedForTest", emulateCallback);
|
| - if (insets)
|
| - WebInspector.overridesSupport.setPageResizer(new PageResizer(), new Size(10, 10), insets);
|
| - else
|
| - WebInspector.overridesSupport.setPageResizer(null, new Size(0, 0), new Insets(0, 0));
|
| -
|
| if (enabled) {
|
| - var device = {title: "", width: width, height: height, deviceScaleFactor: deviceScaleFactor, userAgent: "", touch: false, mobile: true};
|
| - WebInspector.overridesSupport.emulateDevice(device);
|
| + var params = {};
|
| + params.width = width;
|
| + params.height = height;
|
| + params.deviceScaleFactor = deviceScaleFactor;
|
| + params.mobile = true;
|
| + params.fitWindow = false;
|
| + params.scale = 1;
|
| + params.screenWidth = width;
|
| + params.screenHeight = height;
|
| + params.positionX = 0;
|
| + params.positionY = 0;
|
| + if (insets) {
|
| + params.screenWidth += insets.left + insets.right;
|
| + params.positionX = insets.left;
|
| + params.screenHeight += insets.top + insets.bottom;
|
| + params.positionY = insets.top;
|
| + }
|
| + InspectorTest.sendCommand("Emulation.setDeviceMetricsOverride", params, emulateCallback);
|
| } else {
|
| - WebInspector.overridesSupport.reset();
|
| + InspectorTest.sendCommand("Emulation.clearDeviceMetricsOverride", {}, emulateCallback);
|
| }
|
| - WebInspector.overridesSupport.settings._emulationEnabled.set(enabled);
|
|
|
| - function emulateCallback()
|
| + function emulateCallback(result)
|
| {
|
| - var warning = WebInspector.overridesSupport.warningMessage();
|
| - if (warning)
|
| - InspectorTest._deviceEmulationResults.push("Emulation warning: " + warning);
|
| + if (result.error)
|
| + InspectorTest._deviceEmulationResults.push("Error: " + result.error);
|
| if (noReload)
|
| callback();
|
| else
|
| @@ -235,7 +234,7 @@ InspectorTest.emulateAndGetMetrics = function(width, height, deviceScaleFactor,
|
|
|
| function printMetrics(metrics)
|
| {
|
| - InspectorTest._deviceEmulationResults.push(metrics.value + "\n");
|
| + InspectorTest._deviceEmulationResults.push(metrics + "\n");
|
| callback();
|
| }
|
| };
|
| @@ -248,7 +247,7 @@ InspectorTest.testDeviceEmulation = function(pageUrl, width, height, deviceScale
|
|
|
| function callback()
|
| {
|
| - InspectorTest.addResult(InspectorTest._deviceEmulationResults.join("\n"));
|
| + InspectorTest.log(InspectorTest._deviceEmulationResults.join("\n"));
|
| InspectorTest.completeTest();
|
| }
|
| };
|
|
|