summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/tabs
diff options
context:
space:
mode:
Diffstat (limited to 'browser/base/content/test/tabs')
-rw-r--r--browser/base/content/test/tabs/.eslintrc.js7
-rw-r--r--browser/base/content/test/tabs/browser.ini4
-rw-r--r--browser/base/content/test/tabs/browser_tabSpinnerProbe.js93
-rw-r--r--browser/base/content/test/tabs/browser_tabSwitchPrintPreview.js29
4 files changed, 0 insertions, 133 deletions
diff --git a/browser/base/content/test/tabs/.eslintrc.js b/browser/base/content/test/tabs/.eslintrc.js
deleted file mode 100644
index 7c8021192..000000000
--- a/browser/base/content/test/tabs/.eslintrc.js
+++ /dev/null
@@ -1,7 +0,0 @@
-"use strict";
-
-module.exports = {
- "extends": [
- "../../../../../testing/mochitest/browser.eslintrc.js"
- ]
-};
diff --git a/browser/base/content/test/tabs/browser.ini b/browser/base/content/test/tabs/browser.ini
deleted file mode 100644
index 7771e0a6e..000000000
--- a/browser/base/content/test/tabs/browser.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[browser_tabSpinnerProbe.js]
-skip-if = !e10s # Tab spinner is e10s only.
-[browser_tabSwitchPrintPreview.js]
-skip-if = os == 'mac'
diff --git a/browser/base/content/test/tabs/browser_tabSpinnerProbe.js b/browser/base/content/test/tabs/browser_tabSpinnerProbe.js
deleted file mode 100644
index c3569c2b1..000000000
--- a/browser/base/content/test/tabs/browser_tabSpinnerProbe.js
+++ /dev/null
@@ -1,93 +0,0 @@
-"use strict";
-
-/**
- * Tests the FX_TAB_SWITCH_SPINNER_VISIBLE_MS and
- * FX_TAB_SWITCH_SPINNER_VISIBLE_LONG_MS telemetry probes
- */
-let gMinHangTime = 500; // ms
-let gMaxHangTime = 5 * 1000; // ms
-
-/**
- * Make a data URI for a generic webpage with a script that hangs for a given
- * amount of time.
- * @param {?Number} aHangMs Number of milliseconds that the hang should last.
- * Defaults to 0.
- * @return {String} The data URI generated.
- */
-function makeDataURI(aHangMs = 0) {
- return `data:text/html,
- <html>
- <head>
- <meta charset="utf-8"/>
- <title>Tab Spinner Test</title>
- <script>
- function hang() {
- let hangDuration = ${aHangMs};
- if (hangDuration > 0) {
- let startTime = window.performance.now();
- while(window.performance.now() - startTime < hangDuration) {}
- }
- }
- </script>
- </head>
- <body>
- <h1 id='header'>Tab Spinner Test</h1>
- </body>
- </html>`;
-}
-
-/**
- * Returns the sum of all values in an array.
- * @param {Array} aArray An array of integers
- * @return {Number} The sum of the integers in the array
- */
-function sum(aArray) {
- return aArray.reduce(function(previousValue, currentValue) {
- return previousValue + currentValue;
- });
-}
-
-/**
- * A generator intended to be run as a Task. It tests one of the tab spinner
- * telemetry probes.
- * @param {String} aProbe The probe to test. Should be one of:
- * - FX_TAB_SWITCH_SPINNER_VISIBLE_MS
- * - FX_TAB_SWITCH_SPINNER_VISIBLE_LONG_MS
- */
-function* testProbe(aProbe) {
- info(`Testing probe: ${aProbe}`);
- let histogram = Services.telemetry.getHistogramById(aProbe);
- let buckets = histogram.snapshot().ranges.filter(function(value) {
- return (value > gMinHangTime && value < gMaxHangTime);
- });
- let delayTime = buckets[0]; // Pick a bucket arbitrarily
-
- // The tab spinner does not show up instantly. We need to hang for a little
- // bit of extra time to account for the tab spinner delay.
- delayTime += gBrowser.selectedTab.linkedBrowser.getTabBrowser()._getSwitcher().TAB_SWITCH_TIMEOUT;
- let dataURI1 = makeDataURI(delayTime);
- let dataURI2 = makeDataURI();
-
- let tab1 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, dataURI1);
- histogram.clear();
- // Queue a hang in the content process when the
- // event loop breathes next.
- ContentTask.spawn(tab1.linkedBrowser, null, function*() {
- content.wrappedJSObject.hang();
- });
- let tab2 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, dataURI2);
- let snapshot = histogram.snapshot();
- yield BrowserTestUtils.removeTab(tab2);
- yield BrowserTestUtils.removeTab(tab1);
- ok(sum(snapshot.counts) > 0,
- `Spinner probe should now have a value in some bucket`);
-}
-
-add_task(function* setup() {
- yield SpecialPowers.pushPrefEnv({
- set: [["dom.ipc.processCount", 1]]
- });
-});
-
-add_task(testProbe.bind(null, "FX_TAB_SWITCH_SPINNER_VISIBLE_MS"));
-add_task(testProbe.bind(null, "FX_TAB_SWITCH_SPINNER_VISIBLE_LONG_MS"));
diff --git a/browser/base/content/test/tabs/browser_tabSwitchPrintPreview.js b/browser/base/content/test/tabs/browser_tabSwitchPrintPreview.js
deleted file mode 100644
index 4ec36a7cc..000000000
--- a/browser/base/content/test/tabs/browser_tabSwitchPrintPreview.js
+++ /dev/null
@@ -1,29 +0,0 @@
-const kURL1 = "data:text/html,Should I stay or should I go?";
-const kURL2 = "data:text/html,I shouldn't be here!";
-
-add_task(function* setup() {
- yield SpecialPowers.pushPrefEnv({
- set: [["dom.ipc.processCount", 1]]
- });
-});
-
-/**
- * Verify that if we open a new tab and try to make it the selected tab while
- * print preview is up, that doesn't happen.
- */
-add_task(function* () {
- yield BrowserTestUtils.withNewTab(kURL1, function* (browser) {
- let tab = gBrowser.addTab(kURL2);
- document.getElementById("cmd_printPreview").doCommand();
- gBrowser.selectedTab = tab;
- yield BrowserTestUtils.waitForCondition(() => gInPrintPreviewMode, "should be in print preview mode");
- isnot(gBrowser.selectedTab, tab, "Selected tab should not be the tab we added");
- is(gBrowser.selectedTab, PrintPreviewListener._printPreviewTab, "Selected tab should be the print preview tab");
- gBrowser.selectedTab = tab;
- isnot(gBrowser.selectedTab, tab, "Selected tab should still not be the tab we added");
- is(gBrowser.selectedTab, PrintPreviewListener._printPreviewTab, "Selected tab should still be the print preview tab");
- PrintUtils.exitPrintPreview();
- yield BrowserTestUtils.waitForCondition(() => !gInPrintPreviewMode, "should be in print preview mode");
- yield BrowserTestUtils.removeTab(tab);
- });
-});