#include "components/browsing_data/content/browsing_data_model.h"
#include <memory>
#include <string>
#include <string_view>
#include "base/check.h"
#include "base/run_loop.h"
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/run_until.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/test_future.h"
#include "base/test/test_timeouts.h"
#include "base/threading/platform_thread.h"
#include "chrome/browser/browsing_data/chrome_browsing_data_model_delegate.h"
#include "chrome/browser/media/clear_key_cdm_test_helper.h"
#include "chrome/browser/privacy_sandbox/privacy_sandbox_attestations/privacy_sandbox_attestations_mixin.h"
#include "chrome/browser/privacy_sandbox/privacy_sandbox_settings_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/web_applications/test/isolated_web_app_test_utils.h"
#include "chrome/browser/web_applications/isolated_web_apps/isolated_web_app_url_info.h"
#include "chrome/browser/web_applications/os_integration/os_integration_manager.h"
#include "chrome/common/chrome_features.h"
#include "chrome/test/base/chrome_test_utils.h"
#include "chrome/test/base/mixin_based_in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/browsing_data/content/browsing_data_model_test_util.h"
#include "components/browsing_data/content/browsing_data_test_util.h"
#include "components/browsing_data/content/shared_worker_info.h"
#include "components/content_settings/browser/page_specific_content_settings.h"
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/network_session_configurator/common/network_switches.h"
#include "components/privacy_sandbox/privacy_sandbox_attestations/privacy_sandbox_attestations.h"
#include "components/privacy_sandbox/privacy_sandbox_settings.h"
#include "components/services/storage/public/mojom/local_storage_control.mojom.h"
#include "components/services/storage/public/mojom/storage_usage_info.mojom.h"
#include "components/services/storage/shared_storage/shared_storage_manager.h"
#include "content/public/browser/attribution_data_model.h"
#include "content/public/browser/dom_storage_context.h"
#include "content/public/browser/network_service_instance.h"
#include "content/public/browser/private_aggregation_data_model.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/storage_usage_info.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test_content_browser_client.h"
#include "media/base/media_switches.h"
#include "net/base/features.h"
#include "net/base/schemeful_site.h"
#include "net/dns/mock_host_resolver.h"
#include "net/shared_dictionary/shared_dictionary_isolation_key.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/request_handler_util.h"
#include "services/network/public/cpp/cors/cors.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/mojom/network_service.mojom.h"
#include "services/network/test/trust_token_request_handler.h"
#include "services/network/test/trust_token_test_server_handler_registration.h"
#include "services/network/test/trust_token_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "url/gurl.h"
#include "url/origin.h"
FeatureRef;
FeatureRefAndParams;
BasicHttpResponse;
HttpMethod;
HttpRequest;
HttpResponse;
namespace {
constexpr char kTestHost[] = …;
constexpr char kTestHost2[] = …;
constexpr char kTestHost3[] = …;
constexpr char kAccountId[] = …;
constexpr char kIdpOrigin[] = …;
constexpr char kExpectedConfigPath[] = …;
constexpr char kExpectedWellKnownPath[] = …;
constexpr char kTestContentType[] = …;
constexpr char kIdpForbiddenHeader[] = …;
static constexpr char kSetLoginHeader[] = …;
static constexpr char kLoggedInHeaderValue[] = …;
static constexpr char kLoggedOutHeaderValue[] = …;
constexpr char kToken[] = …;
void ProvideRequestHandlerKeyCommitmentsToNetworkService(
std::string_view host,
net::EmbeddedTestServer* https_server,
const network::test::TrustTokenRequestHandler& request_handler) { … }
void JoinInterestGroup(const content::ToRenderFrameHost& adapter,
net::EmbeddedTestServer* https_server,
const std::string& owner_host) { … }
void RunAdAuction(const content::ToRenderFrameHost& adapter,
net::EmbeddedTestServer* https_server,
const std::string& seller_host,
const std::string& buyer_host) { … }
void ExecuteScriptInSharedStorageWorklet(
const content::ToRenderFrameHost& execution_target,
const std::string& script,
GURL* out_module_script_url,
net::EmbeddedTestServer* https_server) { … }
void AccessTopics(const content::ToRenderFrameHost& adapter) { … }
class IdpTestServer { … };
std::string GetIdpConfigUrl(net::EmbeddedTestServer* https_server) { … }
IdpTestServer::ConfigDetails BuildValidConfigDetails() { … }
void RunFedCm(const content::ToRenderFrameHost& adapter,
net::EmbeddedTestServer* https_server) { … }
void AddLocalStorageUsage(content::RenderFrameHost* render_frame_host,
int size) { … }
void WaitForModelUpdate(BrowsingDataModel* model, size_t expected_size) { … }
void RemoveBrowsingDataForDataOwner(BrowsingDataModel* model,
BrowsingDataModel::DataOwner data_owner) { … }
void EnsurePageAccessedStorage(content::WebContents* web_contents) { … }
}
ValidateBrowsingDataEntries;
ValidateBrowsingDataEntriesNonZeroUsage;
OperationResult;
HasDataForType;
SetDataForType;
class BrowsingDataModelBrowserTest
: public MixinBasedInProcessBrowserTest,
public ::testing::WithParamInterface<bool> { … };
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
SharedStorageHandledCorrectly) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
SharedStorageAccessReportedCorrectly) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest, TrustTokenIssuance) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
InterestGroupsHandledCorrectly) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
InterestGroupsAccessReportedCorrectly) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
AuctionWinReportedCorrectly) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
AttributionReportingAccessReportedCorrectly) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
PrivateAggregationHandledCorrectly) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
TopicsAccessReportedCorrectly) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
IsolatedWebAppUsageInDefaultStoragePartitionModel) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
QuotaStorageHandledCorrectly) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
LocalStorageHandledCorrectly) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
LocalStorageAccessReportedCorrectly) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
SessionStorageAccessReportedCorrectly) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
QuotaStorageAccessReportedCorrectly) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
SharedWorkerAccessReportedCorrectly) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
LocalStorageRemovedBasedOnPartition) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
SharedDictionaryHandledCorrectly) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
SharedDictionaryAccessReportedCorrectly) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
SharedDictionaryAccessForNavigationReportedCorrectly) { … }
IN_PROC_BROWSER_TEST_F(
BrowsingDataModelBrowserTest,
SharedDictionaryAccessForIframeNavigationReportedCorrectly) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest, CookiesHandledCorrectly) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
CookiesAccessReportedCorrectly) { … }
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
FederatedIdentityHandledCorrectly) { … }
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
IN_PROC_BROWSER_TEST_F(BrowsingDataModelBrowserTest,
CdmStorageHandledCorrectly) { … }
#endif