11cb0ef41Sopenharmony_cipromise_test(() => fetch("resources/urltestdata.json").then(res => res.json()).then(runURLTests), "Loading data…");
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_cifunction runURLTests(urlTests) {
41cb0ef41Sopenharmony_ci  for (const expected of urlTests) {
51cb0ef41Sopenharmony_ci    // Skip comments and tests without "origin" expectation
61cb0ef41Sopenharmony_ci    if (typeof expected === "string" || !("origin" in expected))
71cb0ef41Sopenharmony_ci      continue;
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci    const base = expected.base !== null ? expected.base : undefined;
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ci    test(() => {
121cb0ef41Sopenharmony_ci      const url = new URL(expected.input, base);
131cb0ef41Sopenharmony_ci      assert_equals(url.origin, expected.origin, "origin");
141cb0ef41Sopenharmony_ci    }, `Origin parsing: <${expected.input}> ${base ? "against <" + base + ">" : "without base"}`);
151cb0ef41Sopenharmony_ci  }
161cb0ef41Sopenharmony_ci}
17