コード例 #1
0
 public MediumTestGgpDebugQueryTargetCompRoot(ServiceManager serviceManager,
                                              IDialogUtil dialogUtil,
                                              IGameletClientFactory gameletClientFactory =
                                              null) : base(serviceManager, dialogUtil)
 {
     _gameletClientFactory = gameletClientFactory;
 }
コード例 #2
0
        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; };
        }
コード例 #3
0
 public GameletMountChecker(IRemoteCommand remoteCommand, IDialogUtil dialogUtil,
                            CancelableTask.Factory cancelableTaskFactory)
 {
     _remoteCommand         = remoteCommand;
     _dialogUtil            = dialogUtil;
     _cancelableTaskFactory = cancelableTaskFactory;
 }
コード例 #4
0
 // Constructor for tests.
 public GgpDebugQueryTarget(IFileSystem fileSystem, SdkConfig.Factory sdkConfigFactory,
                            IGameletClientFactory gameletClientFactory,
                            IApplicationClientFactory applicationClientFactory,
                            CancelableTask.Factory cancelableTaskFactory,
                            IDialogUtil dialogUtil, IRemoteDeploy remoteDeploy,
                            DebugSessionMetrics metrics,
                            ICredentialManager credentialManager,
                            ITestAccountClientFactory testAccountClientFactory,
                            IGameletSelectorFactory gameletSelectorFactory,
                            ICloudRunner cloudRunner, Versions.SdkVersion sdkVersion,
                            ChromeClientLaunchCommandFormatter launchCommandFormatter,
                            DebugEngine.DebugEngine.Params.Factory paramsFactory,
                            IYetiVSIService yetiVsiService, IGameLauncher gameLauncher)
 {
     _fileSystem               = fileSystem;
     _sdkConfigFactory         = sdkConfigFactory;
     _gameletClientFactory     = gameletClientFactory;
     _applicationClientFactory = applicationClientFactory;
     _cancelableTaskFactory    = cancelableTaskFactory;
     _dialogUtil               = dialogUtil;
     _remoteDeploy             = remoteDeploy;
     _metrics                  = metrics;
     _credentialManager        = credentialManager;
     _testAccountClientFactory = testAccountClientFactory;
     _cloudRunner              = cloudRunner;
     _yetiVsiService           = yetiVsiService;
     _gameletSelectorFactory   = gameletSelectorFactory;
     _sdkVersion               = sdkVersion;
     _launchCommandFormatter   = launchCommandFormatter;
     _paramsFactory            = paramsFactory;
     _gameLauncher             = gameLauncher;
 }
コード例 #5
0
        public override IDialogUtil GetDialogUtil()
        {
            if (_dialogUtil == null)
            {
                _dialogUtil = new DialogUtilFake();
            }

            return(_dialogUtil);
        }
コード例 #6
0
        public virtual IDialogUtil GetDialogUtil()
        {
            if (_dialogUtil == null)
            {
                _dialogUtil = new DialogUtil();
            }

            return(_dialogUtil);
        }
コード例 #7
0
 public VsiGameLaunchFactory(IGameletClient gameletClient,
                             CancelableTask.Factory cancelableTaskFactory,
                             IGameLaunchBeHelper gameLaunchBeHelper,
                             ActionRecorder actionRecorder, IDialogUtil dialogUtil)
 {
     _gameletClient         = gameletClient;
     _cancelableTaskFactory = cancelableTaskFactory;
     _gameLaunchBeHelper    = gameLaunchBeHelper;
     _actionRecorder        = actionRecorder;
     _dialogUtil            = dialogUtil;
 }
コード例 #8
0
        private CoreAttachCommand(Package package)
        {
            this.package   = package;
            dialogUtil     = new DialogUtil();
            serviceManager = new ServiceManager();

            ((package as IServiceProvider)
             .GetService(typeof(IMenuCommandService)) as OleMenuCommandService)?.AddCommand(
                new MenuCommand(HandleCoreAttachCommand, new CommandID(
                                    YetiConstants.CommandSetGuid,
                                    PkgCmdID.cmdidCrashDumpAttachCommand)));
        }
