Commit dd42fdb 1 parent 56ce91f commit dd42fdb Copy full SHA for dd42fdb
File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,34 @@ public async Task TaskDeleteCookiesCallbackOnComplete()
54
54
Assert . Equal ( numberOfCookiesDeleted , result ) ;
55
55
}
56
56
57
+ /// <summary>
58
+ /// Test to validate PR https://github.com/cefsharp/CefSharp/pull/2349
59
+ /// </summary>
60
+ /// <returns>Task</returns>
61
+ [ Fact ]
62
+ public async Task TaskDeleteCookiesCallbackOnCompleteLoop ( )
63
+ {
64
+ const int numberOfCookiesDeleted = 10 ;
65
+
66
+ for ( var i = 0 ; i < 100 ; i ++ )
67
+ {
68
+ var callback = new TaskDeleteCookiesCallback ( ) ;
69
+
70
+ //Execute OnComplete on seperate Thread as in practice will be called on the CEF IO Thread.
71
+ Task . Delay ( 100 ) . ContinueWith ( x =>
72
+ {
73
+ var c = ( IDeleteCookiesCallback ) callback ;
74
+
75
+ c . OnComplete ( numberOfCookiesDeleted ) ;
76
+ c . Dispose ( ) ;
77
+ } , TaskScheduler . Default ) ;
78
+
79
+ var result = await callback . Task ;
80
+
81
+ Assert . Equal ( numberOfCookiesDeleted , result ) ;
82
+ }
83
+ }
84
+
57
85
[ Fact ]
58
86
public async Task TaskDeleteCookiesCallbackDispose ( )
59
87
{
You can’t perform that action at this time.
0 commit comments