зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1605494 - Use update channel instead of debug to determine if we can mock the OS auth dialog. r=MattN
Differential Revision: https://phabricator.services.mozilla.com/D66853 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
11960d15cc
Коммит
244f33a489
|
@ -3,9 +3,9 @@ support-files =
|
|||
head.js
|
||||
|
||||
# Run first so content events from previous tests won't trickle in.
|
||||
# Skip ASAN since waiting for content events is already slow.
|
||||
# Skip ASAN and debug since waiting for content events is already slow.
|
||||
[browser_aaa_eventTelemetry_run_first.js]
|
||||
skip-if = asan || (os == 'linux') # bug 1605494 is more prevalent on linux
|
||||
skip-if = asan || debug
|
||||
[browser_breachAlertDismissals.js]
|
||||
skip-if = asan || debug || verify # bug 1574023
|
||||
[browser_breachAlertShowingForAddedLogin.js]
|
||||
|
@ -30,11 +30,9 @@ skip-if = (os != "win" && os != "mac") # import is only available on Windows and
|
|||
[browser_openPreferences.js]
|
||||
[browser_openPreferencesExternal.js]
|
||||
[browser_openSite.js]
|
||||
skip-if = !debug # test relies on edit mode which is only testable in debug builds
|
||||
[browser_osAuthDialog.js]
|
||||
skip-if = ((os == 'linux') || !debug) # bug 1527745
|
||||
skip-if = (os == 'linux') # bug 1527745
|
||||
[browser_sessionRestore.js]
|
||||
skip-if = debug # Bug 1576876
|
||||
[browser_tabKeyNav.js]
|
||||
[browser_updateLogin.js]
|
||||
skip-if = !debug # test relies on edit mode which is only testable in debug builds
|
||||
|
|
|
@ -138,7 +138,7 @@ add_task(async function test_login_item() {
|
|||
|
||||
let onDeletePromise;
|
||||
if (OSKeyStoreTestUtils.canTestOSKeyStoreLogin()) {
|
||||
// Can only test Edit mode in debug builds
|
||||
// Can only test Edit mode in official builds
|
||||
onDeletePromise = waitForDelete();
|
||||
await deleteFirstLoginAfterEdit();
|
||||
await onDeletePromise;
|
||||
|
|
|
@ -25,16 +25,16 @@ add_task(async function test_showLoginItemErrors() {
|
|||
);
|
||||
LOGIN_TO_UPDATE = Services.logins.addLogin(LOGIN_TO_UPDATE);
|
||||
EXPECTED_ERROR_MESSAGE = "This login already exists.";
|
||||
const LOGIN_UPDATES = {
|
||||
origin: "https://example.com",
|
||||
password: "my1GoodPassword",
|
||||
username: "user1",
|
||||
};
|
||||
|
||||
await SpecialPowers.spawn(
|
||||
browser,
|
||||
[
|
||||
[
|
||||
LoginHelper.loginToVanillaObject(LOGIN_TO_UPDATE),
|
||||
OSKeyStoreTestUtils.canTestOSKeyStoreLogin(),
|
||||
],
|
||||
],
|
||||
async ([loginToUpdate, canTestOSKeyStoreLogin]) => {
|
||||
[[LoginHelper.loginToVanillaObject(LOGIN_TO_UPDATE), LOGIN_UPDATES]],
|
||||
async ([loginToUpdate, loginUpdates]) => {
|
||||
const loginItem = Cu.waiveXrays(
|
||||
content.document.querySelector("login-item")
|
||||
);
|
||||
|
@ -48,12 +48,6 @@ add_task(async function test_showLoginItemErrors() {
|
|||
const createButton = loginList._createLoginButton;
|
||||
createButton.click();
|
||||
|
||||
const loginUpdates = {
|
||||
origin: "https://example.com",
|
||||
password: "my1GoodPassword",
|
||||
username: "user1",
|
||||
};
|
||||
|
||||
const event = Cu.cloneInto(
|
||||
{
|
||||
bubbles: true,
|
||||
|
@ -108,12 +102,20 @@ add_task(async function test_showLoginItemErrors() {
|
|||
loginItemErrorMessage.hidden,
|
||||
"The error message should no longer be visible."
|
||||
);
|
||||
|
||||
if (!canTestOSKeyStoreLogin) {
|
||||
// The rest of the test uses Edit mode which causes an OS prompt in opt builds.
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
if (!OSKeyStoreTestUtils.canTestOSKeyStoreLogin()) {
|
||||
// The rest of the test uses Edit mode which causes an OS prompt in official builds.
|
||||
return;
|
||||
}
|
||||
let reauthObserved = OSKeyStoreTestUtils.waitForOSKeyStoreLogin(true);
|
||||
await SpecialPowers.spawn(
|
||||
browser,
|
||||
[[LoginHelper.loginToVanillaObject(LOGIN_TO_UPDATE), LOGIN_UPDATES]],
|
||||
async ([loginToUpdate, loginUpdates]) => {
|
||||
const loginItem = Cu.waiveXrays(
|
||||
content.document.querySelector("login-item")
|
||||
);
|
||||
const editButton = loginItem.shadowRoot.querySelector(".edit-button");
|
||||
editButton.click();
|
||||
|
||||
|
@ -130,6 +132,9 @@ add_task(async function test_showLoginItemErrors() {
|
|||
new content.CustomEvent("AboutLoginsUpdateLogin", updateEvent)
|
||||
);
|
||||
|
||||
const loginItemErrorMessage = Cu.waiveXrays(
|
||||
loginItem.shadowRoot.querySelector(".error-message")
|
||||
);
|
||||
const loginAlreadyExistsErrorShownAfterUpdate = await ContentTaskUtils.waitForCondition(
|
||||
() => {
|
||||
return !loginItemErrorMessage.hidden;
|
||||
|
@ -142,5 +147,8 @@ add_task(async function test_showLoginItemErrors() {
|
|||
);
|
||||
}
|
||||
);
|
||||
info("making sure os auth dialog is shown");
|
||||
await reauthObserved;
|
||||
info("saw os auth dialog");
|
||||
EXPECTED_ERROR_MESSAGE = null;
|
||||
});
|
||||
|
|
|
@ -25,8 +25,8 @@ add_task(async function test_sort_order_persisted() {
|
|||
async function(browser) {
|
||||
await ContentTask.spawn(
|
||||
browser,
|
||||
[TEST_LOGIN1, TEST_LOGIN2],
|
||||
async function([testLogin1, testLogin2]) {
|
||||
[TEST_LOGIN1.guid, TEST_LOGIN2.guid],
|
||||
async function([testLogin1Guid, testLogin2Guid]) {
|
||||
let loginList = Cu.waiveXrays(
|
||||
content.document.querySelector("login-list")
|
||||
);
|
||||
|
@ -39,7 +39,7 @@ add_task(async function test_sort_order_persisted() {
|
|||
loginList._list.querySelector(
|
||||
".login-list-item[data-guid]:not([hidden])"
|
||||
).dataset.guid,
|
||||
testLogin2.guid,
|
||||
testLogin2Guid,
|
||||
"the first login should be TEST_LOGIN2 since they are sorted by origin"
|
||||
);
|
||||
|
||||
|
@ -51,7 +51,7 @@ add_task(async function test_sort_order_persisted() {
|
|||
loginList._list.querySelector(
|
||||
".login-list-item[data-guid]:not([hidden])"
|
||||
).dataset.guid,
|
||||
testLogin1.guid,
|
||||
testLogin1Guid,
|
||||
"the first login should be TEST_LOGIN1 since it has the most recent timePasswordChanged value"
|
||||
);
|
||||
}
|
||||
|
@ -65,7 +65,9 @@ add_task(async function test_sort_order_persisted() {
|
|||
url: "about:logins",
|
||||
},
|
||||
async function(browser) {
|
||||
await ContentTask.spawn(browser, TEST_LOGIN1, async function(testLogin1) {
|
||||
await ContentTask.spawn(browser, TEST_LOGIN1.guid, async function(
|
||||
testLogin1Guid
|
||||
) {
|
||||
let loginList = Cu.waiveXrays(
|
||||
content.document.querySelector("login-list")
|
||||
);
|
||||
|
@ -78,7 +80,7 @@ add_task(async function test_sort_order_persisted() {
|
|||
loginList._list.querySelector(
|
||||
".login-list-item[data-guid]:not([hidden])"
|
||||
).dataset.guid,
|
||||
testLogin1.guid,
|
||||
testLogin1Guid,
|
||||
"the first login should still be TEST_LOGIN1 since it has the most recent timePasswordChanged value"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -22,6 +22,30 @@ add_task(async function test_launch_login_item() {
|
|||
);
|
||||
|
||||
let browser = gBrowser.selectedBrowser;
|
||||
|
||||
await SpecialPowers.spawn(browser, [], async () => {
|
||||
let loginItem = Cu.waiveXrays(content.document.querySelector("login-item"));
|
||||
let originInput = loginItem.shadowRoot.querySelector("a[name='origin']");
|
||||
let EventUtils = ContentTaskUtils.getEventUtils(content);
|
||||
// Use synthesizeMouseAtCenter to generate an event that more closely resembles the
|
||||
// properties of the event object that will be seen when the user clicks the element
|
||||
// (.click() sets originalTarget while synthesizeMouse has originalTarget as a Restricted object).
|
||||
await EventUtils.synthesizeMouseAtCenter(originInput, {}, content);
|
||||
});
|
||||
|
||||
info("waiting for new tab to get opened");
|
||||
let newTab = await promiseNewTab;
|
||||
ok(true, "New tab opened to " + TEST_LOGIN1.origin);
|
||||
BrowserTestUtils.removeTab(newTab);
|
||||
|
||||
if (!OSKeyStoreTestUtils.canTestOSKeyStoreLogin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
promiseNewTab = BrowserTestUtils.waitForNewTab(
|
||||
gBrowser,
|
||||
TEST_LOGIN1.origin + "/"
|
||||
);
|
||||
let reauthObserved = OSKeyStoreTestUtils.waitForOSKeyStoreLogin(true);
|
||||
await SpecialPowers.spawn(browser, [], async () => {
|
||||
let loginItem = Cu.waiveXrays(content.document.querySelector("login-item"));
|
||||
|
@ -46,7 +70,7 @@ add_task(async function test_launch_login_item() {
|
|||
});
|
||||
|
||||
info("waiting for new tab to get opened");
|
||||
let newTab = await promiseNewTab;
|
||||
newTab = await promiseNewTab;
|
||||
ok(true, "New tab opened to " + TEST_LOGIN1.origin);
|
||||
|
||||
let modifiedLogin = TEST_LOGIN1.clone();
|
||||
|
|
|
@ -4,6 +4,19 @@
|
|||
ChromeUtils.import("resource://testing-common/OSKeyStoreTestUtils.jsm", this);
|
||||
|
||||
add_task(async function test() {
|
||||
info(
|
||||
`updatechannel: ${UpdateUtils.getUpdateChannel(false)}; platform: ${
|
||||
AppConstants.platform
|
||||
}`
|
||||
);
|
||||
if (!OSKeyStoreTestUtils.canTestOSKeyStoreLogin()) {
|
||||
ok(
|
||||
true,
|
||||
`skipping test since oskeystore cannot be automated in this environment`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
TEST_LOGIN1 = await addLogin(TEST_LOGIN1);
|
||||
|
||||
await BrowserTestUtils.openNewForegroundTab({
|
||||
|
|
|
@ -30,6 +30,10 @@ add_task(async function test_show_logins() {
|
|||
});
|
||||
|
||||
add_task(async function test_login_item() {
|
||||
if (!OSKeyStoreTestUtils.canTestOSKeyStoreLogin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
async function test_discard_dialog(login, exitPointSelector) {
|
||||
let loginItem = Cu.waiveXrays(content.document.querySelector("login-item"));
|
||||
let loginList = Cu.waiveXrays(content.document.querySelector("login-list"));
|
||||
|
|
|
@ -20,6 +20,11 @@ ChromeUtils.defineModuleGetter(
|
|||
"AppConstants",
|
||||
"resource://gre/modules/AppConstants.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"UpdateUtils",
|
||||
"resource://gre/modules/UpdateUtils.jsm"
|
||||
);
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
this,
|
||||
"nativeOSKeyStore",
|
||||
|
@ -171,7 +176,11 @@ var OSKeyStore = {
|
|||
|
||||
let unlockPromise;
|
||||
if (typeof reauth == "string") {
|
||||
if (AppConstants.DEBUG && this._testReauth) {
|
||||
// Only allow for local builds
|
||||
if (
|
||||
UpdateUtils.getUpdateChannel(false) == "default" &&
|
||||
this._testReauth
|
||||
) {
|
||||
unlockPromise = this._reauthInTests();
|
||||
} else if (
|
||||
AppConstants.platform == "win" ||
|
||||
|
|
|
@ -9,6 +9,11 @@ ChromeUtils.import("resource:///modules/OSKeyStore.jsm", this);
|
|||
const { AppConstants } = ChromeUtils.import(
|
||||
"resource://gre/modules/AppConstants.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"UpdateUtils",
|
||||
"resource://gre/modules/UpdateUtils.jsm"
|
||||
);
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const { TestUtils } = ChromeUtils.import(
|
||||
"resource://testing-common/TestUtils.jsm"
|
||||
|
@ -39,7 +44,10 @@ var OSKeyStoreTestUtils = {
|
|||
*/
|
||||
canTestOSKeyStoreLogin() {
|
||||
// Skip on Linux due to bug 1527745.
|
||||
return AppConstants.DEBUG && AppConstants.platform != "linux";
|
||||
return (
|
||||
UpdateUtils.getUpdateChannel(false) == "default" &&
|
||||
AppConstants.platform != "linux"
|
||||
);
|
||||
},
|
||||
|
||||
// Wait for the observer message that simulates login success of failure.
|
||||
|
|
|
@ -8,7 +8,6 @@ skip-if = toolkit == 'android'
|
|||
[test_HomePage_ignore.js]
|
||||
[test_LiveBookmarkMigrator.js]
|
||||
[test_osKeyStore.js]
|
||||
skip-if = !debug # test relies on osKeyStore reauth which is only testable in debug builds
|
||||
[test_Sanitizer_interrupted.js]
|
||||
[test_SitePermissions.js]
|
||||
[test_SiteDataManager.js]
|
||||
|
|
Загрузка…
Ссылка в новой задаче