Bug 1355147 - Fix test moving to negative coordinates in headless mac. r=whimboo

Expose if the browser is headless to marionette session capabilities
so the tests can check headless behavior.

MozReview-Commit-ID: 10va2Iv2ytO
This commit is contained in:
Brendan Dahl 2017-07-03 15:43:39 -07:00
Родитель 82161df837
Коммит 465c6d492e
2 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -82,10 +82,16 @@ class TestPosition(MarionetteTestCase):
os = self.marionette.session_capabilities["platformName"]
# Regardless of platform, headless always supports being positioned
# off-screen.
if self.marionette.session_capabilities["moz:headless"]:
self.assertEqual(-8, position["x"])
self.assertEqual(-8, position["y"])
# Certain WMs prohibit windows from being moved off-screen,
# but we don't have this information. It should be safe to
# assume a window can be moved to (0,0) or less.
if os == "linux":
elif os == "linux":
# certain WMs prohibit windows from being moved off-screen
self.assertLessEqual(position["x"], 0)
self.assertLessEqual(position["y"], 0)

Просмотреть файл

@ -4,7 +4,7 @@
"use strict";
const {interfaces: Ci, utils: Cu} = Components;
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://gre/modules/Preferences.jsm");
@ -267,6 +267,7 @@ session.Capabilities = class extends Map {
["moz:processID", Services.appinfo.processID],
["moz:profile", maybeProfile()],
["moz:accessibilityChecks", false],
["moz:headless", Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo).isHeadless],
]);
}