#include "net/cookies/canonical_cookie.h"
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "net/base/features.h"
#include "net/cookies/canonical_cookie_test_helpers.h"
#include "net/cookies/cookie_constants.h"
#include "net/cookies/cookie_inclusion_status.h"
#include "net/cookies/cookie_options.h"
#include "net/cookies/cookie_partition_key.h"
#include "net/cookies/parsed_cookie.h"
#include "net/http/http_util.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/third_party/mozilla/url_parse.h"
namespace net {
namespace {
const std::vector<std::string> kCookieableSchemes = …;
void MatchCookieLineToVector(
const std::string& line,
const std::vector<std::unique_ptr<CanonicalCookie>>& cookies) { … }
}
_;
AllOf;
Eq;
Not;
Property;
TEST(CanonicalCookieTest, Constructor) { … }
TEST(CanonicalCookieTest, CreationCornerCases) { … }
TEST(CanonicalCookieTest, Create) { … }
TEST(CanonicalCookieTest, CreateInvalidUrl) { … }
TEST(CanonicalCookieTest, CreateHostCookieFromString) { … }
TEST(CanonicalCookieTest, CreateNonStandardSameSite) { … }
TEST(CanonicalCookieTest, CreateSameSiteInCrossSiteContexts) { … }
TEST(CanonicalCookieTest, CreateHttpOnly) { … }
TEST(CanonicalCookieTest, CreateWithInvalidDomain) { … }
TEST(CanonicalCookieTest, CreateFromPublicSuffix) { … }
TEST(CanonicalCookieTest, CreateWithNonASCIIDomain) { … }
TEST(CanonicalCookieTest, CreateWithDomainAsIP) { … }
TEST(CanonicalCookieTest, CreateWithPartitioned) { … }
TEST(CanonicalCookieTest, CreateWithPartitioned_Localhost) { … }
TEST(CanonicalCookieTest, CreateWithMaxAge) { … }
TEST(CanonicalCookieTest, CreateWithExpires) { … }
TEST(CanonicalCookieTest, EmptyExpiry) { … }
TEST(CanonicalCookieTest, CreateWithLastUpdate) { … }
TEST(CanonicalCookieTest, IsEquivalent) { … }
TEST(CanonicalCookieTest, IsEquivalentForSecureCookieMatching) { … }
TEST(CanonicalCookieTest, IsEquivalentForOriginBoundCookies) { … }
TEST(CanonicalCookieTest, IsDomainMatch) { … }
TEST(CanonicalCookieTest, IsOnPath) { … }
TEST(CanonicalCookieTest, GetEffectiveSameSite) { … }
TEST(CanonicalCookieTest, IncludeForRequestURL) { … }
struct IncludeForRequestURLTestCase { … };
void VerifyIncludeForRequestURLTestCases(
CookieAccessSemantics access_semantics,
std::vector<IncludeForRequestURLTestCase> test_cases) { … }
TEST(CanonicalCookieTest, IncludeForRequestURLSameSite) { … }
TEST(CanonicalCookieTest, TestFirstPartyPartitionedAndCrossSiteContext) { … }
TEST(CanonicalCookieTest, IncludeCookiesWithoutSameSiteMustBeSecure) { … }
TEST(CanonicalCookieTest, IncludeForRequestURL_SameSiteNone_Metrics) { … }
TEST(CanonicalCookieTest, IncludeForRequestURL_RedirectDowngradeWarning) { … }
TEST(CanonicalCookieTest, IncludeForRequestURL_SchemeBoundStatus) { … }
TEST(CanonicalCookieTest, IncludeForRequestURL_PortBoundStatus) { … }
TEST(CanonicalCookieTest, IncludeForRequestURL_DomainCookiesPortMatch) { … }
TEST(CanonicalCookieTest, InsecureCookiesExpiryTimeLimit) { … }
TEST(CanonicalCookieTest, MultipleExclusionReasons) { … }
TEST(CanonicalCookieTest, PartialCompare) { … }
TEST(CanonicalCookieTest, SecureCookiePrefix) { … }
TEST(CanonicalCookieTest, HostCookiePrefix) { … }
TEST(CanonicalCookieTest, CanCreateSecureCookiesFromAnyScheme) { … }
TEST(CanonicalCookieTest, IsCanonical) { … }
TEST(CanonicalCookieTest, TestSetCreationDate) { … }
TEST(CanonicalCookieTest, TestPrefixHistograms) { … }
TEST(CanonicalCookieTest, TestHasNonASCIIHistograms) { … }
TEST(CanonicalCookieTest, BuildCookieLine) { … }
TEST(CanonicalCookieTest, BuildCookieAttributesLine) { … }
TEST(CanonicalCookieTest, CreateSanitizedCookie_Inputs) { … }
TEST(CanonicalCookieTest, CreateSanitizedCookie_Logic) { … }
TEST(CanonicalCookieTest, Create_SourceSchemePort) { … }
TEST(CanonicalCookieTest, CreateSanitizedCookie_SourceSchemePort) { … }
TEST(CanonicalCookieTest, FromStorage) { … }
TEST(CanonicalCookieTest, IsSetPermittedInContext) { … }
TEST(CanonicalCookieTest, IsSetPermittedEffectiveSameSite) { … }
TEST(CanonicalCookieTest, IsSetPermitted_AllowedToAccessSecureCookies) { … }
TEST(CanonicalCookieTest, IsSetPermitted_SameSiteNone_Metrics) { … }
TEST(CanonicalCookieTest, IsSetPermittedInContext_RedirectDowngradeWarning) { … }
TEST(CanonicalCookieTest, TestIsCanonicalWithInvalidSizeHistograms) { … }
TEST(CanonicalCookieTest, TestGetAndAdjustPortForTrustworthyUrls) { … }
TEST(CanonicalCookieTest, TestHasHiddenPrefixName) { … }
TEST(CanonicalCookieTest, TestDoubleUnderscorePrefixHistogram) { … }
TEST(CanonicalCookieTest, IsThirdPartyPartitioned) { … }
TEST(CanonicalCookieTest, IsSecure) { … }
}