diff --git a/CefSharp.Example/CefExample.cs b/CefSharp.Example/CefExample.cs index 1c415de682..6f3caab216 100644 --- a/CefSharp.Example/CefExample.cs +++ b/CefSharp.Example/CefExample.cs @@ -20,6 +20,7 @@ public static class CefExample public const string BaseUrl = "https://" + ExampleDomain; public const string DefaultUrl = BaseUrl + "/home.html"; public const string BindingTestUrl = BaseUrl + "/BindingTest.html"; + public const string BindingTestNetCoreUrl = BaseUrl + "/BindingTestNetCore.html"; public const string BindingTestSingleUrl = BaseUrl + "/BindingTestSingle.html"; public const string BindingTestsAsyncTaskUrl = BaseUrl + "/BindingTestsAsyncTask.html"; public const string LegacyBindingTestUrl = BaseUrl + "/LegacyBindingTest.html"; diff --git a/CefSharp.Example/CefSharp.Example.netcore.csproj b/CefSharp.Example/CefSharp.Example.netcore.csproj index 2413059d94..48036ed04e 100644 --- a/CefSharp.Example/CefSharp.Example.netcore.csproj +++ b/CefSharp.Example/CefSharp.Example.netcore.csproj @@ -38,9 +38,12 @@ + + + diff --git a/CefSharp.Test/CefSharp.Test.netcore.csproj b/CefSharp.Test/CefSharp.Test.netcore.csproj new file mode 100644 index 0000000000..2080e94aef --- /dev/null +++ b/CefSharp.Test/CefSharp.Test.netcore.csproj @@ -0,0 +1,53 @@ + + + + + obj.netcore\ + bin.netcore\ + + + + + + netcoreapp3.1 + CefSharp.Test + CefSharp.Test + true + true + false + MinimumRecommendedRules.ruleset + x86;x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CefSharp.Test/Framework/ConcurrentMethodRunnerQueueFacts.cs b/CefSharp.Test/Framework/ConcurrentMethodRunnerQueueFacts.cs index 5c895d828b..5145f46b64 100644 --- a/CefSharp.Test/Framework/ConcurrentMethodRunnerQueueFacts.cs +++ b/CefSharp.Test/Framework/ConcurrentMethodRunnerQueueFacts.cs @@ -27,7 +27,11 @@ public async Task StopConcurrentMethodRunnerQueueWhenMethodRunning() var boundObject = new AsyncBoundObject(); var objectRepository = new JavascriptObjectRepository(); +#if NETCOREAPP + objectRepository.Register("testObject", boundObject, new BindingOptions { CamelCaseJavascriptNames = false }); +#else objectRepository.Register("testObject", boundObject, true, new BindingOptions { CamelCaseJavascriptNames = false }); +#endif var methodInvocation = new MethodInvocation(1, 1, 1, nameof(boundObject.AsyncWaitTwoSeconds), 1); methodInvocation.Parameters.Add("Echo Me!"); var methodRunnerQueue = new ConcurrentMethodRunnerQueue(objectRepository); @@ -49,7 +53,11 @@ public async Task ValidateAsyncTaskMethodOutput() var boundObject = new AsyncBoundObject(); var objectRepository = new JavascriptObjectRepository(); +#if NETCOREAPP + objectRepository.Register("testObject", boundObject, new BindingOptions { CamelCaseJavascriptNames = false }); +#else objectRepository.Register("testObject", boundObject, true, new BindingOptions { CamelCaseJavascriptNames = false }); +#endif var methodInvocation = new MethodInvocation(1, 1, 1, nameof(boundObject.AsyncWaitTwoSeconds), 1); methodInvocation.Parameters.Add(expectedResult); var methodRunnerQueue = new ConcurrentMethodRunnerQueue(objectRepository); diff --git a/CefSharp.Test/JavascriptBinding/IntegrationTestFacts.cs b/CefSharp.Test/JavascriptBinding/IntegrationTestFacts.cs index 8a3104ec51..f5acb1f31e 100644 --- a/CefSharp.Test/JavascriptBinding/IntegrationTestFacts.cs +++ b/CefSharp.Test/JavascriptBinding/IntegrationTestFacts.cs @@ -31,6 +31,28 @@ public IntegrationTestFacts(ITestOutputHelper output, CefSharpFixture fixture) this.output = output; } +#if NETCOREAPP + [Fact] + public async Task LoadJavaScriptBindingQunitTestsSuccessfulCompletion() + { + using (var browser = new ChromiumWebBrowser(CefExample.BindingTestNetCoreUrl, automaticallyCreateBrowser: false)) + { + //TODO: Extract this into some sort of helper setup method + var bindingOptions = BindingOptions.DefaultBinder; + var repo = browser.JavascriptObjectRepository; + + repo.Register("boundAsync", new AsyncBoundObject(), options: bindingOptions); + repo.Register("boundAsync2", new AsyncBoundObject(), options: bindingOptions); + + browser.CreateBrowser(); + var success = await browser.WaitForQUnitTestExeuctionToComplete(); + + Assert.True(success); + + output.WriteLine("QUnit Tests result: {0}", success); + } + } +#else [Fact] public async Task LoadJavaScriptBindingQunitTestsSuccessfulCompletion() { @@ -52,6 +74,7 @@ public async Task LoadJavaScriptBindingQunitTestsSuccessfulCompletion() output.WriteLine("QUnit Tests result: {0}", success); } } +#endif [Fact] public async Task IsObjectCachedWithInvalidObjectNameReturnsFalse() diff --git a/CefSharp.Test/OffScreen/OffScreenBrowserBasicFacts.cs b/CefSharp.Test/OffScreen/OffScreenBrowserBasicFacts.cs index 12180c45e8..41fd0b6041 100644 --- a/CefSharp.Test/OffScreen/OffScreenBrowserBasicFacts.cs +++ b/CefSharp.Test/OffScreen/OffScreenBrowserBasicFacts.cs @@ -113,7 +113,11 @@ public async Task CrossSiteNavigationJavascriptBinding() using (var browser = new ChromiumWebBrowser("https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/url")) { +#if NETCOREAPP + browser.JavascriptObjectRepository.Register("bound", boundObj); +#else browser.JavascriptObjectRepository.Register("bound", boundObj, true); +#endif await browser.LoadPageAsync(); browser.GetMainFrame().ExecuteJavaScriptAsync(script); @@ -149,8 +153,11 @@ public async Task JavascriptBindingMultipleObjects() browser.JavascriptObjectRepository.ResolveObject += (s, e) => { objectNames.Add(e.ObjectName); - +#if NETCOREAPP + e.ObjectRepository.Register(e.ObjectName, boundObj); +#else e.ObjectRepository.Register(e.ObjectName, boundObj, isAsync: true); +#endif }; await browser.LoadPageAsync(); diff --git a/CefSharp3.netcore.sln b/CefSharp3.netcore.sln index 6de2849ed7..268ef98894 100644 --- a/CefSharp3.netcore.sln +++ b/CefSharp3.netcore.sln @@ -63,6 +63,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CefSharp.OffScreen.Example. {FBFBD752-467C-444F-93E4-80D6242E8513} = {FBFBD752-467C-444F-93E4-80D6242E8513} EndProjectSection EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CefSharp.Test.netcore", "CefSharp.Test\CefSharp.Test.netcore.csproj", "{51890C83-8FA3-4C9D-B3B7-A7DDF3C14A40}" + ProjectSection(ProjectDependencies) = postProject + {6C4BB501-2F8E-48AC-9AB5-8CFB2D74185C} = {6C4BB501-2F8E-48AC-9AB5-8CFB2D74185C} + {FBFBD752-467C-444F-93E4-80D6242E8513} = {FBFBD752-467C-444F-93E4-80D6242E8513} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -159,6 +165,14 @@ Global {A430C9D4-0952-44A2-989A-23C476B7A1F0}.Release|x64.Build.0 = Release|x64 {A430C9D4-0952-44A2-989A-23C476B7A1F0}.Release|x86.ActiveCfg = Release|x86 {A430C9D4-0952-44A2-989A-23C476B7A1F0}.Release|x86.Build.0 = Release|x86 + {51890C83-8FA3-4C9D-B3B7-A7DDF3C14A40}.Debug|x64.ActiveCfg = Debug|x64 + {51890C83-8FA3-4C9D-B3B7-A7DDF3C14A40}.Debug|x64.Build.0 = Debug|x64 + {51890C83-8FA3-4C9D-B3B7-A7DDF3C14A40}.Debug|x86.ActiveCfg = Debug|x86 + {51890C83-8FA3-4C9D-B3B7-A7DDF3C14A40}.Debug|x86.Build.0 = Debug|x86 + {51890C83-8FA3-4C9D-B3B7-A7DDF3C14A40}.Release|x64.ActiveCfg = Release|x64 + {51890C83-8FA3-4C9D-B3B7-A7DDF3C14A40}.Release|x64.Build.0 = Release|x64 + {51890C83-8FA3-4C9D-B3B7-A7DDF3C14A40}.Release|x86.ActiveCfg = Release|x86 + {51890C83-8FA3-4C9D-B3B7-A7DDF3C14A40}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE