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

Quelle  browser_refresh_port_list.js   Sprache: JAVA

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


const EXAMPLE_ORG_URL = "https://example.org/browser/dom/midi/tests/";
const PAGE = "refresh_port_list.html";

async function get_access() {
  return SpecialPowers.spawn(gBrowser.selectedBrowser, [], function () {
    return content.wrappedJSObject.get_access();
  });
}

async function reset_access() {
  return SpecialPowers.spawn(gBrowser.selectedBrowser, [], function () {
    return content.wrappedJSObject.reset_access();
  });
}

async function get_num_ports() {
  return SpecialPowers.spawn(gBrowser.selectedBrowser, [], function () {
    return content.wrappedJSObject.get_num_ports();
  });
}

async function add_port() {
  return SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
    return content.wrappedJSObject.add_port();
  });
}

async function remove_port() {
  return SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
    return content.wrappedJSObject.remove_port();
  });
}

async function force_refresh() {
  return SpecialPowers.spawn(gBrowser.selectedBrowser, [], () => {
    return content.wrappedJSObject.force_refresh();
  });
}

add_task(async function () {
  gBrowser.selectedTab = BrowserTestUtils.addTab(
    gBrowser,
    EXAMPLE_ORG_URL + PAGE
  );
  await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);

  await get_access(gBrowser.selectedBrowser);
  let ports_num = await get_num_ports(gBrowser.selectedBrowser);
  Assert.equal(ports_num, 4, "We start with four ports");
  await add_port(gBrowser.selectedBrowser);
  ports_num = await get_num_ports(gBrowser.selectedBrowser);
  Assert.equal(ports_num, 5, "One port is added manually");
  // This causes the test service to refresh the ports the next time a refresh
  // is requested, it will happen after we reload the tab later on and will add
  // back the port that we're removing on the next line.
  await force_refresh(gBrowser.selectedBrowser);
  await remove_port(gBrowser.selectedBrowser);
  ports_num = await get_num_ports(gBrowser.selectedBrowser);
  Assert.equal(ports_num, 4, "One port is removed manually");

  await BrowserTestUtils.reloadTab(gBrowser.selectedTab);

  await get_access(gBrowser.selectedBrowser);
  let refreshed_ports_num = await get_num_ports(gBrowser.selectedBrowser);
  Assert.equal(refreshed_ports_num, 5, "One port is added by the refresh");

  gBrowser.removeTab(gBrowser.selectedTab);
});

Messung V0.5
C=96 H=95 G=95

¤ 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.