#include "chrome/browser/top_level_storage_access_api/top_level_storage_access_permission_context.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/test_future.h"
#include "base/version.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/first_party_sets/scoped_mock_first_party_sets_handler.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/permissions/permission_request_id.h"
#include "components/permissions/permission_request_manager.h"
#include "components/permissions/permission_util.h"
#include "components/permissions/test/mock_permission_prompt_factory.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_features.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/web_contents_tester.h"
#include "net/base/schemeful_site.h"
#include "net/first_party_sets/first_party_set_entry.h"
#include "net/first_party_sets/global_first_party_sets.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features_generated.h"
namespace {
Contains;
Each;
PermissionStatus;
constexpr char kRequestOutcomeHistogram[] = …;
MATCHER_P(DecidedByRelatedWebsiteSets, inner, "") { … }
GURL GetTopLevelURL() { … }
GURL GetRequesterURL() { … }
GURL GetDummyEmbeddingUrl() { … }
}
class TopLevelStorageAccessPermissionContextTest
: public ChromeRenderViewHostTestHarness { … };
TEST_F(TopLevelStorageAccessPermissionContextTest,
InsecureOriginsAreDisallowed) { … }
TEST_F(TopLevelStorageAccessPermissionContextTest,
PermissionDeniedWithoutUserGesture) { … }
TEST_F(TopLevelStorageAccessPermissionContextTest,
PermissionStatusAsksWhenFeatureEnabled) { … }
TEST_F(TopLevelStorageAccessPermissionContextTest,
ImplicitGrant_DenialQueryStillAsk) { … }
class TopLevelStorageAccessPermissionContextAPIWithFirstPartySetsTest
: public TopLevelStorageAccessPermissionContextTest { … };
TEST_F(TopLevelStorageAccessPermissionContextAPIWithFirstPartySetsTest,
ImplicitGrant_AutograntedWithinFPS) { … }
TEST_F(TopLevelStorageAccessPermissionContextAPIWithFirstPartySetsTest,
ImplicitGrant_CrossSiteFrameQueryStillAsk) { … }
TEST_F(TopLevelStorageAccessPermissionContextAPIWithFirstPartySetsTest,
ImplicitGrant_AutodeniedOutsideFPS) { … }
TEST_F(TopLevelStorageAccessPermissionContextAPIWithFirstPartySetsTest,
ImplicitGrant_DenialQueryStillAsk) { … }