public void SetUp()
        {
            logSpy = new LogSpy();
            logSpy.Attach();

            var taskContext = new JoinableTaskContext();

            shellMock = Substitute.For <ILLDBShell>();

            commandWindowText = "";

            commandWindowMock = Substitute.For <IVsCommandWindow>();
            commandWindowMock.Print(Arg.Do <string>(x => commandWindowText += x));

            serviceProviderMock = Substitute.For <IServiceProvider>();

            yetiOptions = Substitute.For <OptionPageGrid>();
            var yetiService = new YetiVSIService(yetiOptions);

            serviceProviderMock.GetService(typeof(YetiVSIService)).Returns(yetiService);
            serviceProviderMock.GetService(typeof(SLLDBShell)).Returns(shellMock);
            serviceProviderMock.GetService(typeof(SVsCommandWindow)).Returns(commandWindowMock);

            menuCommandService = new OleMenuCommandService(serviceProviderMock);
            serviceProviderMock.GetService(typeof(IMenuCommandService)).Returns(menuCommandService);

            LLDBShellCommandTarget.Register(taskContext, serviceProviderMock);
        }
        public virtual YetiVSIService GetVsiService()
        {
            if (_vsiService == null)
            {
                _vsiService = (YetiVSIService)CreateServiceManager().RequireGlobalService(
                    typeof(YetiVSIService));
            }

            return(_vsiService);
        }
示例#3
0
        public LoadSymbolsCommand(JoinableTaskContext taskContext, IServiceProvider serviceProvider,
                                  IExceptionRecorder exceptionRecorder, YetiVSIService vsiService)
        {
            _taskContext       = taskContext;
            _serviceProvider   = serviceProvider;
            _exceptionRecorder = exceptionRecorder;
            _vsiService        = vsiService;

            _programs = new List <ILldbAttachedProgram>();
        }
示例#4
0
        public MediumTestServiceManager(JoinableTaskContext taskContext, OptionPageGrid vsiOptions)
            : base(taskContext)
        {
            var vsiService            = new YetiVSIService(vsiOptions);
            var symbolSettingsManager = new VsDebuggerSymbolSettingsManagerStub();
            var metrics = new MetricsService(taskContext, Versions.Populate(null));

            AddService(typeof(SVsShellDebugger), symbolSettingsManager);
            AddService(typeof(YetiVSIService), vsiService);
            AddService(typeof(SMetrics), metrics);
        }
示例#5
0
        public override YetiVSIService GetVsiService()
        {
            if (_vsiService == null)
            {
                var serviceOptions = OptionPageGrid.CreateForTesting();
                serviceOptions.NatvisLoggingLevel = NatvisLoggingLevelFeatureFlag.VERBOSE;

                _vsiService = new YetiVSIService(serviceOptions);
            }

            return(_vsiService);
        }
 public ServiceManagerStub(IMetrics metrics, SLLDBShell lldbShell,
                           YetiVSIService yetiVsiService, SVsOutputWindow outputWindow,
                           IVsDebuggerSymbolSettingsManager120A symbolSettingsManager,
                           ISessionNotifier sessionNotifier = null)
 {
     _services = new Dictionary <Type, object>()
     {
         { typeof(YetiVSIService), yetiVsiService },
         { typeof(SLLDBShell), lldbShell },
         { typeof(SMetrics), metrics },
         { typeof(SVsOutputWindow), outputWindow },
         { typeof(SVsShellDebugger), symbolSettingsManager },
         { typeof(SSessionNotifier), sessionNotifier },
     };
 }
