Le 25/03/2014 11:08, Tim Chien a écrit :
> Hi all,
>
> I've just land a MockDOMRequest in the shared script and fix some of the tests.
>
https://bugzilla.mozilla.org/show_bug.cgi?id=974319
>
> With MockDOMRequest, you are given explicit control over the mocked
> async API. The test will run faster too.
>
> I will spend time identify more tests to be fixed. In the mean time
> please stop checking-in new tests/mock with setTimeout().
>
>
While I agree with the goal (remove setTimeouts we have in some mocks...
some are my fault), isn't it possible to simply use a really minimal
mock interface and use sinon in tests to give it behavior?
For example, in a test we could spy addEventListener, and call
"spy.yield" to simulate an event.
I'm not very comfortable with having complex mocks (I know I made some
of them... but I learnt more since then).
--
Julien