#include "components/subresource_filter/core/common/ruleset_dealer.h"
#include <memory>
#include <vector>
#include "base/files/file.h"
#include "components/subresource_filter/core/common/memory_mapped_ruleset.h"
#include "components/subresource_filter/core/common/test_ruleset_creator.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace subresource_filter {
namespace {
const char kTestRulesetSuffix1[] = …;
const char kTestRulesetSuffix2[] = …;
std::vector<uint8_t> ReadRulesetContents(const MemoryMappedRuleset* ruleset) { … }
}
class SubresourceFilterRulesetDealerTest : public ::testing::Test { … };
TEST_F(SubresourceFilterRulesetDealerTest, NoRuleset) { … }
TEST_F(SubresourceFilterRulesetDealerTest, MostRecentlySetRulesetIsReturned) { … }
TEST_F(SubresourceFilterRulesetDealerTest,
MemoryMappedRulesetIsCachedAndReused) { … }
TEST_F(SubresourceFilterRulesetDealerTest, RulesetIsMemoryMappedLazily) { … }
TEST_F(SubresourceFilterRulesetDealerTest, RulesetIsUnmappedEagerly) { … }
TEST_F(SubresourceFilterRulesetDealerTest, RulesetIsUnmappedAndRemapped) { … }
TEST_F(SubresourceFilterRulesetDealerTest, NewRulesetIsMappedLazilyOnUpdate) { … }
TEST_F(SubresourceFilterRulesetDealerTest,
NewRulesetRemainsCachedAfterOldRulesetIsUnmapped) { … }
TEST_F(SubresourceFilterRulesetDealerTest,
RulesetDealerDestroyedBeforeRuleset) { … }
TEST_F(SubresourceFilterRulesetDealerTest, MmapFailure) { … }
}