From 7c1e566113d59699af1624186c64eca67f063fc6 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Mon, 20 Apr 2020 19:09:33 -0400 Subject: Upgraded Unity --- .../CommandLineTest/Executer.cs | 134 --------------------- 1 file changed, 134 deletions(-) delete mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/Executer.cs (limited to 'Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/Executer.cs') diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/Executer.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/Executer.cs deleted file mode 100644 index 7204617..0000000 --- a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/CommandLineTest/Executer.cs +++ /dev/null @@ -1,134 +0,0 @@ -using System; -using System.Linq; -using UnityEditor.TestRunner.TestLaunchers; -using UnityEditor.TestTools.TestRunner.Api; -using UnityEngine; - -namespace UnityEditor.TestTools.TestRunner.CommandLineTest -{ - internal class Executer - { - private ITestRunnerApi m_TestRunnerApi; - private ISettingsBuilder m_SettingsBuilder; - private Action m_LogErrorFormat; - private Action m_LogException; - private Action m_ExitEditorApplication; - private Func m_ScriptCompilationFailedCheck; - - public Executer(ITestRunnerApi testRunnerApi, ISettingsBuilder settingsBuilder, Action logErrorFormat, Action logException, Action exitEditorApplication, Func scriptCompilationFailedCheck) - { - m_TestRunnerApi = testRunnerApi; - m_SettingsBuilder = settingsBuilder; - m_LogErrorFormat = logErrorFormat; - m_LogException = logException; - m_ExitEditorApplication = exitEditorApplication; - m_ScriptCompilationFailedCheck = scriptCompilationFailedCheck; - } - - internal void InitializeAndExecuteRun(string[] commandLineArgs) - { - Api.ExecutionSettings executionSettings; - try - { - executionSettings = m_SettingsBuilder.BuildApiExecutionSettings(commandLineArgs); - if (executionSettings.targetPlatform.HasValue) - RemotePlayerLogController.instance.SetBuildTarget(executionSettings.targetPlatform.Value); - } - catch (SetupException exception) - { - HandleSetupException(exception); - return; - } - - try - { - Debug.Log("Executing tests with settings: " + ExecutionSettingsToString(executionSettings)); - m_TestRunnerApi.Execute(executionSettings); - } - catch (Exception exception) - { - m_LogException(exception); - m_ExitEditorApplication((int)ReturnCodes.RunError); - } - } - - internal ExecutionSettings BuildExecutionSettings(string[] commandLineArgs) - { - return m_SettingsBuilder.BuildExecutionSettings(commandLineArgs); - } - - internal enum ReturnCodes - { - Ok = 0, - Failed = 2, - RunError = 3, - PlatformNotFoundReturnCode = 4 - } - - internal void SetUpCallbacks(ExecutionSettings executionSettings) - { - RemotePlayerLogController.instance.SetLogsDirectory(executionSettings.DeviceLogsDirectory); - - var resultSavingCallback = ScriptableObject.CreateInstance(); - resultSavingCallback.m_ResultFilePath = executionSettings.TestResultsFile; - - var logSavingCallback = ScriptableObject.CreateInstance(); - - m_TestRunnerApi.RegisterCallbacks(resultSavingCallback); - m_TestRunnerApi.RegisterCallbacks(logSavingCallback); - m_TestRunnerApi.RegisterCallbacks(ScriptableObject.CreateInstance(), -10); - } - - internal void ExitOnCompileErrors() - { - if (m_ScriptCompilationFailedCheck()) - { - var handling = s_ExceptionHandlingMapping.First(h => h.m_ExceptionType == SetupException.ExceptionType.ScriptCompilationFailed); - m_LogErrorFormat(handling.m_Message, new object[0]); - m_ExitEditorApplication(handling.m_ReturnCode); - } - } - - void HandleSetupException(SetupException exception) - { - ExceptionHandling handling = s_ExceptionHandlingMapping.FirstOrDefault(h => h.m_ExceptionType == exception.Type) ?? new ExceptionHandling(exception.Type, "Unknown command line test run error. " + exception.Type, ReturnCodes.RunError); - m_LogErrorFormat(handling.m_Message, exception.Details); - m_ExitEditorApplication(handling.m_ReturnCode); - } - - private class ExceptionHandling - { - internal SetupException.ExceptionType m_ExceptionType; - internal string m_Message; - internal int m_ReturnCode; - public ExceptionHandling(SetupException.ExceptionType exceptionType, string message, ReturnCodes returnCode) - { - m_ExceptionType = exceptionType; - m_Message = message; - m_ReturnCode = (int)returnCode; - } - } - - static ExceptionHandling[] s_ExceptionHandlingMapping = new[] - { - new ExceptionHandling(SetupException.ExceptionType.ScriptCompilationFailed, "Scripts had compilation errors.", ReturnCodes.RunError), - new ExceptionHandling(SetupException.ExceptionType.PlatformNotFound, "Test platform not found ({0}).", ReturnCodes.PlatformNotFoundReturnCode), - new ExceptionHandling(SetupException.ExceptionType.TestSettingsFileNotFound, "Test settings file not found at {0}.", ReturnCodes.RunError) - }; - - private static string ExecutionSettingsToString(Api.ExecutionSettings executionSettings) - { - if (executionSettings == null) - { - return "none"; - } - - if (executionSettings.filters == null || executionSettings.filters.Length == 0) - { - return "no filter"; - } - - return "test mode = " + executionSettings.filters[0].testMode; - } - } -} -- cgit v1.2.3