Beispiel #1
0
 public VsiGameLaunchFactory(IGameletClient gameletClient,
                             CancelableTask.Factory cancelableTaskFactory,
                             IGameLaunchBeHelper gameLaunchBeHelper,
                             ActionRecorder actionRecorder, IDialogUtil dialogUtil)
 {
     _gameletClient         = gameletClient;
     _cancelableTaskFactory = cancelableTaskFactory;
     _gameLaunchBeHelper    = gameLaunchBeHelper;
     _actionRecorder        = actionRecorder;
     _dialogUtil            = dialogUtil;
 }
 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);
 }
Beispiel #3
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;
 }
Beispiel #4
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;
 }
 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;
 }
        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 <ICredentialManager>();

            credentialManager.LoadAccount().Returns(_testAccount);

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

            gameletSelectionWindowFactory.Create(Arg.Any <List <Gamelet> >())
            .Returns(_instanceSelectionWindow);
            _gameLaunchBeHelper = Substitute.For <IGameLaunchBeHelper>();

            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 GameletSelector(_dialogUtil, cloudRunner,
                                                   gameletSelectionWindowFactory,
                                                   cancelableTaskFactory, gameletClientFactory,
                                                   _sshManager, _remoteCommand, _gameLaunchBeHelper,
                                                   new JoinableTaskContext(), _actionRecorder);
        }