WebRequest: Fix flaky testGetElapsedTime test case
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 17 Jul 2018 03:23:30 +0000 (20:23 -0700)
committerTimo Tijhof <krinklemail@gmail.com>
Tue, 17 Jul 2018 03:23:30 +0000 (20:23 -0700)
commit36f84edc111b3efc420e9c5f98ce3881cbad947e
tree6ee1bcc748f1836d30d8240483bee5f7a9b80ab2
parent5c178cc3483af569eb844c19dcf79d95380348df
WebRequest: Fix flaky testGetElapsedTime test case

* Increase tolerance from 0.2s to 60s.

* Update mock to only set 'requestTime' when needed.

* Inject the mock timestamp.

* Increase test coverage by not just ensuring 0.0 is returned
  when invoked right after (which would be satisfied if it
  always returned 0.0), but use a timestamp that started
  slightly in the past to confirm it does (likely) do
  computation.

Bug: T199764
Change-Id: Iad9499391eecb4a9d1923d231a1a5f1afe173ecc
tests/phpunit/includes/WebRequestTest.php