bug 1077595 - Use DataStoreChangeEvents to update Download API Manager c...

...ache up to date. Move tracking of active downloads into StatusBar instead of DownloadNotifications. r=crdlc,mhenretty
This is where the use of fake timers comes in. They're consistent and they
make the tests quite reliable.

There is an overall goal to switch from Requests to Promises throughout
this code. I would rather do this all at once and have the code be
consistent than only use promises for new stuff. Hope that makes sense.
On Nov 5, 2014 12:39 AM, "Arthur Chen" <notifications@github.com> wrote:

> In apps/settings/test/unit/download_api_manager_test.js:
>
> > @@ -45,15 +48,23 @@ suite('DownloadApiManager', function() {
> >    suite(' > methods', function() {
> >      var downloadsMock;
> >      setup(function(done) {
> > +      clock = this.sinon.useFakeTimers();
> > +
> > +      DownloadApiManager.init();
> > +      clock.tick(TICK);
>
> Using timeout is potentially making the test unstable. It would be easier
> if DownloadApiManager returns a promise, then we could use code like:
>
> DownloadApiManager.init().then(function() {
>  // assertions
> }).then(done, done);
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/mozilla-b2g/gaia/pull/25589/files#r19860238>.
>