Bug 1461965 - Enable xpcshell test coverage for GeckoView Telemetry. r=chutten,froydnj,janerik

This patch introduces the nsITelemetryGeckoViewTesting IDL interface which
allows to control the Telemetry GeckoView persistence feature. This is
useful to enable xpcshell test coverage for GeckoView code on all platforms.

MozReview-Commit-ID: Hh0oq4qdqrX
This commit is contained in:
Alessio Placitelli
2018-06-05 17:01:04 +02:00
parent d0da1064cc
commit 852435261f
7 changed files with 131 additions and 0 deletions

View File

@@ -59,6 +59,10 @@
#include "nsPerformanceStats.h"
#endif // defined (MOZ_HAS_PERFSTATS)
#if defined(ENABLE_TESTS)
#include "geckoview/TelemetryGeckoViewTesting.h"
#endif
using namespace mozilla;
/////////////////////////////////////////////////////////////////////////////
@@ -128,6 +132,10 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ExtensionPolicyService, ExtensionPolicy
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSessionStoreUtils)
#if defined(ENABLE_TESTS)
NS_GENERIC_FACTORY_CONSTRUCTOR(TelemetryGeckoViewTestingImpl)
#endif
NS_DEFINE_NAMED_CID(NS_TOOLKIT_APPSTARTUP_CID);
#if defined(MOZ_HAS_PERFSTATS)
NS_DEFINE_NAMED_CID(NS_TOOLKIT_PERFORMANCESTATSSERVICE_CID);
@@ -162,6 +170,9 @@ NS_DEFINE_NAMED_CID(NS_ADDON_MANAGER_STARTUP_CID);
NS_DEFINE_NAMED_CID(NS_ADDON_POLICY_SERVICE_CID);
NS_DEFINE_NAMED_CID(NS_SESSIONSTOREUTILS_CID);
NS_DEFINE_NAMED_CID(NATIVE_FILEWATCHER_SERVICE_CID);
#if defined(ENABLE_TESTS)
NS_DEFINE_NAMED_CID(NS_TELEMETRYGECKOVIEWTESTING_CID);
#endif
static const Module::CIDEntry kToolkitCIDs[] = {
{ &kNS_TOOLKIT_APPSTARTUP_CID, false, nullptr, nsAppStartupConstructor },
@@ -197,6 +208,9 @@ static const Module::CIDEntry kToolkitCIDs[] = {
{ &kNS_ADDON_POLICY_SERVICE_CID, false, nullptr, ExtensionPolicyServiceConstructor },
{ &kNS_SESSIONSTOREUTILS_CID, false, nullptr, nsSessionStoreUtilsConstructor },
{ &kNATIVE_FILEWATCHER_SERVICE_CID, false, nullptr, NativeFileWatcherServiceConstructor },
#if defined(ENABLE_TESTS)
{ &kNS_TELEMETRYGECKOVIEWTESTING_CID, false, nullptr, TelemetryGeckoViewTestingImplConstructor },
#endif
{ nullptr }
};
@@ -235,6 +249,9 @@ static const Module::ContractIDEntry kToolkitContracts[] = {
{ NS_ADDON_POLICY_SERVICE_CONTRACTID, &kNS_ADDON_POLICY_SERVICE_CID },
{ NS_SESSIONSTOREUTILS_CONTRACTID, &kNS_SESSIONSTOREUTILS_CID },
{ NATIVE_FILEWATCHER_SERVICE_CONTRACTID, &kNATIVE_FILEWATCHER_SERVICE_CID },
#if defined(ENABLE_TESTS)
{ NS_TELEMETRYGECKOVIEWTESTING_CONTRACTID, &kNS_TELEMETRYGECKOVIEWTESTING_CID },
#endif
{ nullptr }
};