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

Unified Diff: LayoutTests/inspector/device-emulation/device-emulation-test.js

Issue 1209013002: [DevTools] Add test for screen size and position overrides. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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
« no previous file with comments | « LayoutTests/inspector/device-emulation/device-emulation-restore.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/inspector/device-emulation/device-emulation-test.js
diff --git a/LayoutTests/inspector/device-emulation/device-emulation-test.js b/LayoutTests/inspector/device-emulation/device-emulation-test.js
index 94dc04d440fbefa70c4ab404d512c4025679def3..c4814f21a73ef7f531eb1b308b6f6b9e310aa166 100644
--- a/LayoutTests/inspector/device-emulation/device-emulation-test.js
+++ b/LayoutTests/inspector/device-emulation/device-emulation-test.js
@@ -187,9 +187,24 @@ InspectorTest.getPageMetrics = function(full, callback)
InspectorTest.evaluateInPage("dumpMetrics(" + full + ")", callback);
}
-InspectorTest.applyEmulationAndReload = function(enabled, width, height, deviceScaleFactor, viewport, callback)
+InspectorTest.applyEmulationAndReload = function(enabled, width, height, deviceScaleFactor, viewport, insets, 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);
@@ -207,11 +222,11 @@ InspectorTest.applyEmulationAndReload = function(enabled, width, height, deviceS
}
};
-InspectorTest.emulateAndGetMetrics = function(width, height, deviceScaleFactor, viewport, callback)
+InspectorTest.emulateAndGetMetrics = function(width, height, deviceScaleFactor, viewport, insets, callback)
{
InspectorTest._deviceEmulationResults.push("Emulating device: " + width + "x" + height + "x" + deviceScaleFactor + " viewport='" + viewport + "'");
var full = !!width && !!height && !!deviceScaleFactor;
- InspectorTest.applyEmulationAndReload(true, width, height, deviceScaleFactor, viewport, InspectorTest.getPageMetrics.bind(InspectorTest, full, printMetrics));
+ InspectorTest.applyEmulationAndReload(true, width, height, deviceScaleFactor, viewport, insets, InspectorTest.getPageMetrics.bind(InspectorTest, full, printMetrics));
function printMetrics(metrics)
{
@@ -220,11 +235,11 @@ InspectorTest.emulateAndGetMetrics = function(width, height, deviceScaleFactor,
}
};
-InspectorTest.testDeviceEmulation = function(pageUrl, width, height, deviceScaleFactor, viewport)
+InspectorTest.testDeviceEmulation = function(pageUrl, width, height, deviceScaleFactor, viewport, insets)
{
InspectorTest._deviceEmulationPageUrl = pageUrl;
InspectorTest._deviceEmulationResults = [];
- InspectorTest.emulateAndGetMetrics(width, height, deviceScaleFactor, viewport, callback);
+ InspectorTest.emulateAndGetMetrics(width, height, deviceScaleFactor, viewport, insets, callback);
function callback()
{
« no previous file with comments | « LayoutTests/inspector/device-emulation/device-emulation-restore.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698