Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: net/cookies/canonical_cookie.h

Issue 2898953008: Implement and test CanonicalCookie::IsCanonical() (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/cookies/canonical_cookie.cc » ('j') | net/cookies/canonical_cookie.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_COOKIES_CANONICAL_COOKIE_H_ 5 #ifndef NET_COOKIES_CANONICAL_COOKIE_H_
6 #define NET_COOKIES_CANONICAL_COOKIE_H_ 6 #define NET_COOKIES_CANONICAL_COOKIE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // Returns true if the cookie is less than |other|, considering only name, 137 // Returns true if the cookie is less than |other|, considering only name,
138 // domain and path. In particular, two equivalent cookies (see IsEquivalent()) 138 // domain and path. In particular, two equivalent cookies (see IsEquivalent())
139 // are identical for PartialCompare(). 139 // are identical for PartialCompare().
140 bool PartialCompare(const CanonicalCookie& other) const; 140 bool PartialCompare(const CanonicalCookie& other) const;
141 141
142 // Returns true if the cookie is less than |other|, considering all fields. 142 // Returns true if the cookie is less than |other|, considering all fields.
143 // FullCompare() is consistent with PartialCompare(): cookies sorted using 143 // FullCompare() is consistent with PartialCompare(): cookies sorted using
144 // FullCompare() are also sorted with respect to PartialCompare(). 144 // FullCompare() are also sorted with respect to PartialCompare().
145 bool FullCompare(const CanonicalCookie& other) const; 145 bool FullCompare(const CanonicalCookie& other) const;
146 146
147 // Return whether this object is a valid CanonicalCookie(). Invalid
148 // cookies may be constructed by the detailed constructor.
149 bool IsCanonical() const;
mmenke 2017/05/26 17:02:17 We should DCHECK on this at the end of CanonicalCo
Randy Smith (Not in Mondays) 2017/06/07 23:31:40 DCHECK added. I agree that a fuzzer might be a wa
mmenke 2017/06/08 18:00:23 So I'm very shaky on the accuracy of this function
150
147 private: 151 private:
148 FRIEND_TEST_ALL_PREFIXES(CanonicalCookieTest, TestPrefixHistograms); 152 FRIEND_TEST_ALL_PREFIXES(CanonicalCookieTest, TestPrefixHistograms);
149 153
150 // The special cookie prefixes as defined in 154 // The special cookie prefixes as defined in
151 // https://tools.ietf.org/html/draft-west-cookie-prefixes 155 // https://tools.ietf.org/html/draft-west-cookie-prefixes
152 // 156 //
153 // This enum is being histogrammed; do not reorder or remove values. 157 // This enum is being histogrammed; do not reorder or remove values.
154 enum CookiePrefix { 158 enum CookiePrefix {
155 COOKIE_PREFIX_NONE = 0, 159 COOKIE_PREFIX_NONE = 0,
156 COOKIE_PREFIX_SECURE, 160 COOKIE_PREFIX_SECURE,
(...skipping 28 matching lines...) Expand all
185 bool httponly_; 189 bool httponly_;
186 CookieSameSite same_site_; 190 CookieSameSite same_site_;
187 CookiePriority priority_; 191 CookiePriority priority_;
188 }; 192 };
189 193
190 typedef std::vector<CanonicalCookie> CookieList; 194 typedef std::vector<CanonicalCookie> CookieList;
191 195
192 } // namespace net 196 } // namespace net
193 197
194 #endif // NET_COOKIES_CANONICAL_COOKIE_H_ 198 #endif // NET_COOKIES_CANONICAL_COOKIE_H_
OLDNEW
« no previous file with comments | « no previous file | net/cookies/canonical_cookie.cc » ('j') | net/cookies/canonical_cookie.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698