Test - Fix IntegrationTestFacts.LoadJavaScriptBindingAsyncTaskQunitTestsSuccessfulCompletion

Add method interceptor so tests pass. Without it we get an VoidTaskResult object.
This commit is contained in:
Alex Maitland
2022-01-27 16:41:29 +10:00
parent a9ac70ee91
commit a1b5d87f06
2 changed files with 5 additions and 2 deletions
@@ -31,10 +31,9 @@
QUnit.test("WaitBeforeReturnAsync:", async (assert) =>
{
const expectedResult = null;
const actualResult = await boundAsync.waitBeforeReturnAsync(2000);
assert.equal(expectedResult, actualResult, "Return null");
assert.notOk(actualResult, "Method awaited without returning response.");
});
QUnit.test("ReturnHello:", async (assert) =>
@@ -7,7 +7,9 @@ using System.Threading.Tasks;
using CefSharp.Event;
using CefSharp.Example;
using CefSharp.Example.JavascriptBinding;
using CefSharp.Example.ModelBinding;
using CefSharp.Internals;
using CefSharp.ModelBinding;
using CefSharp.OffScreen;
using Xunit;
using Xunit.Abstractions;
@@ -124,6 +126,8 @@ namespace CefSharp.Test.JavascriptBinding
//TODO: Extract this into some sort of helper setup method
var bindingOptions = BindingOptions.DefaultBinder;
// intercept .net methods calls from js and log it
bindingOptions.MethodInterceptor = new MethodInterceptorLogger();
var repo = browser.JavascriptObjectRepository;
repo.Register("boundAsync", new AsyncBoundObject(), isAsync: true, options: bindingOptions);