summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/pending-beacon/pending_get_beacon-cors.tentative.https.window.js
blob: 10bb3a0bed7f4888aaab7c7f6551f4a9a447c60e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// META: script=/common/get-host-info.sub.js
// META: script=/common/utils.js
// META: script=./resources/pending_beacon-helper.js

'use strict';

const {HTTPS_ORIGIN, HTTPS_NOTSAMESITE_ORIGIN} = get_host_info();

parallelPromiseTest(async t => {
  const uuid = token();
  const url = generateSetBeaconURL(uuid, {host: HTTPS_ORIGIN});

  let beacon = new PendingGetBeacon(url);
  beacon.sendNow();

  await expectBeacon(uuid, {count: 1});
}, 'PendingGetBeacon: same-origin');

parallelPromiseTest(async t => {
  const uuid = token();
  const url = generateSetBeaconURL(
      uuid, {host: HTTPS_NOTSAMESITE_ORIGIN, expectOrigin: HTTPS_ORIGIN});

  let beacon = new PendingGetBeacon(url);
  beacon.sendNow();

  await expectBeacon(uuid, {count: 1});
}, 'PendingGetBeacon: cross-origin');