Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Firefox/browser/components/urlbar/tests/unit/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 4 kB image not shown  

Quelle  test_about_urls.js   Sprache: JAVA

 
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


"use strict";

const { AboutPagesUtils } = ChromeUtils.importESModule(
  "resource://gre/modules/AboutPagesUtils.sys.mjs"
);

testEngine_setup();

// "about:ab" should match "about:about"
add_task(async function aboutAb() {
  let context = createContext("about:ab", { isPrivate: false });
  await check_results({
    context,
    autofilled: "about:about",
    completed: "about:about",
    matches: [
      makeVisitResult(context, {
        uri: "about:about",
        title: "about:about",
        heuristic: true,
      }),
    ],
  });
});

// "about:Ab" should match "about:about"
add_task(async function aboutAb() {
  let context = createContext("about:Ab", { isPrivate: false });
  await check_results({
    context,
    autofilled: "about:About",
    completed: "about:about",
    matches: [
      makeVisitResult(context, {
        uri: "about:about",
        title: "about:about",
        heuristic: true,
      }),
    ],
  });
});

// "about:about" should match "about:about"
add_task(async function aboutAbout() {
  let context = createContext("about:about", { isPrivate: false });
  await check_results({
    context,
    autofilled: "about:about",
    completed: "about:about",
    matches: [
      makeVisitResult(context, {
        uri: "about:about",
        title: "about:about",
        heuristic: true,
      }),
    ],
  });
});

// "about:a" should complete to "about:about" and also match "about:addons"
add_task(async function aboutAboutAndAboutAddons() {
  let context = createContext("about:a", { isPrivate: false });
  await check_results({
    context,
    search: "about:a",
    autofilled: "about:about",
    completed: "about:about",
    matches: [
      makeVisitResult(context, {
        uri: "about:about",
        title: "about:about",
        heuristic: true,
      }),
      makeVisitResult(context, {
        source: UrlbarUtils.RESULT_SOURCE.OTHER_LOCAL,
        uri: "about:addons",
        title: "about:addons",
        iconUri: "page-icon:about:addons",
        tags: null,
        providerName: "AboutPages",
      }),
    ],
  });
});

// "about:" by itself matches a list of about: pages and nothing else
add_task(async function aboutColonMatchesOnlyAboutPages() {
  // We generate 9 about: page results because there are 10 results total,
  // and the first result is the heuristic result.
  function getFirst9AboutPages() {
    const aboutPageNames = AboutPagesUtils.visibleAboutUrls.slice(0, 9);
    const aboutPageResults = aboutPageNames.map(aboutPageName => {
      return makeVisitResult(context, {
        source: UrlbarUtils.RESULT_SOURCE.OTHER_LOCAL,
        uri: aboutPageName,
        title: aboutPageName,
        iconUri: "page-icon:" + aboutPageName,
        tags: null,
        providerName: "AboutPages",
      });
    });
    return aboutPageResults;
  }

  let context = createContext("about:", { isPrivate: false });
  await check_results({
    context,
    search: "about:",
    matches: [
      makeSearchResult(context, {
        engineName: SUGGESTIONS_ENGINE_NAME,
        providerName: "HeuristicFallback",
        heuristic: true,
      }),
      ...getFirst9AboutPages(),
    ],
  });
});

// Results for about: pages do not match webpage titles from the user's history
add_task(async function aboutResultsDoNotMatchTitlesInHistory() {
  await PlacesTestUtils.addVisits([
    {
      uri: Services.io.newURI("http://example.com/guide/config/"),
      title: "Guide to config in Firefox",
    },
  ]);

  let context = createContext("about:config", { isPrivate: false });
  await check_results({
    context,
    search: "about:config",
    matches: [
      makeVisitResult(context, {
        uri: "about:config",
        title: "about:config",
        heuristic: true,
        providerName: "Autofill",
      }),
    ],
  });
});

// Tests that about: pages are shown after general results.
add_task(async function after_general() {
  await PlacesTestUtils.addVisits([
    {
      uri: Services.io.newURI("http://example.com/guide/aboutaddons/"),
      title: "Guide to about:addons in Firefox",
    },
  ]);

  let context = createContext("about:a", { isPrivate: false });
  await check_results({
    context,
    matches: [
      makeVisitResult(context, {
        uri: "about:about",
        title: "about:about",
        heuristic: true,
        providerName: "Autofill",
      }),
      makeVisitResult(context, {
        uri: "http://example.com/guide/aboutaddons/",
        title: "Guide to about:addons in Firefox",
      }),
      makeVisitResult(context, {
        source: UrlbarUtils.RESULT_SOURCE.OTHER_LOCAL,
        uri: "about:addons",
        title: "about:addons",
        iconUri: "page-icon:about:addons",
        tags: null,
        providerName: "AboutPages",
      }),
    ],
  });
  await cleanupPlaces();
});

Messung V0.5
C=96 H=90 G=93

¤ Dauer der Verarbeitung: 0.13 Sekunden  (vorverarbeitet)  ¤

*© 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.