コード例 #9
0
 public void Setup()
 {
     _gameletClient         = Substitute.For <IGameletClient>();
     _cancelableTaskFactory = Substitute.For <CancelableTask.Factory>();
     _gameLaunchBeHelper    = Substitute.For <IGameLaunchBeHelper>();
     _metrics        = Substitute.For <IMetrics>();
     _actionRecorder = Substitute.For <ActionRecorder>(_metrics);
     _dialogUtil     = Substitute.For <IDialogUtil>();
     _launcher       = Substitute.For <IChromeClientsLauncher>();
     _params         = new LaunchParams();
     _launcher.LaunchParams.Returns(_params);
 }
コード例 #10
0
 public Factory(DebugProcess.Factory debugProcessFactory,
                ProcessListRequest.Factory processListRequestFactory,
                CancelableTask.Factory cancelableTaskFactory, IDialogUtil dialogUtil,
                ISshManager sshManager, IMetrics metrics, string developerAccount)
 {
     _debugProcessFactory       = debugProcessFactory;
     _processListRequestFactory = processListRequestFactory;
     _cancelableTaskFactory     = cancelableTaskFactory;
     _dialogUtil       = dialogUtil;
     _sshManager       = sshManager;
     _metrics          = metrics;
     _developerAccount = developerAccount;
 }
コード例 #11
0
 // Creates a DebugPortSupplier with specific factories.  Used by tests.
 public DebugPortSupplier(DebugPort.Factory debugPortFactory,
                          GameletClient.Factory gameletClientFactory,
                          IExtensionOptions options, IDialogUtil dialogUtil,
                          CancelableTask.Factory cancelableTaskFactory, IMetrics metrics,
                          ICloudRunner cloudRunner, string developerAccount)
 {
     _debugPortFactory      = debugPortFactory;
     _gameletClientFactory  = gameletClientFactory;
     _dialogUtil            = dialogUtil;
     _cancelableTaskFactory = cancelableTaskFactory;
     _metrics          = metrics;
     _cloudRunner      = cloudRunner;
     _developerAccount = developerAccount;
 }
コード例 #12
0
ファイル: GameLauncher.cs プロジェクト: googlestadia/vsi-lldb
 public GameLauncher(IGameletClient gameletClient, IYetiVSIService vsiService,
                     ILaunchGameParamsConverter launchGameParamsConverter,
                     CancelableTask.Factory cancelableTaskFactory,
                     ActionRecorder actionRecorder, IDialogUtil dialogUtil,
                     IVsiGameLaunchFactory vsiLaunchFactory)
 {
     _gameletClient             = gameletClient;
     _vsiService                = vsiService;
     _cancelableTaskFactory     = cancelableTaskFactory;
     _actionRecorder            = actionRecorder;
     _launchGameParamsConverter = launchGameParamsConverter;
     _dialogUtil                = dialogUtil;
     _vsiLaunchFactory          = vsiLaunchFactory;
 }
コード例 #13
0
        public CoreAttachWindow(IServiceProvider serviceProvider)
        {
            var serviceManager = new ServiceManager();

            _taskContext = serviceManager.GetJoinableTaskContext();

            _dialogUtil = new DialogUtil();
            IExtensionOptions options =
                ((YetiVSIService)serviceManager.RequireGlobalService(typeof(YetiVSIService)))
                .Options;
            var managedProcessFactory = new ManagedProcess.Factory();
            var progressDialogFactory = new ProgressDialog.Factory();

            _cancelableTaskFactory =
                new CancelableTask.Factory(_taskContext, progressDialogFactory);
            _coreListRequest = new CoreListRequest.Factory().Create();
            var jsonUtil = new JsonUtil();
            var credentialConfigFactory = new CredentialConfig.Factory(jsonUtil);
            var accountOptionLoader     = new VsiAccountOptionLoader(options);
            var credentialManager       =
                new CredentialManager(credentialConfigFactory, accountOptionLoader);

            _developerAccount = credentialManager.LoadAccount();
            IRemoteCommand remoteCommand = new RemoteCommand(managedProcessFactory);

            _remoteFile = new RemoteFile(managedProcessFactory);
            var cloudConnection  = new CloudConnection();
            var sdkConfigFactory = new SdkConfig.Factory(jsonUtil);

            // NOTE: the lifetime of this CloudRunner is limited to the current CoreAttachWindow.
            _cloudRunner = new CloudRunner(sdkConfigFactory, credentialManager, cloudConnection,
                                           new GgpSDKUtil());
            _gameletClientFactory = new GameletClient.Factory();
            var sshKeyLoader        = new SshKeyLoader(managedProcessFactory);
            var sshKnownHostsWriter = new SshKnownHostsWriter();

            _sshManager = new SshManager(_gameletClientFactory, _cloudRunner, sshKeyLoader,
                                         sshKnownHostsWriter, remoteCommand);
            _debugSessionMetrics = new DebugSessionMetrics(
                serviceProvider.GetService(typeof(SMetrics)) as IMetrics);
            _debugSessionMetrics.UseNewDebugSessionId();
            _actionRecorder = new ActionRecorder(_debugSessionMetrics);

            InitializeComponent();
            _instanceSelectionWindowFactory = new ProjectInstanceSelection.Factory();
            _paramsFactory = new DebugEngine.DebugEngine.Params.Factory(jsonUtil);
            SelectInstanceOnInit();
        }
