#include <cstring>
#include <string>
#include <tuple>
#include <vector>
#include "base/files/file_util.h"
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
#include "base/test/scoped_feature_list.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/net/storage_test_utils.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_test_util.h"
#include "chrome/browser/tpcd/support/top_level_trial_service.h"
#include "chrome/browser/tpcd/support/top_level_trial_service_factory.h"
#include "chrome/browser/tpcd/support/validity_service.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/profile_waiter.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/content_settings/core/common/content_settings_metadata.h"
#include "components/content_settings/core/common/content_settings_utils.h"
#include "components/content_settings/core/common/features.h"
#include "components/prefs/pref_service.h"
#include "components/privacy_sandbox/tracking_protection_prefs.h"
#include "components/tpcd/metadata/browser/parser.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_paths.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
#include "net/base/features.h"
#include "net/cookies/cookie_setting_override.h"
#include "net/cookies/site_for_cookies.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
namespace tpcd::metadata {
namespace {
const base::FilePath::CharType kComponentFileName[] = …);
const char* kFirstPartyHost = …;
const char* kThirdPartyHost1 = …;
const char* kThirdPartyHost1Sub = …;
const char* kThirdPartyHost2 = …;
const char* kThirdPartyHost3 = …;
#if !BUILDFLAG(IS_CHROMEOS_ASH)
Profile& CreateOriginalGuestProfile() { … }
Profile* CreateRegularProfile() { … }
#endif
const char kThirdPartyCookieAllowMechanismHistogram[] = …;
ThirdPartyCookieAllowMechanism;
}
class ManagerBrowserTest : public InProcessBrowserTest { … };
IN_PROC_BROWSER_TEST_F(ManagerBrowserTest, GetTpcdMetadataGrants_Empty) { … }
IN_PROC_BROWSER_TEST_F(ManagerBrowserTest, GetTpcdMetadataGrants) { … }
IN_PROC_BROWSER_TEST_F(ManagerBrowserTest, SuccessfullyUpdated) { … }
IN_PROC_BROWSER_TEST_F(ManagerBrowserTest,
TpcdDtGracePeriodEnforced_ValidDtToken) { … }
IN_PROC_BROWSER_TEST_F(ManagerBrowserTest,
TpcdDtGracePeriodEnforced_EntryPrecedence_1) { … }
IN_PROC_BROWSER_TEST_F(ManagerBrowserTest,
TpcdDtGracePeriodEnforced_EntryPrecedence_2) { … }
IN_PROC_BROWSER_TEST_F(ManagerBrowserTest,
TpcdDtGracePeriodEnforced_InValidDtToken) { … }
class ManagerPrefsBrowserTest
: public ManagerBrowserTest,
public testing::WithParamInterface<
std::tuple< bool,
bool>> { … };
INSTANTIATE_TEST_SUITE_P(…);
IN_PROC_BROWSER_TEST_P(ManagerPrefsBrowserTest,
RelevantUserCookieSpecsPrecede) { … }
IN_PROC_BROWSER_TEST_P(ManagerPrefsBrowserTest, NoSpecificBlockedCookieSpecs) { … }
#if !BUILDFLAG(IS_CHROMEOS_ASH)
IN_PROC_BROWSER_TEST_P(ManagerPrefsBrowserTest,
NoSpecificBlockedCookieSpecs_AltRegularProfile) { … }
#endif
IN_PROC_BROWSER_TEST_P(ManagerPrefsBrowserTest,
NoSpecificBlockedCookieSpecs_IncognitoProfile) { … }
#if !BUILDFLAG(IS_CHROMEOS_ASH)
IN_PROC_BROWSER_TEST_P(ManagerPrefsBrowserTest,
NoSpecificBlockedCookieSpecs_GuestProfile) { … }
#endif
}