test_support.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_SERVICES_QUARANTINE_TEST_SUPPORT_H_
  5. #define COMPONENTS_SERVICES_QUARANTINE_TEST_SUPPORT_H_
  6. class GURL;
  7. namespace base {
  8. class FilePath;
  9. }
  10. namespace quarantine {
  11. // Determine if a file has quarantine metadata attached to it.
  12. //
  13. // If |source_url| is non-empty, then the download source URL in
  14. // quarantine metadata should match |source_url| exactly. The function returns
  15. // |false| if there is a mismatch. If |source_url| is empty, then this function
  16. // only checks for the existence of a download source URL in quarantine
  17. // metadata.
  18. //
  19. // If |referrer_url| is valid, then the download referrer URL in quarantine
  20. // metadata must match |referrer_url| exactly. The function returns |false| if
  21. // there is a mismatch in the |referrer_url| even if the |source_url| matches.
  22. // No referrer URL checks are performed if |referrer_url| is empty.
  23. //
  24. // If both |source_url| and |referrer_url| are empty, then the function returns
  25. // true if any quarantine metadata is present for the file.
  26. //
  27. // **Note**: On Windows 8 or lower, this function only checks if the
  28. // |ZoneIdentifier| metadata is present. |source_url| and |referrer_url| are
  29. // ignored. Individual URLs are only stored as part of the mark-of-the-web since
  30. // Windows 10.
  31. bool IsFileQuarantined(const base::FilePath& file,
  32. const GURL& source_url,
  33. const GURL& referrer_url);
  34. } // namespace quarantine
  35. #endif // COMPONENTS_SERVICES_QUARANTINE_TEST_SUPPORT_H_