コード例 #14
0
 public GameletSelectorFactory(IDialogUtil dialogUtil, ICloudRunner runner,
                               InstanceSelectionWindow.Factory gameletSelectionWindowFactory,
                               CancelableTask.Factory cancelableTaskFactory,
                               IGameletClientFactory gameletClientFactory,
                               ISshManager sshManager, IRemoteCommand remoteCommand,
                               IGameLaunchBeHelper gameLaunchBeHelper,
                               JoinableTaskContext taskContext)
 {
     _dialogUtil = dialogUtil;
     _runner     = runner;
     _gameletSelectionWindowFactory = gameletSelectionWindowFactory;
     _cancelableTaskFactory         = cancelableTaskFactory;
     _gameletClientFactory          = gameletClientFactory;
     _sshManager         = sshManager;
     _remoteCommand      = remoteCommand;
     _gameLaunchBeHelper = gameLaunchBeHelper;
     _taskContext        = taskContext;
 }
コード例 #15
0
 public GameletSelectorLegacyFlow(
     IDialogUtil dialogUtil, ICloudRunner runner,
     InstanceSelectionWindow.Factory gameletSelectionWindowFactory,
     CancelableTask.Factory cancelableTaskFactory,
     IGameletClientFactory gameletClientFactory, ISshManager sshManager,
     IRemoteCommand remoteCommand, ActionRecorder actionRecorder)
 {
     _dialogUtil = dialogUtil;
     _runner     = runner;
     _gameletSelectionWindowFactory = gameletSelectionWindowFactory;
     _cancelableTaskFactory         = cancelableTaskFactory;
     _gameletClientFactory          = gameletClientFactory;
     _sshManager    = sshManager;
     _remoteCommand = remoteCommand;
     _mountChecker  =
         new GameletMountChecker(remoteCommand, dialogUtil, cancelableTaskFactory);
     _actionRecorder = actionRecorder;
 }
コード例 #16
0
        // Creates a DebugPortSupplier.  This will be invoked by Visual Studio based on this class
        // Guid being in the registry.
        public DebugPortSupplier()
        {
            // Factory creation for the PortSupplier entry point.
            var serviceManager        = new ServiceManager();
            IExtensionOptions options =
                ((YetiVSIService)serviceManager.RequireGlobalService(typeof(YetiVSIService)))
                .Options;
            var taskContext               = serviceManager.GetJoinableTaskContext();
            var debugPropertyFactory      = new DebugProperty.Factory();
            var debugProgramFactory       = new DebugProgram.Factory(debugPropertyFactory, options);
            var debugProcessFactory       = new DebugProcess.Factory(debugProgramFactory);
            var managedProcessFactory     = new ManagedProcess.Factory();
            var processListRequestFactory = new ProcessListRequest.Factory(managedProcessFactory);
            var jsonUtil                = new JsonUtil();
            var sdkConfigFactory        = new SdkConfig.Factory(jsonUtil);
            var credentialConfigFactory = new CredentialConfig.Factory(jsonUtil);
            var accountOptionLoader     = new VsiAccountOptionLoader(options);
            var credentialManager       =
                new CredentialManager(credentialConfigFactory, accountOptionLoader);

            _developerAccount = credentialManager.LoadAccount();
            _dialogUtil       = new DialogUtil();
            var progressDialogFactory = new ProgressDialog.Factory();

            _cancelableTaskFactory = new CancelableTask.Factory(taskContext, progressDialogFactory);
            var cloudConnection = new CloudConnection();

            // NOTE: this CloudRunner is re-used for all subsequent Attach to Process windows.
            _cloudRunner = new CloudRunner(sdkConfigFactory, credentialManager, cloudConnection,
                                           new GgpSDKUtil());
            var sshKeyLoader        = new SshKeyLoader(managedProcessFactory);
            var sshKnownHostsWriter = new SshKnownHostsWriter();

            _gameletClientFactory = new GameletClient.Factory();
            var sshManager =
                new SshManager(_gameletClientFactory, _cloudRunner, sshKeyLoader,
                               sshKnownHostsWriter, new RemoteCommand(managedProcessFactory));

            _metrics          = (IMetrics)serviceManager.RequireGlobalService(typeof(SMetrics));
            _debugPortFactory = new DebugPort.Factory(
                debugProcessFactory, processListRequestFactory, _cancelableTaskFactory, _dialogUtil,
                sshManager, _metrics, _developerAccount);
        }
