browser_net_telemetry_throttle_changed.js (1048B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 const ALL_CHANNELS = Ci.nsITelemetry.DATASET_ALL_CHANNELS; 7 8 /** 9 * Test the throttle_change telemetry event. 10 */ 11 add_task(async function () { 12 const { monitor } = await initNetMonitor(SIMPLE_URL, { 13 requestCount: 1, 14 }); 15 info("Starting test... "); 16 17 const { store, windowRequire } = monitor.panelWin; 18 const Actions = windowRequire("devtools/client/netmonitor/src/actions/index"); 19 store.dispatch(Actions.batchEnable(false)); 20 21 // Remove all telemetry events. 22 Services.telemetry.clearEvents(); 23 24 // Ensure no events have been logged 25 const snapshot = Services.telemetry.snapshotEvents(ALL_CHANNELS, true); 26 ok(!snapshot.parent, "No events have been logged for the main process"); 27 28 await selectThrottle(monitor, "GPRS"); 29 // Verify existence of the telemetry event. 30 checkTelemetryEvent( 31 { 32 mode: "GPRS", 33 }, 34 { 35 method: "throttle_changed", 36 } 37 ); 38 39 return teardown(monitor); 40 });