From 7c1e566113d59699af1624186c64eca67f063fc6 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Mon, 20 Apr 2020 19:09:33 -0400 Subject: Upgraded Unity --- .../UnityEditor.TestRunner/Api/CallbacksHolder.cs | 69 ---------------------- 1 file changed, 69 deletions(-) delete mode 100644 Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksHolder.cs (limited to 'Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksHolder.cs') diff --git a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksHolder.cs b/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksHolder.cs deleted file mode 100644 index 91acb8c..0000000 --- a/Library/PackageCache/com.unity.test-framework@1.1.11/UnityEditor.TestRunner/Api/CallbacksHolder.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace UnityEditor.TestTools.TestRunner.Api -{ - internal class CallbacksHolder : ScriptableSingleton, ICallbacksHolder - { - private List m_Callbacks = new List(); - public void Add(ICallbacks callback, int priority) - { - m_Callbacks.Add(new CallbackWithPriority(callback, priority)); - } - - public void Remove(ICallbacks callback) - { - m_Callbacks.RemoveAll(callbackWithPriority => callbackWithPriority.Callback == callback); - } - - public ICallbacks[] GetAll() - { - return m_Callbacks.OrderByDescending(callback => callback.Priority).Select(callback => callback.Callback).ToArray(); - } - - public void Clear() - { - m_Callbacks.Clear(); - } - - private struct CallbackWithPriority - { - public ICallbacks Callback; - public int Priority; - public CallbackWithPriority(ICallbacks callback, int priority) - { - Callback = callback; - Priority = priority; - } - } - - // Sometimes - such as when we want to test the test framework itself - it's necessary to launch a test run from - // inside a test. Because callbacks are registered globally, this can cause a lot of confusion (e.g. the in-test - // run will emit UTP messages, utterly confusing UTR). In such circumstances the safest thing to do is to - // temporarily suppress all registered callbacks for the duration of the in-test run. This method can be called - // to set up a using() block which will suppress the callbacks for the scope. - public IDisposable TemporarilySuppressCallbacks() - { - return new Suppressor(this); - } - - private sealed class Suppressor : IDisposable - { - private readonly CallbacksHolder _instance; - private readonly List _suppressed; - - public Suppressor(CallbacksHolder instance) - { - _instance = instance; - _suppressed = new List(instance.m_Callbacks); - instance.m_Callbacks.Clear(); - } - - public void Dispose() - { - _instance.m_Callbacks.AddRange(_suppressed); - } - } - } -} -- cgit v1.2.3