randomized-breakdown.https.window.js (1008B)
1 // META: script=/common/get-host-info.sub.js 2 // META: script=./resources/checker.js 3 // META: script=./resources/common.js 4 // META: timeout=long 5 'use strict'; 6 7 function indexOfEmptyEntry(result) { 8 return result.breakdown.findIndex(isEmptyBreakdownEntry); 9 } 10 11 promise_test(async testCase => { 12 assert_true(self.crossOriginIsolated); 13 14 const initial = await performance.measureUserAgentSpecificMemory(); 15 let observed_different_order = false; 16 for (let i = 0; i < 100; ++i) { 17 const current = await performance.measureUserAgentSpecificMemory(); 18 if (indexOfEmptyEntry(initial) != indexOfEmptyEntry(current)) { 19 observed_different_order = true; 20 } 21 } 22 // The order of the breakdown entries must be randomized. 23 // A conforming implementation may fail the following assert with 24 // the probability of at most 2^-100 since there are at least two 25 // entries in the breakdown. 26 assert_true(observed_different_order); 27 }, 'Well-formed result of performance.measureUserAgentSpecificMemory.');