コード例 #17
0
 public VsiGameLaunch(string launchName, bool isDeveloperResumeOfferEnabled,
                      IGameletClient gameletClient,
                      CancelableTask.Factory cancelableTaskFactory,
                      IGameLaunchBeHelper gameLaunchBeHelper, ActionRecorder actionRecorder,
                      IDialogUtil dialogUtil, int pollingTimeoutMs = 120 * 1000,
                      int pollingTimeoutResumeOfferMs = 120 * 60 * 1000,
                      int pollDelayMs = 500)
 {
     LaunchName = launchName;
     _isDeveloperResumeOfferEnabled = isDeveloperResumeOfferEnabled;
     _gameletClient               = gameletClient;
     _cancelableTaskFactory       = cancelableTaskFactory;
     _gameLaunchBeHelper          = gameLaunchBeHelper;
     _actionRecorder              = actionRecorder;
     _dialogUtil                  = dialogUtil;
     _pollingTimeoutMs            = pollingTimeoutMs;
     _pollingTimeoutResumeOfferMs = pollingTimeoutResumeOfferMs;
     _pollDelayMs                 = pollDelayMs;
 }
コード例 #18
0
 DebugPort(DebugProcess.Factory debugProcessFactory,
           ProcessListRequest.Factory processListRequestFactory,
           CancelableTask.Factory cancelableTaskFactory, IDialogUtil dialogUtil,
           ISshManager sshManager, IMetrics metrics, Gamelet gamelet,
           IDebugPortSupplier2 supplier, string debugSessionId, string developerAccount)
 {
     _debugProcessFactory       = debugProcessFactory;
     _processListRequestFactory = processListRequestFactory;
     _dialogUtil            = dialogUtil;
     _guid                  = Guid.NewGuid();
     _supplier              = supplier;
     _developerAccount      = developerAccount;
     _cancelableTaskFactory = cancelableTaskFactory;
     _sshManager            = sshManager;
     _debugSessionMetrics   = new DebugSessionMetrics(metrics);
     _debugSessionMetrics.DebugSessionId = debugSessionId;
     _actionRecorder = new ActionRecorder(_debugSessionMetrics);
     Gamelet         = gamelet;
 }
コード例 #19
0
 public GameletSelector(IDialogUtil dialogUtil, ICloudRunner runner,
                        InstanceSelectionWindow.Factory gameletSelectionWindowFactory,
                        CancelableTask.Factory cancelableTaskFactory,
                        IGameletClientFactory gameletClientFactory, ISshManager sshManager,
                        IRemoteCommand remoteCommand, IGameLaunchBeHelper gameLaunchBeHelper,
                        JoinableTaskContext taskContext, ActionRecorder actionRecorder)
 {
     _dialogUtil = dialogUtil;
     _runner     = runner;
     _gameletSelectionWindowFactory = gameletSelectionWindowFactory;
     _cancelableTaskFactory         = cancelableTaskFactory;
     _gameletClientFactory          = gameletClientFactory;
     _sshManager    = sshManager;
     _remoteCommand = remoteCommand;
     _mountChecker  =
         new GameletMountChecker(remoteCommand, dialogUtil, cancelableTaskFactory);
     _gameLaunchBeHelper = gameLaunchBeHelper;
     _taskContext        = taskContext;
     _actionRecorder     = actionRecorder;
 }
