diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-02-25 15:07:00 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-02-25 15:07:00 -0500 |
commit | 0ddd00f1959c78ce37c14fef3c83401408fca3bf (patch) | |
tree | d408e02767c86cf8aac3acbb86722b03c77ede6f /toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample | |
parent | 20f0905b33cbb18d1caa80c55e2f552c2e18957b (diff) | |
download | UXP-0ddd00f1959c78ce37c14fef3c83401408fca3bf.tar UXP-0ddd00f1959c78ce37c14fef3c83401408fca3bf.tar.gz UXP-0ddd00f1959c78ce37c14fef3c83401408fca3bf.tar.lz UXP-0ddd00f1959c78ce37c14fef3c83401408fca3bf.tar.xz UXP-0ddd00f1959c78ce37c14fef3c83401408fca3bf.zip |
Issue #439 - Remove tests from toolkit/
Diffstat (limited to 'toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample')
5 files changed, 0 insertions, 163 deletions
diff --git a/toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/bootstrap.js b/toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/bootstrap.js deleted file mode 100644 index 9a5575827..000000000 --- a/toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/bootstrap.js +++ /dev/null @@ -1,105 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -// Sample for browser_AddonWatcher.js - -"use strict"; - -const {utils: Cu, classes: Cc, interfaces: Ci} = Components; - -const TOPIC_BURNCPU = "test-addonwatcher-burn-some-cpu"; -const TOPIC_BURNCPOW = "test-addonwatcher-burn-some-cpow"; -const TOPIC_BURNCONTENTCPU = "test-addonwatcher-burn-some-content-cpu"; -const TOPIC_READY = "test-addonwatcher-ready"; - -const MESSAGE_BURNCPOW = "test-addonwatcher-cpow:init"; -const URL_FRAMESCRIPT = "chrome://addonwatcher-test/content/framescript.js"; - -Cu.import("resource://gre/modules/Services.jsm", this); -const { setTimeout } = Cu.import("resource://gre/modules/Timer.jsm", {}); -Cu.import("resource://gre/modules/Task.jsm", this); - -let globalMM = Cc["@mozilla.org/globalmessagemanager;1"] - .getService(Ci.nsIMessageListenerManager); - -/** - * Spend some time using CPU. - */ -function burnCPU() { - let ignored = []; - let start = Date.now(); - let i = 0; - while (Date.now() - start < 1000) { - ignored[i++ % 2] = i; - } -} - -/** - * Spend some time in CPOW. - */ -function burnCPOW() { - gBurnCPOW(); -} -let gBurnCPOW = null; - -function burnContentCPU() { - setTimeout(() => { try { - gBurnContentCPU() - } catch (ex) { - dump(`test-addon error: ${ex}\n`); - } }, 0); -} -let gBurnContentCPU = null; - -let gTab = null; -let gTabBrowser = null; - -function startup() { - Services.obs.addObserver(burnCPU, TOPIC_BURNCPU, false); - Services.obs.addObserver(burnCPOW, TOPIC_BURNCPOW, false); - Services.obs.addObserver(burnContentCPU, TOPIC_BURNCONTENTCPU, false); - - let windows = Services.wm.getEnumerator("navigator:browser"); - let win = windows.getNext(); - gTabBrowser = win.gBrowser; - gTab = gTabBrowser.addTab("about:robots"); - gBurnContentCPU = function() { - gTab.linkedBrowser.messageManager.sendAsyncMessage("test-addonwatcher-burn-some-content-cpu", {}); - } - - gTab.linkedBrowser.messageManager.loadFrameScript(URL_FRAMESCRIPT, false); - globalMM.loadFrameScript(URL_FRAMESCRIPT, false); - - if (Services.appinfo.browserTabsRemoteAutostart) { - // This profile has e10s enabled, which means we'll want to - // test CPOW traffic. - globalMM.addMessageListener("test-addonwatcher-cpow:init", function waitForCPOW(msg) { - if (Components.utils.isCrossProcessWrapper(msg.objects.burnCPOW)) { - gBurnCPOW = msg.objects.burnCPOW; - globalMM.removeMessageListener("test-addonwatcher-cpow:init", waitForCPOW); - Services.obs.notifyObservers(null, TOPIC_READY, null); - } else { - Cu.reportError("test-addonwatcher-cpow:init didn't give us a CPOW! Expect timeouts."); - } - }); - } else { - // e10s is not enabled, so a CPOW is not necessary - we can report ready - // right away. - Services.obs.notifyObservers(null, TOPIC_READY, null); - } -} - -function shutdown() { - Services.obs.removeObserver(burnCPU, TOPIC_BURNCPU); - Services.obs.removeObserver(burnCPOW, TOPIC_BURNCPOW); - Services.obs.removeObserver(burnContentCPU, TOPIC_BURNCONTENTCPU); - gTabBrowser.removeTab(gTab); -} - -function install() { - // Nothing to do -} - -function uninstall() { - // Nothing to do -} diff --git a/toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/build.sh b/toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/build.sh deleted file mode 100644 index 28d52ea3a..000000000 --- a/toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/build.sh +++ /dev/null @@ -1,4 +0,0 @@ -echo "Rebuilding browser_Addons_sample.xpi..." -zip -r ../browser_Addons_sample.xpi . -echo " -Done! Don't forget to sign it: https://wiki.mozilla.org/EngineeringProductivity/HowTo/SignExtensions"
\ No newline at end of file diff --git a/toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/chrome.manifest b/toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/chrome.manifest deleted file mode 100644 index 9f53da861..000000000 --- a/toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/chrome.manifest +++ /dev/null @@ -1 +0,0 @@ -content addonwatcher-test content/ diff --git a/toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/content/framescript.js b/toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/content/framescript.js deleted file mode 100644 index e7ebc2a61..000000000 --- a/toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/content/framescript.js +++ /dev/null @@ -1,23 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -Components.utils.import("resource://gre/modules/Services.jsm"); - -function burnCPOW(msg) { - dump(`Addon: content burnCPU start ${Math.sin(Math.random())}\n`); - let start = content.performance.now(); - let ignored = []; - while (content.performance.now() - start < 5000) { - ignored[ignored.length % 2] = ignored.length; - } - dump(`Addon: content burnCPU done: ${content.performance.now() - start}\n`); -} - -if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) { - sendAsyncMessage("test-addonwatcher-cpow:init", {}, {burnCPOW}); -} - -addMessageListener("test-addonwatcher-burn-some-content-cpu", burnCPOW); diff --git a/toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/install.rdf b/toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/install.rdf deleted file mode 100644 index cae10ace6..000000000 --- a/toolkit/components/perfmonitoring/tests/browser/browser_Addons_sample/install.rdf +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:em="http://www.mozilla.org/2004/em-rdf#"> - <Description about="urn:mozilla:install-manifest"> - <em:id>addonwatcher-test@mozilla.com</em:id> - <em:version>1.1</em:version> - - <em:targetApplication> - <Description> - <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> - <em:minVersion>0.3</em:minVersion> - <em:maxVersion>*</em:maxVersion> - </Description> - </em:targetApplication> - - <em:targetApplication> - <Description> - <em:id>toolkit@mozilla.org</em:id> - <em:minVersion>1</em:minVersion> - <em:maxVersion>*</em:maxVersion> - </Description> - </em:targetApplication> - - <em:bootstrap>true</em:bootstrap> - - <em:name>Sample for browser_AddonWatcher.js</em:name> - - </Description> -</RDF> |