Add more smoke tests and abstract more code (#10799)

* add more smoke tests and abstract more code

* fix missing imports
This commit is contained in:
Anthony Dresser
2020-06-10 12:12:35 -07:00
committed by GitHub
parent 187667f4f1
commit d849ed9357
6 changed files with 43 additions and 29 deletions

View File

@@ -17,6 +17,7 @@ import { IExtensionGalleryService } from 'vs/platform/extensionManagement/common
import { CancellationToken } from 'vs/base/common/cancellation';
import { IProductService } from 'vs/platform/product/common/productService';
import { IHostService } from 'vs/workbench/services/host/browser/host';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
export abstract class AbstractTelemetryOptOut implements IWorkbenchContribution {
@@ -33,10 +34,11 @@ export abstract class AbstractTelemetryOptOut implements IWorkbenchContribution
@IConfigurationService private readonly configurationService: IConfigurationService,
@IExtensionGalleryService private readonly galleryService: IExtensionGalleryService,
@IProductService private readonly productService: IProductService,
@IEnvironmentService private readonly environmentService: IEnvironmentService // {{SQL CARBON EDIT}} add service
) { }
protected async handleTelemetryOptOut(): Promise<void> {
if (this.productService.telemetryOptOutUrl && !this.storageService.get(AbstractTelemetryOptOut.TELEMETRY_OPT_OUT_SHOWN, StorageScope.GLOBAL)) {
if (!this.environmentService.disableTelemetry && this.productService.telemetryOptOutUrl && !this.storageService.get(AbstractTelemetryOptOut.TELEMETRY_OPT_OUT_SHOWN, StorageScope.GLOBAL)) { // {{SQL CARBON EDIT}} add disableTelemetry check
const experimentId = 'telemetryOptOut';
const [count, experimentState] = await Promise.all([this.getWindowCount(), this.experimentService.getExperimentById(experimentId)]);
@@ -164,9 +166,10 @@ export class BrowserTelemetryOptOut extends AbstractTelemetryOptOut {
@IExperimentService experimentService: IExperimentService,
@IConfigurationService configurationService: IConfigurationService,
@IExtensionGalleryService galleryService: IExtensionGalleryService,
@IProductService productService: IProductService
@IProductService productService: IProductService,
@IEnvironmentService environmentService: IEnvironmentService // {{SQL CARBON EDIT}} add service
) {
super(storageService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService);
super(storageService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService, environmentService);
this.handleTelemetryOptOut();
}

View File

@@ -14,6 +14,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
import { IHostService } from 'vs/workbench/services/host/browser/host';
import { AbstractTelemetryOptOut } from 'vs/workbench/contrib/welcome/telemetryOptOut/browser/telemetryOptOut';
import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
export class NativeTelemetryOptOut extends AbstractTelemetryOptOut {
@@ -27,9 +28,10 @@ export class NativeTelemetryOptOut extends AbstractTelemetryOptOut {
@IConfigurationService configurationService: IConfigurationService,
@IExtensionGalleryService galleryService: IExtensionGalleryService,
@IProductService productService: IProductService,
@IElectronService private readonly electronService: IElectronService
@IEnvironmentService environmentService: IEnvironmentService, // {{SQL CARBON EDIT}} add service
@IElectronService private readonly electronService: IElectronService,
) {
super(storageService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService);
super(storageService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService, environmentService);
this.handleTelemetryOptOut();
}