chromium/net/cookies/canonical_cookie_unittest.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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 =;

// Helper for testing BuildCookieLine
void MatchCookieLineToVector(
    const std::string& line,
    const std::vector<std::unique_ptr<CanonicalCookie>>& cookies) {}

}  // namespace

_;
AllOf;
Eq;
Not;
Property;

TEST(CanonicalCookieTest, Constructor) {}

TEST(CanonicalCookieTest, CreationCornerCases) {}

TEST(CanonicalCookieTest, Create) {}

TEST(CanonicalCookieTest, CreateInvalidUrl) {}

// Test that a cookie string with an empty domain attribute generates a
// canonical host cookie.
TEST(CanonicalCookieTest, CreateHostCookieFromString) {}

TEST(CanonicalCookieTest, CreateNonStandardSameSite) {}

TEST(CanonicalCookieTest, CreateSameSiteInCrossSiteContexts) {}

TEST(CanonicalCookieTest, CreateHttpOnly) {}

TEST(CanonicalCookieTest, CreateWithInvalidDomain) {}

// Creating a cookie for an eTLD is possible, but it must match the hostname and
// be a host cookie.
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 that SameSite=None requires Secure.
TEST(CanonicalCookieTest, IncludeCookiesWithoutSameSiteMustBeSecure) {}

TEST(CanonicalCookieTest, IncludeForRequestURL_SameSiteNone_Metrics) {}

// Test that the CookieInclusionStatus warning for inclusion changed by
// cross-site redirect context downgrade is applied correctly.
TEST(CanonicalCookieTest, IncludeForRequestURL_RedirectDowngradeWarning) {}

// Test that the correct inclusion status is generated when a cookie's source
// scheme does(n't) match the url's.
TEST(CanonicalCookieTest, IncludeForRequestURL_SchemeBoundStatus) {}

// Test that the correct inclusion status is generated when a cookie's source
// port does(n't) match the url's.
TEST(CanonicalCookieTest, IncludeForRequestURL_PortBoundStatus) {}

// Test that domain cookies match any request url port.
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) {}

// Confirm that input arguments are reflected in the output cookie.
TEST(CanonicalCookieTest, CreateSanitizedCookie_Inputs) {}

// Make sure sanitization and blocking of cookies works correctly.
TEST(CanonicalCookieTest, CreateSanitizedCookie_Logic) {}

// Make sure that the source scheme and port are set correctly for cookies that
// are marked as "Secure".
TEST(CanonicalCookieTest, Create_SourceSchemePort) {}

// Make sure that the source scheme and port are set correctly for cookies that
// are marked as "Secure".
TEST(CanonicalCookieTest, CreateSanitizedCookie_SourceSchemePort) {}

TEST(CanonicalCookieTest, FromStorage) {}

TEST(CanonicalCookieTest, IsSetPermittedInContext) {}

TEST(CanonicalCookieTest, IsSetPermittedEffectiveSameSite) {}

TEST(CanonicalCookieTest, IsSetPermitted_AllowedToAccessSecureCookies) {}

TEST(CanonicalCookieTest, IsSetPermitted_SameSiteNone_Metrics) {}

// Test that the CookieInclusionStatus warning for inclusion changed by
// cross-site redirect context downgrade is applied correctly.
TEST(CanonicalCookieTest, IsSetPermittedInContext_RedirectDowngradeWarning) {}

TEST(CanonicalCookieTest, TestIsCanonicalWithInvalidSizeHistograms) {}

TEST(CanonicalCookieTest, TestGetAndAdjustPortForTrustworthyUrls) {}

TEST(CanonicalCookieTest, TestHasHiddenPrefixName) {}

TEST(CanonicalCookieTest, TestDoubleUnderscorePrefixHistogram) {}

TEST(CanonicalCookieTest, IsThirdPartyPartitioned) {}

// Tests that IsSecure returns true if a cookie's secure attribute is true
// OR if its source_scheme is kSecure when scheme binding is enabled.
TEST(CanonicalCookieTest, IsSecure) {}

}  // namespace net