author | Daisuke Akatsuka <daisuke@birchill.co.jp> |
Wed, 08 Jan 2020 04:23:21 +0000 | |
changeset 509317 | 12fb5e522dd32b5ff50c8196c05b3ba9d244417e |
parent 509316 | c9979d1a8ca630a96ea26ce00867a2f82452b7b9 |
child 509318 | e9d191b5eb8a78b117f55c0dd6993cb0d136c7c8 |
push id | 104548 |
push user | dakatsuka.birchill@mozilla.com |
push date | Wed, 08 Jan 2020 06:14:42 +0000 |
treeherder | autoland@12fb5e522dd3 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jdescottes, ochameau |
bugs | 1578243 |
milestone | 74.0a1 |
first release with | nightly linux32
12fb5e522dd3
/
74.0a1
/
20200108094158
/
files
nightly linux64
12fb5e522dd3
/
74.0a1
/
20200108094158
/
files
nightly mac
12fb5e522dd3
/
74.0a1
/
20200108094158
/
files
nightly win32
12fb5e522dd3
/
74.0a1
/
20200108094158
/
files
nightly win64
12fb5e522dd3
/
74.0a1
/
20200108094158
/
files
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
releases | nightly linux32
74.0a1
/
20200108094158
/
pushlog to previous
nightly linux64
74.0a1
/
20200108094158
/
pushlog to previous
nightly mac
74.0a1
/
20200108094158
/
pushlog to previous
nightly win32
74.0a1
/
20200108094158
/
pushlog to previous
nightly win64
74.0a1
/
20200108094158
/
pushlog to previous
|
--- a/devtools/client/netmonitor/test/browser.ini +++ b/devtools/client/netmonitor/test/browser.ini @@ -140,16 +140,17 @@ skip-if = true # Bug 1479782 [browser_net_edit_resend_xhr.js] [browser_net_filter-01.js] [browser_net_filter-02.js] [browser_net_filter-03.js] [browser_net_filter-04.js] [browser_net_filter-autocomplete.js] [browser_net_filter-flags.js] [browser_net_filter-value-preserved.js] +[browser_net_fission_switch_target.js] [browser_net_footer-summary.js] [browser_net_header-ref-policy.js] [browser_net_decode-url.js] [browser_net_decode-params.js] [browser_net_headers-alignment.js] [browser_net_headers_filter.js] [browser_net_headers_sorted.js] [browser_net_headers-resize.js]
new file mode 100644 --- /dev/null +++ b/devtools/client/netmonitor/test/browser_net_fission_switch_target.js @@ -0,0 +1,63 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Test switching for the top-level target. + +const PARENT_PROCESS_URI = "about:robots"; +const PARENT_PROCESS_URI_NETWORK_COUNT = 0; +const CONTENT_PROCESS_URI = CUSTOM_GET_URL; +const CONTENT_PROCESS_URI_NETWORK_COUNT = 1; + +add_task(async function() { + await pushPref("devtools.target-switching.enabled", true); + + // We use about:robots, because this page will run in the parent process. + // Navigating from about:robots to a regular content page will always trigger a target + // switch, with or without fission. + + info("Open a page that runs on the content process and the net monitor"); + const { monitor, tab, toolbox } = await initNetMonitor(CONTENT_PROCESS_URI); + const { store } = monitor.panelWin; + + info("Reload the page to show the network event"); + const waitForReloading = waitForNetworkEvents( + monitor, + CONTENT_PROCESS_URI_NETWORK_COUNT + ); + tab.linkedBrowser.reload(); + await waitForReloading; + + info("Navigate to a page that runs on parent process"); + await navigateTo(PARENT_PROCESS_URI, toolbox, monitor, tab); + is( + store.getState().requests.requests.length, + PARENT_PROCESS_URI_NETWORK_COUNT, + `Request count of ${PARENT_PROCESS_URI} is correct` + ); + + info("Return to a page that runs on content process again"); + await navigateTo(CONTENT_PROCESS_URI, toolbox, monitor, tab); + + info(`Execute more requests in ${CONTENT_PROCESS_URI}`); + const currentRequestCount = store.getState().requests.requests.length; + const additionalRequestCount = 3; + await performRequests(monitor, tab, additionalRequestCount); + is( + store.getState().requests.requests.length - currentRequestCount, + additionalRequestCount, + "Additional request count is reflected correctly" + ); + + await teardown(monitor); +}); + +async function navigateTo(uri, toolbox, monitor, tab) { + const onSwitched = once(toolbox, "switched-target"); + const onReloaded = once(monitor, "reloaded"); + BrowserTestUtils.loadURI(tab.linkedBrowser, uri); + await onSwitched; + await onReloaded; + ok(true, "All events we expected were fired"); +}