示例#7
0
        public void TestDebugEngineConstructor()
        {
            var lldbShell             = TestDummyGenerator.Create <SLLDBShell>();
            var vsiService            = new YetiVSIService(OptionPageGrid.CreateForTesting());
            var metrics               = TestDummyGenerator.Create <IMetrics>();
            var vsOutputWindow        = new OutputWindowStub();
            var symbolSettingsManager = Substitute.For <IVsDebuggerSymbolSettingsManager120A>();
            var serviceManager        = new ServiceManagerStub(metrics, lldbShell, vsiService,
                                                               vsOutputWindow, symbolSettingsManager);
            var compRoot = new MediumTestDebugEngineFactoryCompRoot(
                serviceManager, new JoinableTaskContext(), new GameletClientStub.Factory(),
                TestDummyGenerator.Create <IWindowsRegistry>());

            var factory = compRoot.CreateDebugEngineFactory();

            factory.Create(null);
        }
        DebugEngineFactoryCompRootStub CreateEngineFactoryCompRoot(
            IDebugSessionLauncherFactory debugSessionLauncherFactory, IRemoteDeploy remoteDeploy)
        {
            var compRoot = new DebugEngineFactoryCompRootStub(
                debugSessionLauncherFactory, remoteDeploy, Substitute.For <IGameLauncher>());

            _metrics = Substitute.For <IMetrics>();
            _metrics.NewDebugSessionId().Returns(_debugSessionId);
            ISessionNotifier sessionNotifier = Substitute.For <ISessionNotifier>();
            SLLDBShell       lldbShell       = TestDummyGenerator.Create <SLLDBShell>();
            var vsiService            = new YetiVSIService(OptionPageGrid.CreateForTesting());
            var vsOutputWindow        = new OutputWindowStub();
            var symbolSettingsManager = Substitute.For <IVsDebuggerSymbolSettingsManager120A>();

            compRoot.ServiceManager =
                new ServiceManagerStub(_metrics, lldbShell, vsiService, vsOutputWindow,
                                       symbolSettingsManager, sessionNotifier);
            return(compRoot);
        }
        DebuggerOptionsCommand(JoinableTaskContext taskContext,
                               YetiVSIService vsiService,
                               IDebugEngineManager debugEngineManager,
                               IVsCommandWindow commandWindow,
                               IMenuCommandService menuCommandService)
        {
            taskContext.ThrowIfNotOnMainThread();

            this.taskContext        = taskContext;
            this.debugEngineManager = debugEngineManager;
            this.vsiService         = vsiService;

            commandWindowWriter = new CommandWindowWriter(taskContext, commandWindow);
            var menuCommand = new OleMenuCommand(HandleCommand,
                                                 new CommandID(YetiConstants.CommandSetGuid, PkgCmdID.cmdidDebuggerOptionsCommand));

            // Accept any parameter value.
            menuCommand.ParametersDescription = "$";
            menuCommandService?.AddCommand(menuCommand);
        }
示例#10
0
        public override YetiVSIService GetVsiService()
        {
            if (_vsiService != null)
            {
                return(_vsiService);
            }

            if (_serviceManager != null)
            {
                _vsiService = base.GetVsiService();
            }

            if (_vsiService == null)
            {
                OptionPageGrid vsiServiceOptions = OptionPageGrid.CreateForTesting();
                vsiServiceOptions.NatvisLoggingLevel = NatvisLoggingLevelFeatureFlag.VERBOSE;

                _vsiService = new YetiVSIService(vsiServiceOptions);
            }

            return(_vsiService);
        }
        public void SetUp()
        {
            logSpy = new LogSpy();
            logSpy.Attach();

            var taskContext = new JoinableTaskContext();

            commandWindowText = "";

            commandWindowMock = Substitute.For <IVsCommandWindow>();
            commandWindowMock.Print(Arg.Do <string>(x => commandWindowText += x));

            serviceProviderMock = Substitute.For <IServiceProvider>();

            yetiService = new YetiVSIService(null);

            serviceProviderMock.GetService(typeof(YetiVSIService)).Returns(yetiService);
            serviceProviderMock.GetService(typeof(SVsCommandWindow)).Returns(commandWindowMock);

            debugEngineCommandsMock = Substitute.For <IDebugEngineCommands>();

            // (internal): This needs to be a member variable since debugEngineManager tracks it
            //              by weak reference only!.
            debugEngineMock = Substitute.For <IGgpDebugEngine>();
            debugEngineMock.DebugEngineCommands.Returns(debugEngineCommandsMock);

            debugEngineManager = new DebugEngineManager();
            debugEngineManager.AddDebugEngine(debugEngineMock);

            serviceProviderMock.GetService(typeof(SDebugEngineManager))
            .Returns(debugEngineManager);

            menuCommandService = new OleMenuCommandService(serviceProviderMock);
            serviceProviderMock.GetService(typeof(IMenuCommandService))
            .Returns(menuCommandService);

            DebuggerOptionsCommand.Register(taskContext, serviceProviderMock);
        }