browser_aboutdebugging_telemetry_runtime_connected_details.js (1797B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 /* import-globals-from helper-telemetry.js */ 7 Services.scriptloader.loadSubScript( 8 CHROME_URL_ROOT + "helper-telemetry.js", 9 this 10 ); 11 12 const REMOTE_RUNTIME_ID = "remote-runtime"; 13 const REMOTE_RUNTIME = "Remote Runtime"; 14 const REMOTE_DEVICE = "Remote Device"; 15 16 const REMOTE_VERSION = "12.0a1"; 17 const REMOTE_OS = "SOME_OS"; 18 19 /** 20 * Runtime connected events will log additional extras about the runtime connection that 21 * was established. 22 */ 23 add_task(async function () { 24 const mocks = new Mocks(); 25 26 const usbClient = mocks.createUSBRuntime(REMOTE_RUNTIME_ID, { 27 deviceName: REMOTE_DEVICE, 28 name: REMOTE_RUNTIME, 29 shortName: REMOTE_RUNTIME, 30 }); 31 usbClient.getDeviceDescription = () => { 32 return { 33 os: REMOTE_OS, 34 version: REMOTE_VERSION, 35 }; 36 }; 37 38 const { document, tab } = await openAboutDebugging(); 39 40 mocks.emitUSBUpdate(); 41 await connectToRuntime(REMOTE_DEVICE, document); 42 const evts = readAboutDebuggingEvents().filter( 43 e => e.method === "runtime_connected" 44 ); 45 46 is( 47 evts.length, 48 1, 49 "runtime_connected event logged when connecting to remote runtime" 50 ); 51 const { 52 connection_type, 53 device_name, 54 runtime_name, 55 runtime_os, 56 runtime_version, 57 } = evts[0].extras; 58 is(connection_type, "usb", "Expected value for `connection_type` extra"); 59 is(device_name, REMOTE_DEVICE, "Expected value for `device_name` extra"); 60 is(runtime_name, REMOTE_RUNTIME, "Expected value for `runtime_name` extra"); 61 is(runtime_os, REMOTE_OS, "Expected value for `runtime_os` extra"); 62 is( 63 runtime_version, 64 REMOTE_VERSION, 65 "Expected value for `runtime_version` extra" 66 ); 67 68 await removeTab(tab); 69 });