コード例 #20
0
        public void SetUp()
        {
            _processFactory = Substitute.For <DebugProcess.Factory>();
            _dialogUtil     = Substitute.For <IDialogUtil>();
            _sshManager     = Substitute.For <ISshManager>();

            _processListRequest = Substitute.For <IProcessListRequest>();
            var processListRequestFactory = Substitute.For <ProcessListRequest.Factory>();

            processListRequestFactory.Create().Returns(_processListRequest);

            var cancelableTaskFactory =
                FakeCancelableTask.CreateFactory(new JoinableTaskContext(), false);

            _metrics = Substitute.For <IMetrics>();

            _portFactory = new DebugPort.Factory(_processFactory, processListRequestFactory,
                                                 cancelableTaskFactory, _dialogUtil, _sshManager,
                                                 _metrics, _reserverAccount);
            _portSupplier = Substitute.For <IDebugPortSupplier2>();
        }
コード例 #21
0
        public void SetUp()
        {
            _debugPortFactory = Substitute.For <DebugPort.Factory>();
            _gameletClient    = Substitute.For <IGameletClient>();
            var gameletClientFactory = Substitute.For <GameletClient.Factory>();

            gameletClientFactory.Create(Arg.Any <ICloudRunner>()).Returns(_gameletClient);
            _dialogUtil = Substitute.For <IDialogUtil>();
            _options    = Substitute.For <IExtensionOptions>();

            var cancelableTaskRunnerFactory =
                FakeCancelableTask.CreateFactory(new JoinableTaskContext(), false);

            _metrics = Substitute.For <IMetrics>();
            _metrics.NewDebugSessionId().Returns(_testDebugSessionId);

            var cloudRunner = Substitute.For <ICloudRunner>();

            _portSupplier = new DebugPortSupplier(_debugPortFactory, gameletClientFactory, _options,
                                                  _dialogUtil, cancelableTaskRunnerFactory,
                                                  _metrics, cloudRunner, _reserver);
        }
コード例 #22
0
        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;
        }
コード例 #23
0
        public void Setup()
        {
            _cancelable            = Substitute.For <ICancelableTask>();
            _action                = Substitute.For <IAction>();
            _gameletClient         = Substitute.For <IGameletClient>();
            _paramsConverter       = Substitute.For <ILaunchGameParamsConverter>();
            _cancelableTaskFactory = Substitute.For <CancelableTask.Factory>();
            _yetiVsiService        = Substitute.For <IYetiVSIService>();
            _metrics               = Substitute.For <IMetrics>();
            _actionRecorder        = Substitute.For <ActionRecorder>(_metrics);
            _devEvent              = SetupCreateLaunchEvent();
            _dialogUtil            = Substitute.For <IDialogUtil>();
            _vsiGameLaunchFactory  = Substitute.For <IVsiGameLaunchFactory>();
            _vsiGameLaunch         = Substitute.For <IVsiGameLaunch>();
            _vsiGameLaunchFactory.Create(_gameLaunchName, Arg.Any <bool>()).Returns(_vsiGameLaunch);
            _vsiGameLaunch.LaunchName.Returns(_gameLaunchName);
            _vsiGameLaunch.LaunchId.Returns(_gameLaunchId);

            _target = new GameLauncher(_gameletClient, _yetiVsiService, _paramsConverter,
                                       _cancelableTaskFactory, _actionRecorder, _dialogUtil,
                                       _vsiGameLaunchFactory);

            SetupCancelableTask();
        }
コード例 #24
0
 public void SetUp()
 {
     dialogUtil     = Substitute.For <IDialogUtil>();
     exitDialogUtil = new ExitDialogUtil(dialogUtil, a => a());
 }
