From d690b2d7e2192d20a1a0b7ee4e7759d792b5a1c8 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Fri, 23 Apr 2021 16:15:19 -0700 Subject: [PATCH] Fix notebook tests --- .../notebook/test/testNotebookEditor.ts | 3 +++ .../test/common/testWorkspaceTrustService.ts | 26 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts b/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts index f49960fca44..1b66f9e506f 100644 --- a/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts +++ b/src/vs/workbench/contrib/notebook/test/testNotebookEditor.ts @@ -40,6 +40,8 @@ import { ModeServiceImpl } from 'vs/editor/common/services/modeServiceImpl'; import { ILogService, NullLogService } from 'vs/platform/log/common/log'; import { IStorageService } from 'vs/platform/storage/common/storage'; import { TestStorageService } from 'vs/workbench/test/common/workbenchTestServices'; +import { IWorkspaceTrustRequestService } from 'vs/platform/workspace/common/workspaceTrust'; +import { TestWorkspaceTrustRequestService } from 'vs/workbench/services/workspaces/test/common/testWorkspaceTrustService'; export class TestCell extends NotebookCellTextModel { constructor( @@ -143,6 +145,7 @@ export function setupInstantiationService() { instantiationService.stub(IClipboardService, new BrowserClipboardService()); instantiationService.stub(ILogService, new NullLogService()); instantiationService.stub(IStorageService, new TestStorageService()); + instantiationService.stub(IWorkspaceTrustRequestService, new TestWorkspaceTrustRequestService(true)); return instantiationService; } diff --git a/src/vs/workbench/services/workspaces/test/common/testWorkspaceTrustService.ts b/src/vs/workbench/services/workspaces/test/common/testWorkspaceTrustService.ts index 36dabc3934b..d3d696eb9a5 100644 --- a/src/vs/workbench/services/workspaces/test/common/testWorkspaceTrustService.ts +++ b/src/vs/workbench/services/workspaces/test/common/testWorkspaceTrustService.ts @@ -5,7 +5,7 @@ import { Emitter } from 'vs/base/common/event'; import { URI } from 'vs/base/common/uri'; -import { IWorkspaceTrustManagementService, IWorkspaceTrustUriInfo } from 'vs/platform/workspace/common/workspaceTrust'; +import { IWorkspaceTrustManagementService, IWorkspaceTrustRequestService, IWorkspaceTrustUriInfo, WorkspaceTrustRequestOptions } from 'vs/platform/workspace/common/workspaceTrust'; export class TestWorkspaceTrustManagementService implements IWorkspaceTrustManagementService { @@ -62,3 +62,27 @@ export class TestWorkspaceTrustManagementService implements IWorkspaceTrustManag } } } + +export class TestWorkspaceTrustRequestService implements IWorkspaceTrustRequestService { + _serviceBrand: any; + + private readonly _onDidInitiateWorkspaceTrustRequest = new Emitter(); + readonly onDidInitiateWorkspaceTrustRequest = this._onDidInitiateWorkspaceTrustRequest.event; + + private readonly _onDidCompleteWorkspaceTrustRequest = new Emitter(); + readonly onDidCompleteWorkspaceTrustRequest = this._onDidCompleteWorkspaceTrustRequest.event; + + constructor(private readonly _trusted: boolean) { } + + cancelRequest(): void { + throw new Error('Method not implemented.'); + } + + completeRequest(trusted?: boolean): void { + throw new Error('Method not implemented.'); + } + + async requestWorkspaceTrust(options?: WorkspaceTrustRequestOptions): Promise { + return this._trusted; + } +}