public void GetConfigurationForAssetStreamingReturnsCorrectCombination()
        {
            GameletMountChecker mountChecker =
                CreateMountCheckerWithSpecifiedProcMountsInfo(_localDirStreaming);

            MountConfiguration configuration =
                mountChecker.GetConfiguration(_gamelet, _actionRecorder);

            Assert.That(configuration, Is.EqualTo(MountConfiguration.LocalStreaming));
        }
        public void GetConfigurationForCorruptedFileReturnsNone()
        {
            GameletMountChecker mountChecker =
                CreateMountCheckerWithSpecifiedProcMountsInfo(_corruptedFile);

            MountConfiguration configuration =
                mountChecker.GetConfiguration(_gamelet, _actionRecorder);

            Assert.That(configuration, Is.EqualTo(MountConfiguration.None));
        }
        public void GetConfigurationForPackageRanDirectlyReturnsCorrectCombination()
        {
            GameletMountChecker mountChecker =
                CreateMountCheckerWithSpecifiedProcMountsInfo(_packageRanDirectly);

            MountConfiguration configuration =
                mountChecker.GetConfiguration(_gamelet, _actionRecorder);

            Assert.That(configuration, Is.EqualTo(MountConfiguration.RunFromPackage));
        }
        public void GetConfigurationForMountedWithNoOverlayReturnsCorrectCombination()
        {
            GameletMountChecker mountChecker =
                CreateMountCheckerWithSpecifiedProcMountsInfo(_mountedWithNoOverlay);

            MountConfiguration configuration =
                mountChecker.GetConfiguration(_gamelet, _actionRecorder);

            Assert.That(configuration, Is.EqualTo(MountConfiguration.PackageMounted));
        }
        public void IsGameAssetsDetachedFromDeveloperFolderAfterPackageRunIsTrue()
        {
            GameletMountChecker mountChecker =
                CreateMountCheckerWithSpecifiedProcMountsInfo(_packageRanDirectly);

            MountConfiguration configuration =
                mountChecker.GetConfiguration(_gamelet, _actionRecorder);

            Assert.That(mountChecker.IsGameAssetsDetachedFromDeveloperFolder(configuration),
                        Is.True);
        }
        public void IsGameAssetsDetachedFromDeveloperFolderForMountWithoutOverlayIsTrue()
        {
            GameletMountChecker mountChecker =
                CreateMountCheckerWithSpecifiedProcMountsInfo(_mountedWithNoOverlay);

            MountConfiguration configuration =
                mountChecker.GetConfiguration(_gamelet, _actionRecorder);

            Assert.That(mountChecker.IsGameAssetsDetachedFromDeveloperFolder(configuration),
                        Is.True);
        }
        public void IsGameAssetsDetachedFromDeveloperFolderForPackageWithLocalDirAsOverlayIsFalse()
        {
            GameletMountChecker mountChecker =
                CreateMountCheckerWithSpecifiedProcMountsInfo(_localDirStreamingAsOverlay);

            MountConfiguration configuration =
                mountChecker.GetConfiguration(_gamelet, _actionRecorder);

            Assert.That(mountChecker.IsGameAssetsDetachedFromDeveloperFolder(configuration),
                        Is.False);
        }
        public void IsGameAssetsDetachedFromDeveloperFolderForCleanStateIsFalse()
        {
            GameletMountChecker mountChecker =
                CreateMountCheckerWithSpecifiedProcMountsInfo(_cleanGamelet);

            MountConfiguration configuration =
                mountChecker.GetConfiguration(_gamelet, _actionRecorder);

            Assert.That(mountChecker.IsGameAssetsDetachedFromDeveloperFolder(configuration),
                        Is.False);
        }
        public void GetConfigurationForEmptyFileReturnsNone()
        {
            var emptyContent = new List <string>();
            GameletMountChecker mountChecker =
                CreateMountCheckerWithSpecifiedProcMountsInfo(emptyContent);

            MountConfiguration configuration =
                mountChecker.GetConfiguration(_gamelet, _actionRecorder);

            Assert.That(configuration, Is.EqualTo(MountConfiguration.None));
        }
        public void GetConfigurationForMountedWithLocalFolderAsOverlayReturnsCorrectCombination()
        {
            GameletMountChecker mountChecker =
                CreateMountCheckerWithSpecifiedProcMountsInfo(_localDirStreamingAsOverlay);

            MountConfiguration configuration =
                mountChecker.GetConfiguration(_gamelet, _actionRecorder);

            Assert.That(configuration,
                        Is.EqualTo(MountConfiguration.PackageMounted | MountConfiguration.Overlay |
                                   MountConfiguration.LocalStreaming));
        }
        public void GetDevicesOnCorruptedFileReturnsEmpty()
        {
            var mountChecker = new GameletMountChecker(null, null, null);
            Dictionary <string, GameletMountChecker.Device> devices =
                mountChecker.GetDevices(_corruptedFile);

            Assert.Multiple(() => {
                Assert.That(devices[YetiConstants.PackageMountingPoint]?.Address, Is.EqualTo(null));
                Assert.That(devices[YetiConstants.GameAssetsMountingPoint]?.Address,
                            Is.EqualTo(null));
                Assert.That(devices[YetiConstants.DeveloperMountingPoint]?.Address,
                            Is.EqualTo(null));
            });
        }
        public void GetDevicesOnGameletAfterPackageRunHasGameAssetsAndDeveloperMountSet()
        {
            var mountChecker = new GameletMountChecker(null, null, null);
            Dictionary <string, GameletMountChecker.Device> devices =
                mountChecker.GetDevices(_packageRanDirectly);

            Assert.Multiple(() => {
                Assert.That(devices[YetiConstants.PackageMountingPoint]?.Address, Is.EqualTo(null));
                Assert.That(devices[YetiConstants.GameAssetsMountingPoint]?.Address,
                            Is.EqualTo("/dev/mapper/cryptfs-disk-0129389243020"));
                Assert.That(devices[YetiConstants.DeveloperMountingPoint]?.Address,
                            Is.EqualTo("/dev/sde6"));
            });
        }
        public void GetDevicesOnCleanGameletHasGameAssetsAndDeveloperMountSet()
        {
            var mountChecker = new GameletMountChecker(null, null, null);
            Dictionary <string, GameletMountChecker.Device> devices =
                mountChecker.GetDevices(_cleanGamelet);

            Assert.Multiple(() => {
                Assert.That(devices[YetiConstants.PackageMountingPoint]?.Address, Is.EqualTo(null));
                Assert.That(devices[YetiConstants.GameAssetsMountingPoint]?.Address,
                            Is.EqualTo("/dev/sde6"));
                Assert.That(devices[YetiConstants.DeveloperMountingPoint]?.Address,
                            Is.EqualTo("/dev/sde6"));
            });
        }
        public void GetDevicesWhenReadingFailedReturnsEmpty()
        {
            var mountChecker = new GameletMountChecker(null, null, null);
            var emptyContent = new List <string>();
            Dictionary <string, GameletMountChecker.Device> devices =
                mountChecker.GetDevices(emptyContent);

            Assert.Multiple(() => {
                Assert.That(devices[YetiConstants.PackageMountingPoint]?.Address, Is.EqualTo(null));
                Assert.That(devices[YetiConstants.GameAssetsMountingPoint]?.Address,
                            Is.EqualTo(null));
                Assert.That(devices[YetiConstants.DeveloperMountingPoint]?.Address,
                            Is.EqualTo(null));
            });
        }
        public void GetDevicesOnGameletWithMountedPackageWithOverlay()
        {
            var mountChecker = new GameletMountChecker(null, null, null);
            Dictionary <string, GameletMountChecker.Device> devices =
                mountChecker.GetDevices(_mountedWithOverlay);

            Assert.Multiple(() => {
                Assert.That(devices[YetiConstants.PackageMountingPoint]?.Address,
                            Is.EqualTo("/dev/mapper/cryptfs-disk-0129389243020"));
                Assert.That(devices[YetiConstants.GameAssetsMountingPoint]?.Address,
                            Is.EqualTo("overlay"));
                Assert.That(devices[YetiConstants.DeveloperMountingPoint]?.Address,
                            Is.EqualTo("/dev/sde6"));
            });
        }
        public void TestCheckMountConfigurationWhenFailedSshIsFalseAndWarningShowed()
        {
            _remoteCommand
            .When(c => c.RunWithSuccessCapturingOutputAsync(Arg.Any <SshTarget>(),
                                                            Arg.Any <string>()))
            .Do(_ => throw new ProcessExecutionException("oops", 1));

            var mountChecker =
                new GameletMountChecker(_remoteCommand, _dialogUtil, _cancelableTaskFactory);

            MountConfiguration configuration =
                mountChecker.GetConfiguration(_gamelet, _actionRecorder);
            bool result = mountChecker.IsGameAssetsDetachedFromDeveloperFolder(configuration);

            Assert.That(result, Is.False);
            _dialogUtil.Received(1).ShowError(Arg.Any <string>(), Arg.Any <string>());
        }
예제 #17
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;
 }
예제 #18
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;
 }