summaryrefslogtreecommitdiff
path: root/update_manager/update_manager_unittest.cc
diff options
context:
space:
mode:
authorGilad Arnold <garnold@chromium.org>2014-07-17 11:40:43 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-07-25 03:41:09 +0000
commita23e408368ad34e21ee90ebd0dcb55cd03417d22 (patch)
treeb2df3a675e9e81163eb67dd6979c2531d61b6781 /update_manager/update_manager_unittest.cc
parenta65fced5f4c2b551616b26ee90a800b44090735f (diff)
update_engine: UM: Make DefaultPolicy::UpdateCheckAllowed stateful.
This adds an auxiliary state to DefaultPolicy, and makes UpdateCheckAllowed use it for recording the last time an update check was allowed. This is necessary for enforcing a minimum interval between consecutive update checks, a necessary property in the unlikely case that the main policy is badly screwed: with it, the update engine will repeatedly check for updates, unnecessarily consuming local resources and potentially DDoS-ing Omaha. In order to track time, the DefaultPolicy now takes a ClockInterface argument; for backward compatibility with existing unit testing code, we allow this handle to be null, in which case time is not tracked and the policy resorts to the previous default behavior (namely, updates are always allowed). We do plug a clock when DefaultPolicy is used in the UpdateManager production (backup policy) and fake (main policy) implementations. Note that the state is added as an external object, in order to work around the constness of policy objects that's implied by the policy API (const methods). Finally, it should be noted that we use monotonic time in order to ensure that the DefaultPolicy does not become an attack surface for denying updates, or exhausting local resources and/or DoS-ing services. BUG=chromium:394778 TEST=Unit tests. Change-Id: I08628ea9b0067fa7abf6e457c55d4ffea276c463 Reviewed-on: https://chromium-review.googlesource.com/208732 Reviewed-by: Gilad Arnold <garnold@chromium.org> Tested-by: Gilad Arnold <garnold@chromium.org> Commit-Queue: Gilad Arnold <garnold@chromium.org>
Diffstat (limited to 'update_manager/update_manager_unittest.cc')
0 files changed, 0 insertions, 0 deletions