diff options
Diffstat (limited to 'startupcache/test')
-rw-r--r-- | startupcache/test/TestStartupCache.cpp | 50 | ||||
-rw-r--r-- | startupcache/test/TestStartupCacheTelemetry.js | 60 | ||||
-rw-r--r-- | startupcache/test/TestStartupCacheTelemetry.manifest | 2 | ||||
-rw-r--r-- | startupcache/test/moz.build | 4 |
4 files changed, 0 insertions, 116 deletions
diff --git a/startupcache/test/TestStartupCache.cpp b/startupcache/test/TestStartupCache.cpp index a16c2de72..dac85f9be 100644 --- a/startupcache/test/TestStartupCache.cpp +++ b/startupcache/test/TestStartupCache.cpp @@ -410,54 +410,10 @@ int main(int argc, char** argv) int rv = 0; nsresult scrv; - // Register TestStartupCacheTelemetry - nsCOMPtr<nsIFile> manifest; - scrv = NS_GetSpecialDirectory(NS_GRE_DIR, - getter_AddRefs(manifest)); - if (NS_FAILED(scrv)) { - fail("NS_XPCOM_CURRENT_PROCESS_DIR"); - return 1; - } - -#ifdef XP_MACOSX - nsCOMPtr<nsIFile> tempManifest; - manifest->Clone(getter_AddRefs(tempManifest)); - manifest->AppendNative( - NS_LITERAL_CSTRING("TestStartupCacheTelemetry.manifest")); - bool exists; - manifest->Exists(&exists); - if (!exists) { - // Workaround for bug 1080338 in mozharness. - manifest = tempManifest.forget(); - manifest->SetNativeLeafName(NS_LITERAL_CSTRING("MacOS")); - manifest->AppendNative( - NS_LITERAL_CSTRING("TestStartupCacheTelemetry.manifest")); - } -#else - manifest->AppendNative( - NS_LITERAL_CSTRING("TestStartupCacheTelemetry.manifest")); -#endif - - XRE_AddManifestLocation(NS_APP_LOCATION, manifest); - - nsCOMPtr<nsIObserver> telemetryThing = - do_GetService("@mozilla.org/testing/startup-cache-telemetry.js"); - if (!telemetryThing) { - fail("telemetryThing"); - return 1; - } - scrv = telemetryThing->Observe(nullptr, "save-initial", nullptr); - if (NS_FAILED(scrv)) { - fail("save-initial"); - rv = 1; - } - nsCOMPtr<nsIStartupCache> sc = do_GetService("@mozilla.org/startupcache/cache;1", &scrv); if (NS_FAILED(scrv)) rv = 1; - else - sc->RecordAgesAlways(); if (NS_FAILED(TestStartupWriteRead())) rv = 1; if (NS_FAILED(TestWriteInvalidateRead())) @@ -470,11 +426,5 @@ int main(int argc, char** argv) if (NS_FAILED(TestEarlyShutdown())) rv = 1; - scrv = telemetryThing->Observe(nullptr, "save-initial", nullptr); - if (NS_FAILED(scrv)) { - fail("check-final"); - rv = 1; - } - return rv; } diff --git a/startupcache/test/TestStartupCacheTelemetry.js b/startupcache/test/TestStartupCacheTelemetry.js deleted file mode 100644 index 7a570187f..000000000 --- a/startupcache/test/TestStartupCacheTelemetry.js +++ /dev/null @@ -1,60 +0,0 @@ -const Cc = Components.classes; -const Ci = Components.interfaces; -const Cu = Components.utils; - -Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); - -function shouldHaveChanged(a, b) -{ - if (a.length != b.length) { - throw Error("TEST-UNEXPECTED-FAIL: telemetry count array size changed"); - } - - for (let i = 0; i < a.length; ++i) { - if (a[i] == b[i]) { - continue; - } - return; // something was different, that's all that matters - } - throw Error("TEST-UNEXPECTED-FAIL: telemetry data didn't change"); -} - -function TestStartupCacheTelemetry() { } - -TestStartupCacheTelemetry.prototype = { - classID: Components.ID("{73cbeffd-d6c7-42f0-aaf3-f176430dcfc8}"), - QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]), - - saveInitial: function() { - let t = Services.telemetry; - this._age = t.getHistogramById("STARTUP_CACHE_AGE_HOURS").snapshot.counts; - this._invalid = t.getHistogramById("STARTUP_CACHE_INVALID").snapshot.counts; - }, - - checkFinal: function() { - let t = Services.telemetry; - let newAge = t.getHistogramById("STARTUP_CACHE_AGE_HOURS").snapshot.counts; - shouldHaveChanged(this._age, newAge); - - let newInvalid = t.getHistogramById("STARTUP_CACHE_INVALID").snapshot.counts; - shouldHaveChanged(this._invalid, newInvalid); - }, - - observe: function(subject, topic, data) { - switch (topic) { - case "save-initial": - this.saveInitial(); - break; - - case "check-final": - this.checkFinal(); - break; - - default: - throw Error("BADDOG, NO MILKBONE FOR YOU"); - } - }, -}; - -this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TestStartupCacheTelemetry]); diff --git a/startupcache/test/TestStartupCacheTelemetry.manifest b/startupcache/test/TestStartupCacheTelemetry.manifest deleted file mode 100644 index b288a7292..000000000 --- a/startupcache/test/TestStartupCacheTelemetry.manifest +++ /dev/null @@ -1,2 +0,0 @@ -component {73cbeffd-d6c7-42f0-aaf3-f176430dcfc8} TestStartupCacheTelemetry.js -contract @mozilla.org/testing/startup-cache-telemetry.js {73cbeffd-d6c7-42f0-aaf3-f176430dcfc8} diff --git a/startupcache/test/moz.build b/startupcache/test/moz.build index 1f5ac1c61..7aae3d871 100644 --- a/startupcache/test/moz.build +++ b/startupcache/test/moz.build @@ -7,7 +7,3 @@ GeckoCppUnitTests([ 'TestStartupCache', ]) -EXTRA_COMPONENTS += [ - 'TestStartupCacheTelemetry.js', - 'TestStartupCacheTelemetry.manifest', -] |