[browser] Move the test specific code to the right location (#40722)
authorLarry Ewing <lewing@microsoft.com>
Wed, 12 Aug 2020 18:13:14 +0000 (13:13 -0500)
committerGitHub <noreply@github.com>
Wed, 12 Aug 2020 18:13:14 +0000 (15:13 -0300)
* Split out TestHarness related classes

* Move TestHarness files

src/mono/wasm/debugger/BrowserDebugHost/Program.cs
src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessOptions.cs [new file with mode: 0644]
src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessProxy.cs [new file with mode: 0644]
src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessStartup.cs [moved from src/mono/wasm/debugger/BrowserDebugHost/TestHarnessStartup.cs with 100% similarity]

index 66db8a1..442e5ac 100644 (file)
@@ -18,14 +18,6 @@ namespace Microsoft.WebAssembly.Diagnostics
         public Uri DevToolsUrl { get; set; } = new Uri("http://localhost:9222");
     }
 
-    public class TestHarnessOptions : ProxyOptions
-    {
-        public string ChromePath { get; set; }
-        public string AppPath { get; set; }
-        public string PagePath { get; set; }
-        public string NodeApp { get; set; }
-    }
-
     public class Program
     {
         public static void Main(string[] args)
@@ -45,48 +37,4 @@ namespace Microsoft.WebAssembly.Diagnostics
             host.Run();
         }
     }
-
-    public class TestHarnessProxy
-    {
-        static IWebHost host;
-        static Task hostTask;
-        static CancellationTokenSource cts = new CancellationTokenSource();
-        static object proxyLock = new object();
-
-        public static readonly Uri Endpoint = new Uri("http://localhost:9400");
-
-        public static Task Start(string chromePath, string appPath, string pagePath)
-        {
-            lock (proxyLock)
-            {
-                if (host != null)
-                    return hostTask;
-
-                host = WebHost.CreateDefaultBuilder()
-                    .UseSetting("UseIISIntegration", false.ToString())
-                    .ConfigureAppConfiguration((hostingContext, config) =>
-                    {
-                        config.AddEnvironmentVariables(prefix: "WASM_TESTS_");
-                    })
-                    .ConfigureServices((ctx, services) =>
-                    {
-                        services.Configure<TestHarnessOptions>(ctx.Configuration);
-                        services.Configure<TestHarnessOptions>(options =>
-                        {
-                            options.ChromePath = options.ChromePath ?? chromePath;
-                            options.AppPath = appPath;
-                            options.PagePath = pagePath;
-                            options.DevToolsUrl = new Uri("http://localhost:0");
-                        });
-                    })
-                    .UseStartup<TestHarnessStartup>()
-                    .UseUrls(Endpoint.ToString())
-                    .Build();
-                hostTask = host.StartAsync(cts.Token);
-            }
-
-            Console.WriteLine("WebServer Ready!");
-            return hostTask;
-        }
-    }
 }
diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessOptions.cs b/src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessOptions.cs
new file mode 100644 (file)
index 0000000..96a6c13
--- /dev/null
@@ -0,0 +1,15 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+
+namespace Microsoft.WebAssembly.Diagnostics
+{
+    public class TestHarnessOptions : ProxyOptions
+    {
+        public string ChromePath { get; set; }
+        public string AppPath { get; set; }
+        public string PagePath { get; set; }
+        public string NodeApp { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessProxy.cs b/src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessProxy.cs
new file mode 100644 (file)
index 0000000..3995dcc
--- /dev/null
@@ -0,0 +1,59 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.IO;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace Microsoft.WebAssembly.Diagnostics
+{
+    public class TestHarnessProxy
+    {
+        static IWebHost host;
+        static Task hostTask;
+        static CancellationTokenSource cts = new CancellationTokenSource();
+        static object proxyLock = new object();
+
+        public static readonly Uri Endpoint = new Uri("http://localhost:9400");
+
+        public static Task Start(string chromePath, string appPath, string pagePath)
+        {
+            lock (proxyLock)
+            {
+                if (host != null)
+                    return hostTask;
+
+                host = WebHost.CreateDefaultBuilder()
+                    .UseSetting("UseIISIntegration", false.ToString())
+                    .ConfigureAppConfiguration((hostingContext, config) =>
+                    {
+                        config.AddEnvironmentVariables(prefix: "WASM_TESTS_");
+                    })
+                    .ConfigureServices((ctx, services) =>
+                    {
+                        services.Configure<TestHarnessOptions>(ctx.Configuration);
+                        services.Configure<TestHarnessOptions>(options =>
+                        {
+                            options.ChromePath = options.ChromePath ?? chromePath;
+                            options.AppPath = appPath;
+                            options.PagePath = pagePath;
+                            options.DevToolsUrl = new Uri("http://localhost:0");
+                        });
+                    })
+                    .UseStartup<TestHarnessStartup>()
+                    .UseUrls(Endpoint.ToString())
+                    .Build();
+                hostTask = host.StartAsync(cts.Token);
+            }
+
+            Console.WriteLine("WebServer Ready!");
+            return hostTask;
+        }
+    }
+}
\ No newline at end of file