Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- I missed this one the first time around.
dlls/user32/tests/broadcast.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-)
diff --git a/dlls/user32/tests/broadcast.c b/dlls/user32/tests/broadcast.c index 5869119a69..afdb536816 100644 --- a/dlls/user32/tests/broadcast.c +++ b/dlls/user32/tests/broadcast.c @@ -138,26 +138,21 @@ if (0) /* TODO: Check the hang flags */ SetLastError( 0xdeadbeef ); recips = BSM_APPLICATIONS; ret = broadcast( BSF_POSTMESSAGE|BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, 0 ); - if (ret) - { - ok(ret==1, "Returned: %d\n", ret); - ok(WaitForSingleObject(hevent, 0) != WAIT_OBJECT_0, "Synchronous message sent instead\n"); - PulseEvent(hevent); - - recips = BSM_APPLICATIONS; - ret = broadcast( BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY ); - ok(ret==1, "Returned: %d\n", ret); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); - PulseEvent(hevent); - - recips = BSM_APPLICATIONS; - ret = broadcast( BSF_SENDNOTIFYMESSAGE|BSF_QUERY, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY ); - ok(!ret, "Returned: %d\n", ret); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); - PulseEvent(hevent); - } - else /* BSF_SENDNOTIFYMESSAGE not supported on NT4 */ - ok( GetLastError() == ERROR_INVALID_PARAMETER, "failed with err %u\n", GetLastError() ); + ok(ret==1, "Returned: %d\n", ret); + ok(WaitForSingleObject(hevent, 0) != WAIT_OBJECT_0, "Synchronous message sent instead\n"); + PulseEvent(hevent); + + recips = BSM_APPLICATIONS; + ret = broadcast( BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY ); + ok(ret==1, "Returned: %d\n", ret); + ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); + PulseEvent(hevent); + + recips = BSM_APPLICATIONS; + ret = broadcast( BSF_SENDNOTIFYMESSAGE|BSF_QUERY, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY ); + ok(!ret, "Returned: %d\n", ret); + ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); + PulseEvent(hevent);
recips = BSM_APPLICATIONS; ret = broadcast( 0, &recips, WM_NULL, 100, 0 );
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- The failing tests lack permissions or use invalid combinations of flags, so it's not too surprising that the behavior changed.
dlls/user32/tests/broadcast.c | 50 ++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 17 deletions(-)
diff --git a/dlls/user32/tests/broadcast.c b/dlls/user32/tests/broadcast.c index afdb536816..851c47eb96 100644 --- a/dlls/user32/tests/broadcast.c +++ b/dlls/user32/tests/broadcast.c @@ -131,8 +131,9 @@ if (0) /* TODO: Check the hang flags */ recips = BSM_APPLICATIONS; ResetEvent(hevent); ret = broadcast( BSF_POSTMESSAGE|BSF_QUERY, &recips, WM_NULL, 100, 0 ); - ok(ret==1, "Returned: %d\n", ret); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); + ok((ret == 1 && WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT) || + (ret == 0 && WaitForSingleObject(hevent, 1000) == WAIT_TIMEOUT) /* win10 */, + "Asynchronous message sent instead of synchronous message or no message. Returned: %d\n", ret); PulseEvent(hevent);
SetLastError( 0xdeadbeef ); @@ -151,13 +152,16 @@ if (0) /* TODO: Check the hang flags */ recips = BSM_APPLICATIONS; ret = broadcast( BSF_SENDNOTIFYMESSAGE|BSF_QUERY, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY ); ok(!ret, "Returned: %d\n", ret); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); + ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT || + WaitForSingleObject(hevent, 1000) == WAIT_TIMEOUT /* win10 */, + "Asynchronous message sent instead of synchronous message or no message\n"); PulseEvent(hevent);
recips = BSM_APPLICATIONS; ret = broadcast( 0, &recips, WM_NULL, 100, 0 ); - ok(ret==1, "Returned: %d\n", ret); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); + ok((ret == 1 && WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT) || + (ret == 0 && WaitForSingleObject(hevent, 1000) == WAIT_TIMEOUT) /* win10 */, + "Asynchronous message sent instead of synchronous message or no message. Returned: %d\n", ret); PulseEvent(hevent); }
@@ -212,8 +216,9 @@ if (0) /* TODO: Check the hang flags */ recips = BSM_APPLICATIONS; ResetEvent(hevent); ret = broadcastex( BSF_POSTMESSAGE|BSF_QUERY, &recips, WM_NULL, 100, 0, NULL ); - ok(ret==1, "Returned: %d\n", ret); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); + ok((ret == 1 && WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT) || + (ret == 0 && WaitForSingleObject(hevent, 1000) == WAIT_TIMEOUT) /* win10 */, + "Asynchronous message sent instead of synchronous message or no message. Returned: %d\n", ret); PulseEvent(hevent);
recips = BSM_APPLICATIONS; @@ -231,13 +236,16 @@ if (0) /* TODO: Check the hang flags */ recips = BSM_APPLICATIONS; ret = broadcastex( BSF_SENDNOTIFYMESSAGE|BSF_QUERY, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY, NULL ); ok(!ret, "Returned: %d\n", ret); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); + ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT || + WaitForSingleObject(hevent, 1000) == WAIT_TIMEOUT /* win10 */, + "Asynchronous message sent instead of synchronous message or no message\n"); PulseEvent(hevent);
recips = BSM_APPLICATIONS; ret = broadcastex( 0, &recips, WM_NULL, 100, 0, NULL ); - ok(ret==1, "Returned: %d\n", ret); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); + ok((ret == 1 && WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT) || + (ret == 0 && WaitForSingleObject(hevent, 1000) == WAIT_TIMEOUT) /* win10 */, + "Asynchronous message sent instead of synchronous message or no message. Returned: %d\n", ret); PulseEvent(hevent); }
@@ -266,8 +274,10 @@ static void test_noprivileges(void) recips = BSM_ALLDESKTOPS; ResetEvent(hevent); ret = BroadcastSystemMessageExW( BSF_QUERY, &recips, WM_NULL, 100, 0, NULL ); - ok(ret==1, "Returned: %d error %u\n", ret, GetLastError()); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); + ok((ret == 1 && WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT) || + (ret == 0 && WaitForSingleObject(hevent, 1000) == WAIT_TIMEOUT) /* win10 */, + "Asynchronous message sent instead of synchronous message or no message. Returned: %d error %08x\n", + ret, GetLastError()); ok(recips == BSM_ALLDESKTOPS || recips == BSM_ALL_RECIPS, /* win2k3 */ "Received by: %08x\n", recips); @@ -277,8 +287,10 @@ static void test_noprivileges(void) recips = BSM_ALLCOMPONENTS; ResetEvent(hevent); ret = BroadcastSystemMessageExW( BSF_QUERY, &recips, WM_NULL, 100, 0, NULL ); - ok(ret==1, "Returned: %d error %u\n", ret, GetLastError()); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); + ok((ret == 1 && WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT) || + (ret == 0 && WaitForSingleObject(hevent, 1000) == WAIT_TIMEOUT) /* win10 */, + "Asynchronous message sent instead of synchronous message or no message. Returned: %d error %08x\n", + ret, GetLastError()); ok(recips == BSM_ALLCOMPONENTS || recips == BSM_ALL_RECIPS, /* win2k3 */ "Received by: %08x\n", recips); @@ -288,8 +300,10 @@ static void test_noprivileges(void) recips = BSM_ALLDESKTOPS|BSM_APPLICATIONS; ResetEvent(hevent); ret = BroadcastSystemMessageExW( BSF_QUERY, &recips, WM_NULL, 100, 0, NULL ); - ok(ret==1, "Returned: %d error %u\n", ret, GetLastError()); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); + ok((ret == 1 && WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT) || + (ret == 0 && WaitForSingleObject(hevent, 1000) == WAIT_TIMEOUT) /* win10 */, + "Asynchronous message sent instead of synchronous message or no message. Returned: %d error %08x\n", + ret, GetLastError()); ok(recips == (BSM_ALLDESKTOPS|BSM_APPLICATIONS) || recips == BSM_APPLICATIONS, /* win2k3 */ "Received by: %08x\n", recips); @@ -300,7 +314,9 @@ static void test_noprivileges(void) ResetEvent(hevent); ret = BroadcastSystemMessageExW( BSF_QUERY, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY, NULL ); ok(!ret, "Returned: %d\n", ret); - ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n"); + ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT || + WaitForSingleObject(hevent, 1000) == WAIT_TIMEOUT /* win10 */, + "Asynchronous message sent instead of synchronous message or no message\n"); ok(recips == (BSM_ALLDESKTOPS|BSM_APPLICATIONS) || recips == BSM_APPLICATIONS, /* win2k3 */ "Received by: %08x\n", recips);
On Sun, Mar 18, 2018 at 11:26:21PM -0600, Alex Henrie wrote:
Signed-off-by: Alex Henrie alexhenrie24@gmail.com
The failing tests lack permissions or use invalid combinations of flags, so it's not too surprising that the behavior changed.
dlls/user32/tests/broadcast.c | 50 ++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 17 deletions(-)
diff --git a/dlls/user32/tests/broadcast.c b/dlls/user32/tests/broadcast.c index afdb536816..851c47eb96 100644 --- a/dlls/user32/tests/broadcast.c +++ b/dlls/user32/tests/broadcast.c @@ -131,8 +131,9 @@ if (0) /* TODO: Check the hang flags */ recips = BSM_APPLICATIONS; ResetEvent(hevent); ret = broadcast( BSF_POSTMESSAGE|BSF_QUERY, &recips, WM_NULL, 100, 0 );
- ok(ret==1, "Returned: %d\n", ret);
- ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
- ok((ret == 1 && WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT) ||
(ret == 0 && WaitForSingleObject(hevent, 1000) == WAIT_TIMEOUT) /* win10 */,
PulseEvent(hevent);"Asynchronous message sent instead of synchronous message or no message. Returned: %d\n", ret);
As you say, some of these flag combinations are meaningless. I suggest we just remove them.
Huw.
On Wed, Mar 21, 2018 at 2:47 AM Huw Davies huw@codeweavers.com wrote:
On Sun, Mar 18, 2018 at 11:26:21PM -0600, Alex Henrie wrote:
Signed-off-by: Alex Henrie alexhenrie24@gmail.com
The failing tests lack permissions or use invalid combinations of flags, so it's not too surprising that the behavior changed.
dlls/user32/tests/broadcast.c | 50
++++++++++++++++++++++++++++---------------
1 file changed, 33 insertions(+), 17 deletions(-)
diff --git a/dlls/user32/tests/broadcast.c
b/dlls/user32/tests/broadcast.c
index afdb536816..851c47eb96 100644 --- a/dlls/user32/tests/broadcast.c +++ b/dlls/user32/tests/broadcast.c @@ -131,8 +131,9 @@ if (0) /* TODO: Check the hang flags */ recips = BSM_APPLICATIONS; ResetEvent(hevent); ret = broadcast( BSF_POSTMESSAGE|BSF_QUERY, &recips, WM_NULL, 100,
0 );
- ok(ret==1, "Returned: %d\n", ret);
- ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous
message sent instead\n");
- ok((ret == 1 && WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT) ||
(ret == 0 && WaitForSingleObject(hevent, 1000) == WAIT_TIMEOUT)
/* win10 */,
"Asynchronous message sent instead of synchronous message or no
message. Returned: %d\n", ret);
PulseEvent(hevent);
As you say, some of these flag combinations are meaningless. I suggest we just remove them.
Hmm, I generally assume that test cases are there for a reason, but I'm happy to just remove the six invalid flags tests if there is general consensus that that's the right thing to do. Does anyone else have an opinion?
-Alex