summaryrefslogtreecommitdiff
path: root/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestRunnerApi.cs
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2020-04-20 19:09:33 -0400
committerAndrew Lee <alee14498@protonmail.com>2020-04-20 19:09:33 -0400
commit7c1e566113d59699af1624186c64eca67f063fc6 (patch)
tree5a6850a695986872d5d0b09d7dab8421628fe33e /Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestRunnerApi.cs
parentdd117b77aae1d8be7563b360d05b842a73b7dab2 (diff)
downloadProject-Sandbox-7c1e566113d59699af1624186c64eca67f063fc6.tar.gz
Project-Sandbox-7c1e566113d59699af1624186c64eca67f063fc6.tar.bz2
Project-Sandbox-7c1e566113d59699af1624186c64eca67f063fc6.zip
Upgraded Unity
Diffstat (limited to 'Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestRunnerApi.cs')
-rw-r--r--Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestRunnerApi.cs120
1 files changed, 0 insertions, 120 deletions
diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestRunnerApi.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestRunnerApi.cs
deleted file mode 100644
index 6b14d38..0000000
--- a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/TestRunnerApi.cs
+++ /dev/null
@@ -1,120 +0,0 @@
-using System;
-using System.Linq;
-using System.Threading;
-using UnityEditor.TestTools.TestRunner.CommandLineTest;
-using UnityEditor.TestTools.TestRunner.TestRun;
-using UnityEngine;
-using UnityEngine.TestRunner.TestLaunchers;
-using UnityEngine.TestTools;
-using UnityEngine.TestTools.NUnitExtensions;
-
-namespace UnityEditor.TestTools.TestRunner.Api
-{
- public class TestRunnerApi : ScriptableObject, ITestRunnerApi
- {
- internal ICallbacksHolder callbacksHolder;
-
- private ICallbacksHolder m_CallbacksHolder
- {
- get
- {
- if (callbacksHolder == null)
- {
- return CallbacksHolder.instance;
- }
-
- return callbacksHolder;
- }
- }
-
- internal Func<ExecutionSettings,string> ScheduleJob = (executionSettings) =>
- {
- var runner = new TestJobRunner();
- return runner.RunJob(new TestJobData(executionSettings));
- };
-
- public string Execute(ExecutionSettings executionSettings)
- {
- if (executionSettings == null)
- {
- throw new ArgumentNullException(nameof(executionSettings));
- }
-
- if ((executionSettings.filters == null || executionSettings.filters.Length == 0) && executionSettings.filter != null)
- {
- // Map filter (singular) to filters (plural), for backwards compatibility.
- executionSettings.filters = new [] {executionSettings.filter};
- }
-
- if (executionSettings.targetPlatform == null && executionSettings.filters != null &&
- executionSettings.filters.Length > 0)
- {
- executionSettings.targetPlatform = executionSettings.filters[0].targetPlatform;
- }
-
- return ScheduleJob(executionSettings);
- }
-
- public void RegisterCallbacks<T>(T testCallbacks, int priority = 0) where T : ICallbacks
- {
- if (testCallbacks == null)
- {
- throw new ArgumentNullException(nameof(testCallbacks));
- }
-
- m_CallbacksHolder.Add(testCallbacks, priority);
- }
-
- public void UnregisterCallbacks<T>(T testCallbacks) where T : ICallbacks
- {
- if (testCallbacks == null)
- {
- throw new ArgumentNullException(nameof(testCallbacks));
- }
-
- m_CallbacksHolder.Remove(testCallbacks);
- }
-
- internal void RetrieveTestList(ExecutionSettings executionSettings, Action<ITestAdaptor> callback)
- {
- if (executionSettings == null)
- {
- throw new ArgumentNullException(nameof(executionSettings));
- }
-
- var firstFilter = executionSettings.filters?.FirstOrDefault() ?? executionSettings.filter;
- RetrieveTestList(firstFilter.testMode, callback);
- }
-
- public void RetrieveTestList(TestMode testMode, Action<ITestAdaptor> callback)
- {
- if (callback == null)
- {
- throw new ArgumentNullException(nameof(callback));
- }
-
- var platform = ParseTestMode(testMode);
- var testAssemblyProvider = new EditorLoadedTestAssemblyProvider(new EditorCompilationInterfaceProxy(), new EditorAssembliesProxy());
- var testAdaptorFactory = new TestAdaptorFactory();
- var testListCache = new TestListCache(testAdaptorFactory, new RemoteTestResultDataFactory(), TestListCacheData.instance);
- var testListProvider = new TestListProvider(testAssemblyProvider, new UnityTestAssemblyBuilder());
- var cachedTestListProvider = new CachingTestListProvider(testListProvider, testListCache, testAdaptorFactory);
-
- var job = new TestListJob(cachedTestListProvider, platform, (testRoot) =>
- {
- callback(testRoot);
- });
- job.Start();
- }
-
- internal static bool IsRunActive()
- {
- return RunData.instance.isRunning;
- }
-
- private static TestPlatform ParseTestMode(TestMode testMode)
- {
- return (((testMode & TestMode.EditMode) == TestMode.EditMode) ? TestPlatform.EditMode : 0) | (((testMode & TestMode.PlayMode) == TestMode.PlayMode) ? TestPlatform.PlayMode : 0);
- }
- }
-}