コード例 #25
0
        public void SetUp()
        {
            _targetPath = "/any/old/target/path";
            var fileSystem = new MockFileSystem();

            fileSystem.AddFile(_targetPath, new MockFileData(""));

            _outputDirectory = Path.GetTempPath();

            _project = Substitute.For <IAsyncProject>();
            _project.GetTargetPathAsync().Returns(_targetPath);
            _project.GetTargetDirectoryAsync().Returns(Path.GetDirectoryName(_targetPath));
            _project.GetTargetFileNameAsync().Returns(Path.GetFileName(_targetPath));
            _project.GetOutputDirectoryAsync().Returns(_outputDirectory);
            _project.GetAbsoluteRootPathAsync().Returns(_testProjectDir);
            _project.GetApplicationAsync().Returns(_testApplicationName);
            _project.GetQueryParamsAsync().Returns(_customQueryParams);

            var sdkConfigFactory = Substitute.For <SdkConfig.Factory>();
            var sdkConfig        = new SdkConfig();

            sdkConfig.OrganizationId = _testOrganizationId;
            sdkConfig.ProjectId      = _testProjectId;
            sdkConfigFactory.LoadOrDefault().Returns(sdkConfig);

            _gameletClient = Substitute.For <IGameletClient>();
            var gameletClientFactory = Substitute.For <GameletClient.Factory>();

            gameletClientFactory.Create(Arg.Any <ICloudRunner>()).Returns(_gameletClient);

            var remoteCommand = Substitute.For <IRemoteCommand>();

            _remoteDeploy = Substitute.For <IRemoteDeploy>();
            _dialogUtil   = Substitute.For <IDialogUtil>();

            var credentialManager = Substitute.For <YetiCommon.ICredentialManager>();

            credentialManager.LoadAccount().Returns(_testAccount);

            var cancelableTaskFactory =
                FakeCancelableTask.CreateFactory(new JoinableTaskContext(), false);

            _applicationClient = Substitute.For <IApplicationClient>();
            var application = new Application
            {
                Id = _testApplicationId, Name = _testApplicationName
            };

            _applicationClient.LoadByNameOrIdAsync(_testApplicationName)
            .Returns(Task.FromResult(application));
            var applicationClientFactory = Substitute.For <ApplicationClient.Factory>();

            applicationClientFactory.Create(Arg.Any <ICloudRunner>()).Returns(_applicationClient);

            _testAccountClientFactory = Substitute.For <TestAccountClient.Factory>();
            var testAccount = new TestAccount()
            {
                Name = $"organizations/{_testOrganizationId}" +
                       $"/projects/{_testProjectId}/testAccounts/{_testTestAccountId}"
            };
            var testAccountClient = Substitute.For <ITestAccountClient>();

            testAccountClient
            .LoadByIdOrGamerTagAsync(_testOrganizationId, _testProjectId, _testTestAccountId)
            .Returns(new List <TestAccount> {
                testAccount
            });
            _testAccountClientFactory.Create(Arg.Any <ICloudRunner>()).Returns(testAccountClient);

            Substitute.For <IExtensionOptions>();

            _yetiVsiService = Substitute.For <IYetiVSIService>();
            var options         = Substitute.For <IExtensionOptions>();
            var debuggerOptions = new YetiVSI.DebuggerOptions.DebuggerOptions();

            _yetiVsiService.DebuggerOptions.Returns(debuggerOptions);
            options.LaunchGameApiFlow.Returns(LaunchGameApiFlow.DISABLED);
            _yetiVsiService.Options.Returns(options);
            _metrics = Substitute.For <IMetrics>();
            _metrics.NewDebugSessionId().Returns(_testDebugSessionId);
            var debugMetrics = new DebugSessionMetrics(_metrics);
            var cloudRunner  = new CloudRunner(sdkConfigFactory, credentialManager,
                                               new CloudConnection(), new GgpSDKUtil());

            _gameletSelector        = Substitute.For <IGameletSelector>();
            _gameletSelectorFactory = Substitute.For <IGameletSelectorFactory>();
            _gameletSelectorFactory.Create(Arg.Any <bool>(), Arg.Any <ActionRecorder>())
            .Returns(_gameletSelector);
            var serializer = new JsonUtil();

            _launchCommandFormatter = new ChromeClientLaunchCommandFormatter(serializer);
            _paramsFactory          = new YetiVSI.DebugEngine.DebugEngine.Params.Factory(serializer);

            _gameLauncher = Substitute.For <IGameLauncher>();
            _gameLauncher.LaunchGameApiEnabled.Returns(false);
            _gameLaunch = Substitute.For <IVsiGameLaunch>();
            _gameLaunch.LaunchName.Returns("launch_name");
            _ggpDebugQueryTarget = new GgpDebugQueryTarget(fileSystem, sdkConfigFactory,
                                                           gameletClientFactory,
                                                           applicationClientFactory,
                                                           cancelableTaskFactory, _dialogUtil,
                                                           _remoteDeploy, debugMetrics,
                                                           credentialManager,
                                                           _testAccountClientFactory,
                                                           _gameletSelectorFactory, cloudRunner,
                                                           _sdkVersion, _launchCommandFormatter,
                                                           _paramsFactory, _yetiVsiService,
                                                           _gameLauncher);
        }
