From 8465489bbd4f1c262848a3d752e086db4e896e80 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Thu, 4 Mar 2021 10:38:54 -0800 Subject: [PATCH] Fix unit tests --- .../test/browser/workbenchTestServices.ts | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/vs/workbench/test/browser/workbenchTestServices.ts b/src/vs/workbench/test/browser/workbenchTestServices.ts index fb8c8ece7d2..cb96d1a57b9 100644 --- a/src/vs/workbench/test/browser/workbenchTestServices.ts +++ b/src/vs/workbench/test/browser/workbenchTestServices.ts @@ -63,7 +63,7 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { ViewletDescriptor, Viewlet } from 'vs/workbench/browser/viewlet'; import { IViewlet } from 'vs/workbench/common/viewlet'; import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; -import { IProcessEnvironment, isLinux, isWindows, Platform } from 'vs/base/common/platform'; +import { IProcessEnvironment, isLinux, isWindows } from 'vs/base/common/platform'; import { LabelService } from 'vs/workbench/services/label/common/labelService'; import { Part } from 'vs/workbench/browser/part'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; @@ -126,9 +126,9 @@ import { SideBySideEditor } from 'vs/workbench/browser/parts/editor/sideBySideEd import { IEnterWorkspaceResult, IRecent, IRecentlyOpened, IWorkspaceFolderCreationData, IWorkspaceIdentifier, IWorkspacesService } from 'vs/platform/workspaces/common/workspaces'; import { IWorkspaceTrustService } from 'vs/platform/workspace/common/workspaceTrust'; import { TestWorkspaceTrustService } from 'vs/workbench/services/workspaces/test/common/testWorkspaceTrustService'; -import { ITerminalInstanceService } from 'vs/workbench/contrib/terminal/browser/terminal'; -import { IShellLaunchConfig, ITerminalChildProcess, ITerminalsLayoutInfo, ITerminalsLayoutInfoById } from 'vs/platform/terminal/common/terminal'; +import { ILocalTerminalService, IShellLaunchConfig, ITerminalChildProcess, ITerminalsLayoutInfo, ITerminalsLayoutInfoById } from 'vs/platform/terminal/common/terminal'; import { ISetTerminalLayoutInfoArgs } from 'vs/platform/terminal/common/terminalProcess'; +import { ITerminalInstanceService } from 'vs/workbench/contrib/terminal/browser/terminal'; export function createFileEditorInput(instantiationService: IInstantiationService, resource: URI): FileEditorInput { return instantiationService.createInstance(FileEditorInput, resource, undefined, undefined, undefined, undefined, undefined); @@ -231,6 +231,7 @@ export function workbenchInstantiationService( instantiationService.stub(IWorkspacesService, new TestWorkspacesService()); instantiationService.stub(IWorkspaceTrustService, new TestWorkspaceTrustService()); instantiationService.stub(ITerminalInstanceService, new TestTerminalInstanceService()); + instantiationService.stub(ILocalTerminalService, new TestLocalTerminalService()); return instantiationService; } @@ -1459,15 +1460,7 @@ export class TestWorkspacesService implements IWorkspacesService { export class TestTerminalInstanceService implements ITerminalInstanceService { declare readonly _serviceBrand: undefined; - onPtyHostExit = Event.None; - onPtyHostUnresponsive = Event.None; - onPtyHostResponsive = Event.None; - onPtyHostRestart = Event.None; - - async createTerminalProcess(shellLaunchConfig: IShellLaunchConfig, cwd: string, cols: number, rows: number, env: IProcessEnvironment, windowsEnableConpty: boolean, shouldPersist: boolean): Promise { - return new TestTerminalChildProcess(shouldPersist); - } - async getDefaultShellAndArgs(useAutomationShell: boolean, platformOverride?: Platform): Promise<{ shell: string, args: string[] | string | undefined }> { + async getDefaultShellAndArgs(): Promise<{ shell: string, args: string[] | string | undefined }> { return { shell: 'bash', args: undefined @@ -1482,6 +1475,21 @@ export class TestTerminalInstanceService implements ITerminalInstanceService { async getXtermUnicode11Constructor(): Promise { throw new Error('Method not implemented.'); } async getXtermWebglConstructor(): Promise { throw new Error('Method not implemented.'); } createWindowsShellHelper(shellProcessId: number, xterm: any): any { throw new Error('Method not implemented.'); } +} + + +export class TestLocalTerminalService implements ILocalTerminalService { + declare readonly _serviceBrand: undefined; + + onPtyHostExit = Event.None; + onPtyHostUnresponsive = Event.None; + onPtyHostResponsive = Event.None; + onPtyHostRestart = Event.None; + + async createTerminalProcess(shellLaunchConfig: IShellLaunchConfig, cwd: string, cols: number, rows: number, env: IProcessEnvironment, windowsEnableConpty: boolean, shouldPersist: boolean): Promise { + return new TestTerminalChildProcess(shouldPersist); + } + async attachToProcess(id: number): Promise { throw new Error('Method not implemented.'); } setTerminalLayoutInfo(argsOrLayout?: ISetTerminalLayoutInfoArgs | ITerminalsLayoutInfoById): void { throw new Error('Method not implemented.'); } async getTerminalLayoutInfo(): Promise { throw new Error('Method not implemented.'); }