browser_aboutdebugging_devtoolstoolbox_concurrent.js (2790B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 Services.scriptloader.loadSubScript( 7 "chrome://mochitests/content/browser/devtools/client/debugger/test/mochitest/shared-head.js", 8 this 9 ); 10 11 const TAB1_URL = 12 "data:text/html," + 13 encodeURIComponent("<script>function firstTab() {}</script>First tab"); 14 const TAB2_URL = 15 "data:text/html," + 16 encodeURIComponent("<script>function secondTab() {}</script>Second tab"); 17 18 /* import-globals-from helper-collapsibilities.js */ 19 Services.scriptloader.loadSubScript( 20 CHROME_URL_ROOT + "helper-collapsibilities.js", 21 this 22 ); 23 24 const RUNTIME_ID = "1337id"; 25 const DEVICE_NAME = "Fancy Phone"; 26 const RUNTIME_NAME = "Lorem ipsum"; 27 28 /** 29 * Test JavaScript Tracer in about:devtools-toolbox tabs (ie non localTab tab target). 30 */ 31 add_task(async function () { 32 const testTab1 = await addTab(TAB1_URL); 33 const testTab2 = await addTab(TAB2_URL); 34 35 info("Force all debug target panes to be expanded"); 36 prepareCollapsibilitiesTest(); 37 38 const { disconnect, mocks } = await connectToLocalFirefox({ 39 runtimeId: RUNTIME_ID, 40 runtimeName: RUNTIME_NAME, 41 deviceName: DEVICE_NAME, 42 }); 43 44 const { document, tab, window } = await openAboutDebugging(); 45 46 mocks.emitUSBUpdate(); 47 await connectToRuntime(DEVICE_NAME, document); 48 await waitForRuntimePage(RUNTIME_NAME, document); 49 50 //await selectThisFirefoxPage(document, window.AboutDebugging.store); 51 52 info("Open a first remote toolbox on the debugger for the first tab"); 53 const { devtoolsTab: devtoolsTab1, devtoolsWindow: devtoolsWindow1 } = 54 await openAboutDevtoolsToolbox(document, tab, window, TAB1_URL); 55 const toolbox1 = getToolbox(devtoolsWindow1); 56 await toolbox1.selectTool("jsdebugger"); 57 58 info("Assert we can see first tab sources in the debugger"); 59 const debuggerContext1 = createDebuggerContext(toolbox1); 60 await waitForSources(debuggerContext1, TAB1_URL); 61 await selectSource(debuggerContext1, TAB1_URL); 62 63 info("Open a second remote toolbox on the debugger for the second tab"); 64 const { devtoolsTab: devtoolsTab2, devtoolsWindow: devtoolsWindow2 } = 65 await openAboutDevtoolsToolbox(document, tab, window, TAB2_URL); 66 const toolbox2 = getToolbox(devtoolsWindow2); 67 await toolbox2.selectTool("jsdebugger"); 68 69 info("Assert we can see second tab sources in the debugger"); 70 const debuggerContext2 = createDebuggerContext(toolbox2); 71 await waitForSources(debuggerContext2, TAB2_URL); 72 await selectSource(debuggerContext2, TAB2_URL); 73 74 await closeAboutDevtoolsToolbox(document, devtoolsTab1, window); 75 await closeAboutDevtoolsToolbox(document, devtoolsTab2, window); 76 77 await disconnect(document); 78 await removeTab(testTab1); 79 await removeTab(testTab2); 80 await removeTab(tab); 81 });