LiTiang / js-test-driver

Automatically exported from code.google.com/p/js-test-driver
0 stars 0 forks source link

If all callbacks in a CallbackPool complete before the test case function returns, the test runner goes haywire #140

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Set up an AsyncTestCase
2. Register a callback with the pool
3. Trigger the callback before returning from the test case

What is the expected output? What do you see instead?

The test should run normally, but instead the "next test" function gets called 
twice, screwing up the runner. This happens because 1) the callback triggers 
onPoolComplete immediately, and 2) after returning from the test function, 
onPoolComplete is called again.

This can happen when different browsers handle event callbacks differently. For 
example, the hashchange event fires immediately in Chrome, but after the 
function returns in Firefox and IE.

What version of the product are you using? On what operating system?

Trunk, Firefox, IE, and Chrome clients with Linux server.

Please provide any additional information below.

A patch to fix is attached. The CallbackPool will not call onPoolComplete until 
it has been activated after the test case function returns.

Original issue reported on code.google.com by jabradford@gmail.com on 21 Sep 2010 at 6:39

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by corbinrs...@gmail.com on 23 Sep 2010 at 10:12

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r709.

Original comment by robertsd...@gmail.com on 24 Sep 2010 at 12:02

GoogleCodeExporter commented 9 years ago
Hey, thanks for finding this edge case. -Robert

Original comment by robertsd...@gmail.com on 24 Sep 2010 at 5:23