public override CancelableTask.Factory GetCancelableTaskFactory()
        {
            if (_cancelableTaskFactory == null)
            {
                var taskContext = _serviceManager.GetJoinableTaskContext();
                _cancelableTaskFactory = FakeCancelableTask.CreateFactory(taskContext, false);
            }

            return(_cancelableTaskFactory);
        }
        public virtual CancelableTask.Factory GetCancelableTaskFactory()
        {
            if (_cancelableTaskFactory == null)
            {
                _cancelableTaskFactory = new CancelableTask.Factory(GetJoinableTaskContext(),
                                                                    new ProgressDialog.Factory());
            }

            return(_cancelableTaskFactory);
        }
예제 #3
0
        public override CancelableTask.Factory GetCancelableTaskFactory()
        {
            if (_cancelableTaskFactory == null)
            {
                _cancelableTaskFactory =
                    FakeCancelableTask.CreateFactory(new JoinableTaskContext(), false);
            }

            return(_cancelableTaskFactory);
        }
예제 #4
0
 public VsiGameLaunchFactory(IGameletClient gameletClient,
                             CancelableTask.Factory cancelableTaskFactory,
                             IGameLaunchBeHelper gameLaunchBeHelper,
                             ActionRecorder actionRecorder, IDialogUtil dialogUtil)
 {
     _gameletClient         = gameletClient;
     _cancelableTaskFactory = cancelableTaskFactory;
     _gameLaunchBeHelper    = gameLaunchBeHelper;
     _actionRecorder        = actionRecorder;
     _dialogUtil            = dialogUtil;
 }
예제 #5
0
 public Factory(CancelableTask.Factory cancelableTaskFactory,
                ActionRecorder actionRecorder,
                ModuleFileLoadMetricsRecorder.Factory moduleFileLoadRecorderFactory,
                ILldbModuleUtil moduleUtil,
                ISymbolSettingsProvider symbolSettingsProvider)
 {
     _cancelableTaskFactory         = cancelableTaskFactory;
     _actionRecorder                = actionRecorder;
     _moduleUtil                    = moduleUtil;
     _symbolSettingsProvider        = symbolSettingsProvider;
     _moduleFileLoadRecorderFactory = moduleFileLoadRecorderFactory;
 }
예제 #6
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);
 }
예제 #7
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;
 }
예제 #8
0
 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;
 }
예제 #9
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;
 }
예제 #10
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();
        }
        IDebugPort2 CreateDebugPort(Gamelet gamelet)
        {
            var    processFactory            = Substitute.For <DebugProcess.Factory>();
            var    dialogUtil                = Substitute.For <IDialogUtil>();
            var    sshManager                = Substitute.For <ISshManager>();
            var    processListRequest        = Substitute.For <IProcessListRequest>();
            var    processListRequestFactory = Substitute.For <ProcessListRequest.Factory>();
            string reserverAccount           = "*****@*****.**";

            processListRequestFactory.Create().Returns(processListRequest);
            CancelableTask.Factory cancelableTaskFactory =
                FakeCancelableTask.CreateFactory(new JoinableTaskContext(), false);
            var portFactory = new DebugPort.Factory(processFactory, processListRequestFactory,
                                                    cancelableTaskFactory, dialogUtil, sshManager,
                                                    _metrics, reserverAccount);

            return(portFactory.Create(gamelet, null, "290"));
        }
예제 #12
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;
 }
예제 #13
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;
 }
예제 #14
0
        public void SetUp()
        {
            taskContext = new JoinableTaskContext();

            closeDialogSource = new TaskCompletionSource <bool>();

            mockProgressDialog = Substitute.For <IProgressDialog>();
            mockProgressDialog.ShowModal()
            .Returns(x => taskContext.Factory.Run(() => closeDialogSource.Task));

            mockProgressDialog.When(x => x.Complete())
            .Do(x => closeDialogSource.TrySetResult(true));

            mockProgressDialogFactory = Substitute.For <ProgressDialog.Factory>();
            mockProgressDialogFactory.Create(Title, Text).Returns(mockProgressDialog);

            taskFactory = new CancelableTask.Factory(taskContext, mockProgressDialogFactory, Title,
                                                     DialogDelay, ProgressPeriod);
        }
예제 #15
0
 DebugModule(CancelableTask.Factory cancelableTaskFactory, ActionRecorder actionRecorder,
             ModuleFileLoadMetricsRecorder.Factory moduleFileLoadRecorderFactory,
             ILldbModuleUtil moduleUtil, IModuleFileLoader moduleFileLoader,
             IModuleSearchLogHolder moduleSearchLogHolder, SbModule lldbModule,
             uint loadOrder, IDebugEngineHandler engineHandler, IGgpDebugProgram program,
             ISymbolSettingsProvider symbolSettingsProvider)
 {
     _cancelableTaskFactory         = cancelableTaskFactory;
     _actionRecorder                = actionRecorder;
     _moduleFileLoadRecorderFactory = moduleFileLoadRecorderFactory;
     _moduleUtil            = moduleUtil;
     _moduleFileLoader      = moduleFileLoader;
     _moduleSearchLogHolder = moduleSearchLogHolder;
     _lldbModule            = lldbModule;
     _loadOrder             = loadOrder;
     _engineHandler         = engineHandler;
     _program = program;
     _symbolSettingsProvider = symbolSettingsProvider;
 }
예제 #16
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;
 }
예제 #17
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);
        }
예제 #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()
        {
            _mockCancelableTaskFactory = Substitute.For <CancelableTask.Factory>();
            _mockModuleUtil            = Substitute.For <ILldbModuleUtil>();
            _mockModuleUtil.HasSymbolsLoaded(Arg.Any <SbModule>()).Returns(false);
            _mockModuleFileLoader      = Substitute.For <IModuleFileLoader>();
            _mockModuleSearchLogHolder = Substitute.For <IModuleSearchLogHolder>();
            _mockModule         = Substitute.For <SbModule>();
            _mockActionRecorder = Substitute.For <ActionRecorder>(null, null);
            var mockModuleFileLoadRecorderFactory =
                Substitute.For <ModuleFileLoadMetricsRecorder.Factory>();

            _mockEngineHandler          = Substitute.For <IDebugEngineHandler>();
            _mockDebugProgram           = Substitute.For <IGgpDebugProgram>();
            _mockSymbolSettingsProvider = Substitute.For <ISymbolSettingsProvider>();
            _debugModule =
                new DebugModule
                .Factory(_mockCancelableTaskFactory, _mockActionRecorder,
                         mockModuleFileLoadRecorderFactory, _mockModuleUtil,
                         _mockSymbolSettingsProvider)
                .Create(_mockModuleFileLoader, _mockModuleSearchLogHolder, _mockModule,
                        _testLoadOrder, _mockEngineHandler, _mockDebugProgram);
        }
예제 #21
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();
        }
        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);
        }