Move Secure cookie check into CanonicalCookie::IsSetPermittedInContext.
This cl also converts a portion of CanonicalCookie unit tests to use
matcher-based code, in order to be able to more easily assert multiple
things about multiple parts of the return value of
IsSetPermittedInContext. (E.g., being able to make assertions about both
the |status| and the |is_allowed_to_access_secure_cookies| fields of the
|CookieAccessResult|. This also has the benefit of being more
declarative and avoiding declaring temp variables, which are
error-prone. In particular, this fixes bugs where the wrong temp
variable was accidentally used (lines 2785, 2899).
This cl also fixes a bug (in test) where the LEGACY access semantics
were accidentally unused, with UNKNOWN being redundantly used instead
(lines 2967-2987).
Change-Id: I09b981f5f0819807ff5dd769022e4d6baa5f50a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2571806
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Lily Chen <[email protected]>
Commit-Queue: Chris Fredrickson <[email protected]>
Cr-Commit-Position: refs/heads/master@{#834578}
diff --git a/net/cookies/cookie_inclusion_status.h b/net/cookies/cookie_inclusion_status.h
index 59f64971..ebbf732 100644
--- a/net/cookies/cookie_inclusion_status.h
+++ b/net/cookies/cookie_inclusion_status.h
@@ -292,6 +292,12 @@
return os << status.GetDebugString();
}
+// Provided to allow gtest to create more helpful error messages, instead of
+// printing hex.
+inline void PrintTo(const CookieInclusionStatus& cis, std::ostream* os) {
+ *os << cis;
+}
+
} // namespace net
#endif // NET_COOKIES_COOKIE_INCLUSION_STATUS_H_