|
1 | | -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | 2 | <html> |
3 | | - <head> |
4 | | - <title>Binding Test</title> |
5 | | - <link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.4.1.css"> |
6 | | - </head> |
7 | | - <body> |
8 | | - <div id="qunit"></div> |
9 | | - <div id="qunit-fixture"></div> |
10 | | - <script src="https://code.jquery.com/qunit/qunit-2.4.1.js"></script> |
11 | | - |
12 | | - <script type="text/javascript"> |
| 3 | +<head> |
| 4 | + <title>Binding Test</title> |
| 5 | + <link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.4.1.css"> |
| 6 | +</head> |
| 7 | +<body> |
| 8 | + <div> |
| 9 | + These tests require CefSharpSettings.ConcurrentTaskExecution = true; |
| 10 | + Which by default is set to false |
| 11 | + </div> |
| 12 | + |
| 13 | + <div id="qunit"></div> |
| 14 | + <div id="qunit-fixture"></div> |
| 15 | + <script src="https://code.jquery.com/qunit/qunit-2.4.1.js"></script> |
| 16 | + |
| 17 | + <script type="text/javascript"> |
13 | 18 | (async () => |
14 | 19 | { |
15 | | - await CefSharp.BindObjectAsync("boundAsync", "bound"); |
| 20 | + await CefSharp.BindObjectAsync("boundAsync"); |
16 | 21 |
|
17 | | - QUnit.test( "Struct Test:", function( assert ) |
| 22 | + QUnit.test("ReturnTaskStringAsync:", function (assert) |
18 | 23 | { |
19 | | - var asyncCallback = assert.async(); |
| 24 | + let asyncCallback = assert.async(); |
20 | 25 |
|
21 | | - //Returns a Struct |
22 | | - boundAsync.returnObject('CefSharp Struct Test').then(function (actualResult) |
| 26 | + boundAsync.returnTaskStringAsync().then(function (actualResult) |
23 | 27 | { |
24 | | - const expectedResult = 'CefSharp Struct Test'; |
| 28 | + const expectedResult = 'ReturnTaskStringAsync'; |
25 | 29 |
|
26 | | - assert.equal(expectedResult, actualResult.Value, "Return class " + expectedResult); |
| 30 | + assert.equal(expectedResult, actualResult, "Return string " + expectedResult); |
27 | 31 |
|
28 | 32 | asyncCallback(); |
29 | | - }); |
| 33 | + }); |
30 | 34 | }); |
31 | 35 |
|
32 | | - QUnit.test( "Class Test:", function( assert ) |
| 36 | + QUnit.test("VoidReturnAsync Test:", function (assert) |
33 | 37 | { |
34 | | - var asyncCallback = assert.async(); |
| 38 | + let asyncCallback = assert.async(); |
35 | 39 |
|
36 | | - //Returns a class |
37 | | - boundAsync.returnClass('CefSharp Class Test').then(function (actualResult) |
| 40 | + boundAsync.voidReturnAsync().then(function (actualResult) |
38 | 41 | { |
39 | | - const expectedResult = 'CefSharp Class Test'; |
| 42 | + const expectedResult = null; |
40 | 43 |
|
41 | | - assert.equal(expectedResult, actualResult.Value, "Return class " + expectedResult); |
| 44 | + assert.equal(expectedResult, actualResult, "Return null"); |
42 | 45 |
|
43 | 46 | asyncCallback(); |
44 | | - }); |
| 47 | + }); |
45 | 48 | }); |
46 | 49 |
|
| 50 | + QUnit.test("AsyncWaitTwoSeconds Test:", function (assert) |
| 51 | + { |
| 52 | + let asyncCallback = assert.async(); |
| 53 | + |
| 54 | + const expectedResult = "This method waited two seconds"; |
| 55 | + |
| 56 | + boundAsync.asyncWaitTwoSeconds(expectedResult).then(function (actualResult) |
| 57 | + { |
| 58 | + assert.equal(expectedResult, actualResult, "Return string " + expectedResult); |
| 59 | + |
| 60 | + asyncCallback(); |
| 61 | + }); |
| 62 | + }); |
47 | 63 |
|
48 | 64 | })(); |
49 | | - </script> |
| 65 | + </script> |
50 | 66 |
|
51 | | - </body> |
| 67 | +</body> |
52 | 68 | </html> |
0 commit comments