#include "components/fingerprinting_protection_filter/renderer/renderer_agent.h"
#include <memory>
#include <string_view>
#include <utility>
#include "base/files/file.h"
#include "base/time/time.h"
#include "components/fingerprinting_protection_filter/renderer/unverified_ruleset_dealer.h"
#include "components/subresource_filter/core/common/memory_mapped_ruleset.h"
#include "components/subresource_filter/core/common/test_ruleset_creator.h"
#include "components/subresource_filter/core/mojom/subresource_filter.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/web_document_subresource_filter.h"
#include "third_party/blink/public/platform/web_url.h"
#include "third_party/blink/public/platform/web_url_error.h"
#include "third_party/blink/public/platform/web_url_request.h"
#include "url/gurl.h"
namespace fingerprinting_protection_filter {
namespace {
class RendererAgentUnderTest : public RendererAgent { … };
constexpr const char kTestFirstURL[] = …;
constexpr const char kTestSecondURL[] = …;
constexpr const char kTestFirstURLPathSuffix[] = …;
constexpr const char kTestSecondURLPathSuffix[] = …;
constexpr const char kTestBothURLsPathSuffix[] = …;
}
class RendererAgentTest : public ::testing::Test { … };
TEST_F(RendererAgentTest, RulesetUnset_RulesetNotAvailable) { … }
TEST_F(RendererAgentTest, DisabledByDefault_NoFilterIsInjected) { … }
TEST_F(RendererAgentTest, MmapFailure_FailsToInjectFilter) { … }
TEST_F(RendererAgentTest, Disabled_NoFilterIsInjected) { … }
TEST_F(RendererAgentTest, EnabledButRulesetUnavailable_NoFilterIsInjected) { … }
TEST_F(RendererAgentTest, EmptyDocumentLoad_NoFilterIsInjected) { … }
TEST_F(RendererAgentTest, Enabled_FilteringIsInEffectForOneLoad) { … }
TEST_F(RendererAgentTest, Enabled_NewRulesetIsPickedUpAtNextLoad) { … }
TEST_F(RendererAgentTest,
Enabled_FilteringNoLongerActiveAfterProvisionalLoadIsCancelled) { … }
TEST_F(RendererAgentTest, DryRun_ResourcesAreEvaluatedButNotFiltered) { … }
TEST_F(RendererAgentTest,
SignalFirstSubresourceDisallowed_OncePerDocumentLoad) { … }
TEST_F(RendererAgentTest,
SignalFirstSubresourceDisallowed_ComesAfterAgentDestroyed) { … }
TEST_F(RendererAgentTest,
FailedInitialLoad_FilterInjectedOnInitialDocumentCreation) { … }
TEST_F(RendererAgentTest,
FailedInitialMainFrameLoad_FilterInjectedOnInitialDocumentCreation) { … }
}