mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-06 04:00:07 +00:00
fe98124c9b
* Async JavascriptBinding - Add support for returning Task Remove Parallel Task execution code from MethodRunnerQueue Add ParallelMethodRunnerQueue - For the new code path the Func is executed, if the Result is a generic Task we wait for it's completion - If the task is not generic then we return immediately This is only enabled when CefSharpSettings.ConcurrentTaskExecution = true; * MethodRunnerQueue - Display error message when method returns Task * ParallelMethodRunnerQueue - Rename to ConcurrentMethodRunnerQueue * MethodRunnerQueue - Improve formatting of error message when method returns Task * Async JavascriptBinding Return Task - Add Basic xUnit Test Very quick test, needs to be refined a little. The basics are working as expected. * Add Binding Test Async Task Example to the WPF Example menu * Async JSB Task - Add additional tests and improve error messaging
69 lines
2.0 KiB
HTML
69 lines
2.0 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<title>Binding Test</title>
|
|
<link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.4.1.css">
|
|
</head>
|
|
<body>
|
|
<div>
|
|
These tests require CefSharpSettings.ConcurrentTaskExecution = true;
|
|
Which by default is set to false
|
|
</div>
|
|
|
|
<div id="qunit"></div>
|
|
<div id="qunit-fixture"></div>
|
|
<script src="https://code.jquery.com/qunit/qunit-2.4.1.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
(async () =>
|
|
{
|
|
await CefSharp.BindObjectAsync("boundAsync");
|
|
|
|
QUnit.test("ReturnTaskStringAsync:", function (assert)
|
|
{
|
|
let asyncCallback = assert.async();
|
|
|
|
boundAsync.returnTaskStringAsync().then(function (actualResult)
|
|
{
|
|
const expectedResult = 'ReturnTaskStringAsync';
|
|
|
|
assert.equal(expectedResult, actualResult, "Return string " + expectedResult);
|
|
|
|
asyncCallback();
|
|
});
|
|
});
|
|
|
|
QUnit.test("VoidReturnAsync Test:", function (assert)
|
|
{
|
|
let asyncCallback = assert.async();
|
|
|
|
boundAsync.voidReturnAsync().then(function (actualResult)
|
|
{
|
|
const expectedResult = null;
|
|
|
|
assert.equal(expectedResult, actualResult, "Return null");
|
|
|
|
asyncCallback();
|
|
});
|
|
});
|
|
|
|
QUnit.test("AsyncWaitTwoSeconds Test:", function (assert)
|
|
{
|
|
let asyncCallback = assert.async();
|
|
|
|
const expectedResult = "This method waited two seconds";
|
|
|
|
boundAsync.asyncWaitTwoSeconds(expectedResult).then(function (actualResult)
|
|
{
|
|
assert.equal(expectedResult, actualResult, "Return string " + expectedResult);
|
|
|
|
asyncCallback();
|
|
});
|
|
});
|
|
|
|
})();
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|