summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/measure-memory/main-frame-and-worker.https.window.js
blob: a1a5a5a6c3ad7c28692d830ea6357c6c30743d98 (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
// META: script=/common/get-host-info.sub.js
// META: script=./resources/checker.js
// META: script=./resources/common.js
// META: timeout=long
'use strict';

promise_test(async testCase => {
  assert_true(self.crossOriginIsolated);

  const BYTES_PER_WORKER = 10 * 1024 * 1024;
  const worker_url = await createWorker(BYTES_PER_WORKER);
  const result = await performance.measureUserAgentSpecificMemory();
  assert_greater_than_equal(result.bytes, BYTES_PER_WORKER);
  checkMeasureMemory(result, [
    {
      url: window.location.href,
      scope: 'Window',
      container: null,
    },
    {
      url: worker_url,
      scope: 'DedicatedWorkerGlobalScope',
      container: null,
    },
  ]);
}, 'Well-formed result of performance.measureUserAgentSpecificMemory.');