Stub out the system clock in the download manager, add tests
authorSteve Howard <showard@google.com>
Wed, 23 Jun 2010 01:20:55 +0000 (18:20 -0700)
committerSteve Howard <showard@google.com>
Thu, 1 Jul 2010 18:35:26 +0000 (11:35 -0700)
commit23357198c440e6872d3aef3e608295db7f8273bc
tree16391d655af983b751b41af5267e8053009a1f2c
parentb0aada69b9e6258bb9a1a7c1b783d0361ef3c6f2
Stub out the system clock in the download manager, add tests

Introduce SystemFacade, an interface that allows us to stub out the
system clock for testing the download manager.  This allows us to test
retrying a failed download without having the test wait 60 seconds.
This interface can include other dependencies in the future as well.

I've also used this to add tests for 503 (retry-after) and 301
(redirect), and I've added a test for download to the cache partition.

Other changes:
* made MockWebServer capable of checking + rethrowing exceptions from child threads
* refactoring + cleanup of DownloadManagerFunctionalTest
Android.mk
src/com/android/providers/downloads/DownloadService.java
src/com/android/providers/downloads/DownloadThread.java
src/com/android/providers/downloads/RealSystemFacade.java [new file with mode: 0644]
src/com/android/providers/downloads/SystemFacade.java [new file with mode: 0644]
tests/src/com/android/providers/downloads/DownloadManagerFunctionalTest.java
tests/src/com/android/providers/downloads/FakeSystemFacade.java [new file with mode: 0644]
tests/src/tests/http/MockWebServer.java