TestWorkspaceTrustRequestService

This commit is contained in:
Ladislau Szomoru 2021-04-21 10:18:39 +02:00
parent 3668a573ad
commit 9e8377d8cd
No known key found for this signature in database
GPG key ID: 2B88287CB9DB080B
2 changed files with 5 additions and 25 deletions

View file

@ -29,8 +29,8 @@ import { TestNotificationService } from 'vs/platform/notification/test/common/te
import { IHostService } from 'vs/workbench/services/host/browser/host';
import { mock } from 'vs/base/test/common/mock';
import { IExtensionBisectService } from 'vs/workbench/services/extensionManagement/browser/extensionBisect';
import { IWorkspaceTrustManagementService, IWorkspaceTrustRequestService } from 'vs/platform/workspace/common/workspaceTrust';
import { TestWorkspaceTrustManagementService, TestWorkspaceTrustRequestService } from 'vs/workbench/services/workspaces/test/common/testWorkspaceTrustService';
import { IWorkspaceTrustManagementService, IWorkspaceTrustRequestService, WorkspaceTrustRequestOptions } from 'vs/platform/workspace/common/workspaceTrust';
import { TestWorkspaceTrustManagementService } from 'vs/workbench/services/workspaces/test/common/testWorkspaceTrustService';
import { ExtensionManifestPropertiesService, IExtensionManifestPropertiesService } from 'vs/workbench/services/extensions/common/extensionManifestPropertiesService';
import { TestContextService, TestProductService } from 'vs/workbench/test/common/workbenchTestServices';
import { TestWorkspace } from 'vs/platform/workspace/test/common/testWorkspace';
@ -70,7 +70,7 @@ export class TestExtensionEnablementService extends ExtensionEnablementService {
instantiationService.get(IHostService),
new class extends mock<IExtensionBisectService>() { override isDisabledByBisect() { return false; } },
instantiationService.get(IWorkspaceTrustManagementService) || instantiationService.stub(IWorkspaceTrustManagementService, new TestWorkspaceTrustManagementService()),
instantiationService.get(IWorkspaceTrustRequestService) || instantiationService.stub(IWorkspaceTrustRequestService, new TestWorkspaceTrustRequestService()),
new class extends mock<IWorkspaceTrustRequestService>() { override requestWorkspaceTrust(options?: WorkspaceTrustRequestOptions): Promise<boolean> { return Promise.resolve(true); } },
instantiationService.get(IExtensionManifestPropertiesService) || instantiationService.stub(IExtensionManifestPropertiesService, new ExtensionManifestPropertiesService(TestProductService, new TestConfigurationService()))
);
}

View file

@ -3,9 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Emitter, Event } from 'vs/base/common/event';
import { Emitter } from 'vs/base/common/event';
import { URI } from 'vs/base/common/uri';
import { WorkspaceTrustRequestOptions, IWorkspaceTrustManagementService, IWorkspaceTrustRequestService, IWorkspaceTrustUriInfo } from 'vs/platform/workspace/common/workspaceTrust';
import { IWorkspaceTrustManagementService, IWorkspaceTrustUriInfo } from 'vs/platform/workspace/common/workspaceTrust';
export class TestWorkspaceTrustManagementService implements IWorkspaceTrustManagementService {
@ -62,23 +62,3 @@ export class TestWorkspaceTrustManagementService implements IWorkspaceTrustManag
}
}
}
export class TestWorkspaceTrustRequestService implements IWorkspaceTrustRequestService {
_serviceBrand: undefined;
onDidInitiateWorkspaceTrustRequest: Event<WorkspaceTrustRequestOptions> = Event.None;
onDidCompleteWorkspaceTrustRequest: Event<boolean> = Event.None;
cancelRequest(): void {
throw new Error('Method not implemented.');
}
completeRequest(trusted?: boolean): void {
throw new Error('Method not implemented.');
}
requestWorkspaceTrust(options?: WorkspaceTrustRequestOptions): Promise<boolean> {
return Promise.resolve(true);
}
}