summaryrefslogtreecommitdiffstats
path: root/devtools/client/netmonitor/test/browser_net_tracking-resources.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /devtools/client/netmonitor/test/browser_net_tracking-resources.js
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/netmonitor/test/browser_net_tracking-resources.js')
-rw-r--r--devtools/client/netmonitor/test/browser_net_tracking-resources.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/devtools/client/netmonitor/test/browser_net_tracking-resources.js b/devtools/client/netmonitor/test/browser_net_tracking-resources.js
new file mode 100644
index 0000000000..6d7365cb73
--- /dev/null
+++ b/devtools/client/netmonitor/test/browser_net_tracking-resources.js
@@ -0,0 +1,50 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+const { UrlClassifierTestUtils } = ChromeUtils.importESModule(
+ "resource://testing-common/UrlClassifierTestUtils.sys.mjs"
+);
+
+const TEST_URI =
+ "https://example.com/browser/devtools/client/" +
+ "netmonitor/test/html_tracking-protection.html";
+
+registerCleanupFunction(function () {
+ UrlClassifierTestUtils.cleanupTestTrackers();
+});
+
+/**
+ * Test that tracking resources are properly marked in the Network panel.
+ */
+add_task(async function () {
+ await UrlClassifierTestUtils.addTestTrackers();
+
+ const { monitor, tab } = await initNetMonitor(TEST_URI, { requestCount: 1 });
+ info("Starting test...");
+
+ const { document, store, windowRequire } = monitor.panelWin;
+ const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
+
+ store.dispatch(Actions.batchEnable(false));
+
+ // Execute request with third party tracking protection flag.
+ await performRequests(monitor, tab, 1);
+
+ const domainRequests = document.querySelectorAll(
+ ".requests-list-domain .tracking-resource"
+ );
+ const UrlRequests = document.querySelectorAll(
+ ".requests-list-url .tracking-resource"
+ );
+
+ is(
+ domainRequests.length,
+ 1,
+ "There should be one domain column tracking request"
+ );
+ is(UrlRequests.length, 1, "There should be one URL column tracking request");
+
+ await teardown(monitor);
+});