summaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/providers/downloads/ThreadingTest.java
Commit message (Collapse)AuthorAgeFilesLines
* Fix race conditions around filename claiming.Jeff Sharkey2013-03-011-0/+46
| | | | | | | | | | | | | When multiple downloads are running in parallel, they can end up claiming the same filename and clobber over each other. This change introduces locking around filename generation, and touches the claimed filename so other threads fail the File.exists() check and keep looking. Tests to verify. Bug: 8255596 Change-Id: Ie75ed047c199cf679832c75159056ca036eac18d
* Tests for max retries/redirects, ETag switches.Jeff Sharkey2013-01-291-0/+2
| | | | | | | | | | Verify that servers responding with many retries or redirects result in failed download, instead of spinning out of control. Test to verify that changed ETag results in download failing. Also fix handling of HTTP 301 to update Uri in database. Change-Id: Iff2948d79961a245b7900117d107edaa356618c9
* Clean up DownloadManager threading tests.Jeff Sharkey2013-01-081-8/+1
| | | | | | | | | | | Change runUntilStatus() methods to polling with timeout instead of requiring internal knowledge about threading. Fix notification tests, and move opening of InputStream until after handling headers to avoid FNFE. Always reset facade to defaults before each test. Change-Id: I6b2d6cfc4e685d2090c1133b1b2e89ae12760f8b
* Migrate to shared MockWebServer.Jeff Sharkey2012-03-291-1/+1
| | | | | Bug: 4726601 Change-Id: Ibe537bd5c2a092dbf974360cd454751881f7f4ea
* Manual merge: Moved DownloadManager to android.appSteve Howard2010-09-281-1/+1
| | | | Change-Id: Id1de44459ec1bf53e928cae826047467b355823d
* Serialize threading for download manager testing.Steve Howard2010-07-271-0/+56
The download manager uses threading in a simple way -- it launches two threads, UpdateThread and DownloadThread, and both are "fire and forget". This is fortunate for testing, since it means we can eliminate multithreading and simply run each thread in order, and everything still works. This change does just that, abstracting Thread.start() behind SystemFacade and making FakeSystemFacade put new threads into a queue and then run through them serially. This simplifies much of the test code and makes it all much more predictable. I've simplified the test code as much as possible here and moved a few more tests over to PublicApiFunctionalTest, leaving only a minimum in DownloadManagerFunctionalTest, which will eventually be deleted altogether. I've also improved testing in some areas -- for example, we can now test that running notifications get cancelled after the download completes in a robust way. There is one test case that checks for race conditions and requires multithreading. I've moved this into a new ThreadingTest class, which uses a custom FakeSystemFacade that allows multithreading. I've extracted AbstractPublicApiTest for the newly shared code. Change-Id: Ic1d5c76bfa9913fe053174c3d8b516790ca8b25f