Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  head.js   Sprache: JAVA

 

"use strict";

/** @import {ExperimentManager, OptInEntry} from "../../lib/ExperimentManager.sys.mjs" */

/* import-globals-from ../../../../../toolkit/profile/test/xpcshell/head.js */
/* import-globals-from ../../../../../browser/components/profiles/tests/unit/head.js */

ChromeUtils.defineESModuleGetters(this, {
  ObjectUtils: "resource://gre/modules/ObjectUtils.sys.mjs",
  RegionTestUtils: "resource://testing-common/RegionTestUtils.sys.mjs",
  TestUtils: "resource://testing-common/TestUtils.sys.mjs",
  sinon: "resource://testing-common/Sinon.sys.mjs",
});

const {
  _ExperimentFeature: ExperimentFeature,
  ExperimentAPI,
  NimbusFeatures,
} = ChromeUtils.importESModule("resource://nimbus/ExperimentAPI.sys.mjs");

const { NimbusEnrollments } = ChromeUtils.importESModule(
  "resource://nimbus/lib/Enrollments.sys.mjs"
);

const { NimbusTestUtils } = ChromeUtils.importESModule(
  "resource://testing-common/NimbusTestUtils.sys.mjs"
);

NimbusTestUtils.init(this);

add_setup(async function () {
  do_get_profile();

  await initSelectableProfileService();

  // TODO(bug 1967779): require the ProfilesDatastoreService to be initialized
  Services.prefs.setBoolPref("nimbus.profilesdatastoreservice.enabled", true);
  Services.prefs.setBoolPref(
    "nimbus.profilesdatastoreservice.read.enabled",
    true
  );
  NimbusEnrollments._reloadPrefsForTests();

  registerCleanupFunction(() => {
    Services.prefs.setBoolPref(
      "nimbus.profilesdatastoreservice.enabled",
      false
    );
    Services.prefs.setBoolPref(
      "nimbus.profilesdatastoreservice.read.enabled",
      false
    );
    NimbusEnrollments._reloadPrefsForTests();
  });
});

/**
 * Assert the manager has no active pref observers.
 */

function assertNoObservers(manager) {
  Assert.equal(
    manager._prefs.size,
    0,
    "There should be no active pref observers"
  );
  Assert.equal(
    manager._prefsBySlug.size,
    0,
    "There should be no active pref observers"
  );
  Assert.equal(
    manager._prefFlips._registeredPrefCount,
    0,
    "There should be no prefFlips pref observers"
  );
}

/**
 * Remove all pref observers on the given ExperimentManager.
 */

function removePrefObservers(manager) {
  for (const [name, entry] of manager._prefs.entries()) {
    Services.prefs.removeObserver(name, entry.observer);
  }

  manager._prefs.clear();
  manager._prefsBySlug.clear();
}

/**
 * Wait for the RemoteSettingsExperimentLoader to finish updating enrollments.
 *
 * @returns {Promise<void>}
 */

function promiseEnrollmentsUpdated() {
  return TestUtils.topicObserved("nimbus:enrollments-updated");
}

/**
 * An ordering function for OptInEntries
 *
 * @param {OptInEntry} a The first entry to sort.
 * @param {OptInEntry} b The second entry to sort.
 *
 * @returns {number}
 */

function orderByRecipePublishedDate(a, b) {
  return (
    new Date(a.recipe.publishedDate ?? 0) -
    new Date(b.recipe.publishedDate ?? 0)
  );
}

/**
 * Assert the contents of the ExperimentManager's opt-in list, based on slugs
 * instead of entire recipe contents.
 *
 * @param {ExperimentManager} manager
 * The manager to test.
 *
 * @param {[string, string][]} optIns
 * An array containing 2-tuples of slugs and sources.
 *
 * @param {string} message
 * An option message to include in the assertion.
 */

function assertOptInSlugs(manager, optIns, message = undefined) {
  Assert.deepEqual(
    manager.optIns
      .map(entry => [entry.recipe.slug, entry.source])
      .sort((a, b) => a[0].localeCompare(b[0])),
    optIns.toSorted((a, b) => a[0].localeCompare(b[0])),
    message
  );
}

Messung V0.5 in Prozent
C=89 H=92 G=90

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-10-03) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1126864
#Domains=1897691