コード例 #26
0
 public ExitDialogUtil(IDialogUtil dialogUtil, DialogExecutionContext executionContext)
 {
     showErrorDialogWithDetails = (message, details) =>
                                  executionContext(() => dialogUtil.ShowError(message, details));
     showErrorDialog = message => executionContext(() => dialogUtil.ShowError(message));
 }
コード例 #27
0
 public GgpDebugQueryTargetCompRoot(ServiceManager serviceManager, IDialogUtil dialogUtil)
 {
     _serviceManager = serviceManager;
     _dialogUtil     = dialogUtil;
 }
コード例 #28
0
        public void SetUp()
        {
            _gamelet1 = new Gamelet
            {
                Id     = "test_gamelet1",
                Name   = "test_gamelet_name1",
                IpAddr = "1.2.3.4",
                State  = GameletState.Reserved,
            };

            _gamelet2 = new Gamelet
            {
                Id     = "test_gamelet2",
                Name   = "test_gamelet_name2",
                IpAddr = "1.2.3.5",
                State  = GameletState.Reserved,
            };

            _metrics = Substitute.For <IMetrics>();
            _metrics.NewDebugSessionId().Returns(_testDebugSessionId);

            _dialogUtil = Substitute.For <IDialogUtil>();

            var sdkConfigFactory = Substitute.For <SdkConfig.Factory>();
            var sdkConfig        = new SdkConfig();

            sdkConfigFactory.LoadOrDefault().Returns(sdkConfig);

            var credentialManager = Substitute.For <YetiCommon.ICredentialManager>();

            credentialManager.LoadAccount().Returns(_testAccount);

            _instanceSelectionWindow = Substitute.For <IInstanceSelectionWindow>();
            var gameletSelectionWindowFactory = Substitute.For <InstanceSelectionWindow.Factory>();

            gameletSelectionWindowFactory.Create(Arg.Any <List <Gamelet> >())
            .Returns(_instanceSelectionWindow);

            var cloudRunner = new CloudRunner(sdkConfigFactory, credentialManager,
                                              new CloudConnection(), new GgpSDKUtil());

            CancelableTask.Factory cancelableTaskFactory =
                FakeCancelableTask.CreateFactory(new JoinableTaskContext(), false);

            _gameletClient = Substitute.For <IGameletClient>();
            var gameletClientFactory = Substitute.For <GameletClient.Factory>();

            gameletClientFactory.Create(Arg.Any <ICloudRunner>()).Returns(_gameletClient);

            _sshManager = Substitute.For <ISshManager>();

            _sshManager.EnableSshAsync(_gamelet1, Arg.Any <IAction>())
            .Returns(Task.FromResult(true));
            _sshManager.EnableSshAsync(_gamelet2, Arg.Any <IAction>())
            .Returns(Task.FromResult(true));

            _remoteCommand = Substitute.For <IRemoteCommand>();

            var debugSessionMetrics = new DebugSessionMetrics(_metrics);

            debugSessionMetrics.UseNewDebugSessionId();
            _actionRecorder = new ActionRecorder(debugSessionMetrics);

            _gameletSelector = new GameletSelectorLegacyFlow(_dialogUtil, cloudRunner,
                                                             gameletSelectionWindowFactory,
                                                             cancelableTaskFactory,
                                                             gameletClientFactory, _sshManager,
                                                             _remoteCommand, _actionRecorder);
        }
コード例 #29
0
 public CoreAttachWarningDialogUtil(JoinableTaskContext taskContext, IDialogUtil dialogUtil)
 {
     _taskContext = taskContext;
     _dialogUtil  = dialogUtil;
 }