Bug 1654592 - pref on pwmgr doorhanger updates for test...getUsernameSuggestions;r=bdanforth
authorSeverin <srudie@mozilla.com>
Fri, 24 Jul 2020 00:18:41 +0000
changeset 541873 c87e89d04ff67ee39c812a6d0cf5dcc6c0b72570
parent 541872 13e76078fe27098c4614cfd7a0645b76738d74c1
child 541874 174edf951335515b43be262d9a42eaadd29dc94f
push id37633
push userccoroiu@mozilla.com
push dateFri, 24 Jul 2020 09:32:06 +0000
treeherdermozilla-central@141543043270 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbdanforth
bugs1654592
milestone80.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1654592 - pref on pwmgr doorhanger updates for test...getUsernameSuggestions;r=bdanforth Differential Revision: https://phabricator.services.mozilla.com/D84559
toolkit/components/passwordmgr/test/unit/test_LoginManagerPrompter_getUsernameSuggestions.js
--- a/toolkit/components/passwordmgr/test/unit/test_LoginManagerPrompter_getUsernameSuggestions.js
+++ b/toolkit/components/passwordmgr/test/unit/test_LoginManagerPrompter_getUsernameSuggestions.js
@@ -49,16 +49,23 @@ const TEST_CASES = [
 
 const LOGIN = TestData.formLogin({
   origin: "https://example.com",
   formActionOrigin: "https://example.com",
   username: "LOGIN is used only for its origin",
   password: "LOGIN is used only for its origin",
 });
 
+function _setPrefs() {
+  Services.prefs.setBoolPref("signon.capture.inputChanges.enabled", true);
+  registerCleanupFunction(() => {
+    Services.prefs.clearUserPref("signon.capture.inputChanges.enabled");
+  });
+}
+
 function _saveLogins(logins) {
   logins
     .map(loginData => {
       let login;
       if (loginData.isAuth) {
         login = TestData.authLogin({
           origin: "https://example.com",
           httpRealm: "example-realm",
@@ -113,12 +120,13 @@ async function _test(testCase) {
 
   _compare(testCase.expectedSuggestions, result);
 
   info("Cleaning up state");
   LoginTestUtils.clearData();
 }
 
 add_task(async function test_LoginManagerPrompter_getUsernameSuggestions() {
+  _setPrefs();
   for (let tc of TEST_CASES) {
     await _test(tc);
   }
 });