• digit's avatar
    Add WARN_UNUSED_RESULT to base::Time methods that return bool. · 2c8eed34
    digit authored
    base::Time::FromString() and base::Time::FromUTCString() might fail
    at runtime on bad input. This adds a WARN_UNUSED_RESULT to their
    declarations to ensure that all callers properly handle the result.
    
    Apart from unit-tests, this changes two things:
    
    - DataUseTracker::RemoveExpiredEntriesForPref() will also
      remove any entries with an invalid date string.
    
      This doesn't change the runtime behaviour though, because
      a failure in base::Time::FromUTCString() would keep the
      local |key_date| variable to 0, which would have been
      considered too old anyway.
    
    - VariationsSeedStore::ImportFirstRunJavaSeed() has
      a new failure mode triggered by an invalid response
      date |FIRST_RUN_SEED_IMPORT_FAIL_INVALID_RESPONSE_DATE|
    
      It looks like the FirstRunResult enum values are only
      used on Android to report UMA metrics, so ensure that
      the new constant is added at the end of the list to
      avoid generating confusing histograms.
    
    - PexeDownloader::didReceiveResponse() still ignores
      invalid HTTP response 'last-modified' header dates.
      As with RemoveExpiredEntriesForPref() this doesn't
      change the runtime behaviour, but it is hard to see
      whether this is desirable or dangerous.
    
    - ConvertRequestValueToFileInfo() still ignores
      invalid date strings, as mentioned by the comment
      above the base::Time::FromString() line.
    
    BUG=669625
    
    Review-Url: https://codereview.chromium.org/2605293002
    Cr-Commit-Position: refs/heads/master@{#443353}
    2c8eed34
variations_seed_store.cc 19.3 KB