Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/toolkit/components/nimbus/test/browser/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  browser_prefs.js   Sprache: JAVA

 
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */


"use strict";

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

const EXPERIMENT_VALUE = "experiment-value";
const ROLLOUT_VALUE = "rollout-value";
const ROLLOUT = "rollout";
const EXPERIMENT = "experiment";

const VALUES = {
  [ROLLOUT]: ROLLOUT_VALUE,
  [EXPERIMENT]: EXPERIMENT_VALUE,
};

add_task(async function test_prefs_priority() {
  const pref = "nimbus.testing.testSetString";
  const featureId = "testFeature";

  async function doTest({ settingEnrollments, expectedValue }) {
    info(
      `Enrolling in a rollout and experiment where the ${settingEnrollments.join(
        " and "
      )} set the same pref variable.`
    );
    const enrollmentCleanup = [];

    for (const enrollmentKind of [ROLLOUT, EXPERIMENT]) {
      const config = {
        featureId,
        value: {},
      };

      if (settingEnrollments.includes(enrollmentKind)) {
        config.value.testSetString = VALUES[enrollmentKind];
      }

      enrollmentCleanup.push(
        await ExperimentFakes.enrollWithFeatureConfig(config, {
          isRollout: enrollmentKind === ROLLOUT,
        })
      );
    }

    is(
      NimbusFeatures[featureId].getVariable("testSetString"),
      expectedValue,
      "Expected the variable to match the expected value"
    );

    is(
      Services.prefs.getStringPref(pref),
      expectedValue,
      "Expected the pref to match the expected value"
    );

    for (const cleanup of enrollmentCleanup) {
      cleanup();
    }

    Services.prefs.deleteBranch(pref);
  }

  for (const settingEnrollments of [
    [ROLLOUT],
    [EXPERIMENT],
    [ROLLOUT, EXPERIMENT],
  ]) {
    const expectedValue = settingEnrollments.includes(EXPERIMENT)
      ? EXPERIMENT_VALUE
      : ROLLOUT_VALUE;

    await doTest({ settingEnrollments, expectedValue });
  }
});

Messung V0.5
C=95 H=92 G=93

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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.