From: Jacek Caban jacek@codeweavers.com
--- dlls/ieframe/tests/webbrowser.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/ieframe/tests/webbrowser.c b/dlls/ieframe/tests/webbrowser.c index 15ce0272654..402014a8c07 100644 --- a/dlls/ieframe/tests/webbrowser.c +++ b/dlls/ieframe/tests/webbrowser.c @@ -4434,22 +4434,22 @@ static void test_SetAdvise(void)
static void test_SetQueryNetSessionCount(void) { - LONG count, init_count; + LONG count, init_count, inc_count, dec_count;
init_count = pSetQueryNetSessionCount(SESSION_QUERY); trace("init_count %ld\n", init_count);
- count = pSetQueryNetSessionCount(SESSION_INCREMENT); - ok(count == init_count + 1, "count = %ld\n", count); + inc_count = pSetQueryNetSessionCount(SESSION_INCREMENT); + ok(inc_count > init_count, "count = %ld\n", inc_count);
count = pSetQueryNetSessionCount(SESSION_QUERY); - ok(count == init_count + 1, "count = %ld\n", count); + ok(count == inc_count, "count = %ld\n", count);
- count = pSetQueryNetSessionCount(SESSION_DECREMENT); - ok(count == init_count, "count = %ld\n", count); + dec_count = pSetQueryNetSessionCount(SESSION_DECREMENT); + ok(dec_count < inc_count, "count = %ld\n", dec_count);
count = pSetQueryNetSessionCount(SESSION_QUERY); - ok(count == init_count, "count = %ld\n", count); + ok(count == dec_count, "count = %ld\n", count); }
static HRESULT WINAPI outer_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
Francois Gouget (@fgouget) commented about dlls/ieframe/tests/webbrowser.c:
static void test_SetQueryNetSessionCount(void) {
- LONG count, init_count;
LONG count, init_count, inc_count, dec_count;
init_count = pSetQueryNetSessionCount(SESSION_QUERY); trace("init_count %ld\n", init_count);
- count = pSetQueryNetSessionCount(SESSION_INCREMENT);
- ok(count == init_count + 1, "count = %ld\n", count);
inc_count = pSetQueryNetSessionCount(SESSION_INCREMENT);
ok(inc_count > init_count, "count = %ld\n", inc_count);
count = pSetQueryNetSessionCount(SESSION_QUERY);
- ok(count == init_count + 1, "count = %ld\n", count);
- ok(count == inc_count, "count = %ld\n", count);
If IE creates its own net session between the SESSION_INCREMENT call and the SESSION_QUERY one this last ok() call will fail.
Francois Gouget (@fgouget) commented about dlls/ieframe/tests/webbrowser.c:
init_count = pSetQueryNetSessionCount(SESSION_QUERY); trace("init_count %ld\n", init_count);
- count = pSetQueryNetSessionCount(SESSION_INCREMENT);
- ok(count == init_count + 1, "count = %ld\n", count);
inc_count = pSetQueryNetSessionCount(SESSION_INCREMENT);
ok(inc_count > init_count, "count = %ld\n", inc_count);
count = pSetQueryNetSessionCount(SESSION_QUERY);
- ok(count == init_count + 1, "count = %ld\n", count);
- ok(count == inc_count, "count = %ld\n", count);
- count = pSetQueryNetSessionCount(SESSION_DECREMENT);
- ok(count == init_count, "count = %ld\n", count);
- dec_count = pSetQueryNetSessionCount(SESSION_DECREMENT);
- ok(dec_count < inc_count, "count = %ld\n", dec_count);
If IE creates its own net session between the SESSION_INCREMENT call and the SESSION_DECREMENT one, this ok() call will fail.
I'm sure there are many other race conditions that could happen that would make this test fail.
The commit message should reference bug 54866.
On Wed Aug 16 13:14:42 2023 +0000, Francois Gouget wrote:
I'm sure there are many other race conditions that could happen that would make this test fail.
Well, I did say in bug 54866 that it looks like the extra net session is not created after the first SESSION_INCREMENT call so I guess this patch could work. But I as far as I can tell that's just how the timing of the race condition works and I don't think we should rely on that.