public void SetUp() { taskContext = new JoinableTaskContext(); mockMemoryMappedFileFactory = Substitute.For <MemoryMappedFileFactory>(); transportSessionFactory = new LldbTransportSession.Factory(mockMemoryMappedFileFactory); mockManagedProcessFactory = Substitute.For <ManagedProcess.Factory>(); mockGrpcCallInvoker = Substitute.ForPartsOf <PipeCallInvoker>(_numGrpcPipePairs); mockGrpcCallInvokerFactory = Substitute.For <PipeCallInvokerFactory>(); mockGrpcCallInvokerFactory.Create().Returns(mockGrpcCallInvoker); mockGrpcConnectionFactory = Substitute.For <GrpcConnectionFactory>(); optionPageGrid = Substitute.For <IExtensionOptions>(); service = new YetiVSIService(optionPageGrid); var mockVsOutputWindow = Substitute.For <IVsOutputWindow>(); mockDialogUtil = Substitute.For <IDialogUtil>(); yetiDebugTransport = new YetiDebugTransport(taskContext, transportSessionFactory, mockGrpcCallInvokerFactory, mockGrpcConnectionFactory, onAsyncRpcCompleted: null, managedProcessFactory: mockManagedProcessFactory, dialogUtil: mockDialogUtil, vsOutputWindow: mockVsOutputWindow, yetiVSIService: service); abortError = null; yetiDebugTransport.OnStop += e => { abortError = e; }; }
public override IDebugEngineFactory CreateDebugEngineFactory() { ServiceManager serviceManager = CreateServiceManager(); var joinableTaskContext = GetJoinableTaskContext(); var vsiService = GetVsiService(); joinableTaskContext.ThrowIfNotOnMainThread(); var debugEngineCommands = new DebugEngineCommands(joinableTaskContext, null, false); var actionRecorder = new ActionRecorder(GetDebugSessionMetrics()); var backgroundProcessFactory = new BackgroundProcess.Factory(); var processFactory = new ManagedProcess.Factory(); var binaryFileUtil = new ElfFileUtil(processFactory); var lldbModuleUtil = new LldbModuleUtil(); IModuleFileFinder moduleFileFinder = Substitute.For <IModuleFileFinder>(); var moduleFileLoadRecorderFactory = new ModuleFileLoadMetricsRecorder.Factory(lldbModuleUtil, moduleFileFinder); var grpcInterceptors = CreateGrpcInterceptors(vsiService.DebuggerOptions); var vsOutputWindow = serviceManager.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; var callInvokerFactory = new PipeCallInvokerFactory(); var transportSessionFactory = new LldbTransportSession.Factory(new MemoryMappedFileFactory()); var yetiTransport = new YetiDebugTransport( joinableTaskContext, transportSessionFactory, callInvokerFactory, new GrpcConnectionFactory(joinableTaskContext.Factory, grpcInterceptors.ToArray()), GetTaskExecutor().CancelAsyncOperationIfRequested, processFactory, _dialogUtil, vsOutputWindow, vsiService); var chromeLauncher = new ChromeLauncher(backgroundProcessFactory); var testClientLauncherFactory = new ChromeClientsLauncher.Factory( new ChromeClientLaunchCommandFormatter(GetJsonUtil()), GetSdkConfigFactory(), chromeLauncher); var exitDialogUtil = new ExitDialogUtil(_dialogUtil, GetDialogExecutionContext()); var preflightBinaryChecker = new PreflightBinaryChecker(GetFileSystem(), binaryFileUtil); var paramsFactory = new YetiVSI.DebugEngine.DebugEngine.Params.Factory(GetJsonUtil()); var cancelableTaskFactory = GetCancelableTaskFactory(); bool deployLldbServer = true; IDebugEngineFactory factory = new YetiVSI.DebugEngine.DebugEngine.Factory( joinableTaskContext, serviceManager, GetDebugSessionMetrics(), yetiTransport, actionRecorder, null, moduleFileLoadRecorderFactory, moduleFileFinder, testClientLauncherFactory, GetNatvis(), GetNatvisDiagnosticLogger(), exitDialogUtil, preflightBinaryChecker, _debugSessionLauncherFactory, paramsFactory, _remoteDeploy, cancelableTaskFactory, _dialogUtil, GetNatvisLoggerOutputWindowListener(), GetSolutionExplorer(), debugEngineCommands, GetDebugEventCallbackDecorator(vsiService.DebuggerOptions), GetSymbolSettingsProvider(), deployLldbServer, _gameLauncher); return(GetFactoryDecorator().Decorate(factory)); }
public void Setup() { mockMemoryMappedFileFactory = Substitute.For <MemoryMappedFileFactory>(); mockMemoryMappedFile = Substitute.For <IMemoryMappedFile>(); // The first session should get a memory mapped file on the first try. mockMemoryMappedFileFactory.CreateNew(FILE_PREFIX + 0, Arg.Any <long>()).Returns( mockMemoryMappedFile); transportSessionFactory = new LldbTransportSession.Factory(mockMemoryMappedFileFactory); transportSession = transportSessionFactory.Create(); }
public YetiDebugTransport(JoinableTaskContext taskContext, LldbTransportSession.Factory transportSessionFactory, PipeCallInvokerFactory grpcCallInvokerFactory, GrpcConnectionFactory grpcConnectionFactory, Action onAsyncRpcCompleted, ManagedProcess.Factory managedProcessFactory, IDialogUtil dialogUtil, IVsOutputWindow vsOutputWindow, IYetiVSIService yetiVSIService) { taskContext.ThrowIfNotOnMainThread(); this.taskContext = taskContext; this.grpcCallInvokerFactory = grpcCallInvokerFactory; this.grpcConnectionFactory = grpcConnectionFactory; this.onAsyncRpcCompleted = onAsyncRpcCompleted; this.managedProcessFactory = managedProcessFactory; this.transportSessionFactory = transportSessionFactory; this.dialogUtil = dialogUtil; Guid debugPaneGuid = VSConstants.GUID_OutWindowDebugPane; vsOutputWindow?.GetPane(ref debugPaneGuid, out debugPane); this.yetiVSIService = yetiVSIService; }