Skip to content

Commit

Permalink
Merge pull request #4511 from brave/cosmetic-filtering-on-by-default
Browse files Browse the repository at this point in the history
Enable cosmetic filtering by default
  • Loading branch information
petemill authored Feb 14, 2020
2 parents 31f37c1 + f2ad715 commit e7cb37e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
21 changes: 10 additions & 11 deletions components/brave_shields/browser/ad_block_service_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -788,19 +788,18 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, RedirectRulesAreRespected) {
EXPECT_EQ(browser()->profile()->GetPrefs()->GetUint64(kAdsBlocked), 1ULL);
}

class CosmeticFilteringEnabledTest : public AdBlockServiceTest {
class CosmeticFilteringDisabledTest : public AdBlockServiceTest {
public:
CosmeticFilteringEnabledTest() {
feature_list_.InitAndEnableFeature(kBraveAdblockCosmeticFiltering);
CosmeticFilteringDisabledTest() {
feature_list_.InitAndDisableFeature(kBraveAdblockCosmeticFiltering);
}

private:
base::test::ScopedFeatureList feature_list_;
};

// Ensure no cosmetic filtering occurs when the feature flag has not been
// enabled
IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CosmeticFilteringSimple) {
// Ensure no cosmetic filtering occurs when the feature flag is disabled
IN_PROC_BROWSER_TEST_F(CosmeticFilteringDisabledTest, CosmeticFilteringSimple) {
UpdateAdBlockInstanceWithRules(
"b.com###ad-banner\n"
"##.ad");
Expand Down Expand Up @@ -837,7 +836,7 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CosmeticFilteringSimple) {
}

// Test simple cosmetic filtering
IN_PROC_BROWSER_TEST_F(CosmeticFilteringEnabledTest, CosmeticFilteringSimple) {
IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CosmeticFilteringSimple) {
UpdateAdBlockInstanceWithRules(
"b.com###ad-banner\n"
"##.ad");
Expand Down Expand Up @@ -874,7 +873,7 @@ IN_PROC_BROWSER_TEST_F(CosmeticFilteringEnabledTest, CosmeticFilteringSimple) {
}

// Test cosmetic filtering ignores content determined to be 1st party
IN_PROC_BROWSER_TEST_F(CosmeticFilteringEnabledTest,
IN_PROC_BROWSER_TEST_F(AdBlockServiceTest,
CosmeticFilteringProtect1p) {
UpdateAdBlockInstanceWithRules("b.com##.fpsponsored\n");

Expand All @@ -896,7 +895,7 @@ IN_PROC_BROWSER_TEST_F(CosmeticFilteringEnabledTest,
}

// Test cosmetic filtering on elements added dynamically
IN_PROC_BROWSER_TEST_F(CosmeticFilteringEnabledTest, CosmeticFilteringDynamic) {
IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CosmeticFilteringDynamic) {
UpdateAdBlockInstanceWithRules("##.blockme");

WaitForBraveExtensionShieldsDataReady();
Expand Down Expand Up @@ -925,7 +924,7 @@ IN_PROC_BROWSER_TEST_F(CosmeticFilteringEnabledTest, CosmeticFilteringDynamic) {
}

// Test custom style rules
IN_PROC_BROWSER_TEST_F(CosmeticFilteringEnabledTest,
IN_PROC_BROWSER_TEST_F(AdBlockServiceTest,
CosmeticFilteringCustomStyle) {
UpdateAdBlockInstanceWithRules("b.com##.ad:style(padding-bottom: 10px)");

Expand All @@ -947,7 +946,7 @@ IN_PROC_BROWSER_TEST_F(CosmeticFilteringEnabledTest,
}

// Test rules overridden by hostname-specific exception rules
IN_PROC_BROWSER_TEST_F(CosmeticFilteringEnabledTest, CosmeticFilteringUnhide) {
IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, CosmeticFilteringUnhide) {
UpdateAdBlockInstanceWithRules(
"##.ad\n"
"b.com#@#.ad\n"
Expand Down
2 changes: 1 addition & 1 deletion components/brave_shields/common/features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace features {

const base::Feature kBraveAdblockCosmeticFiltering{
"BraveAdblockCosmeticFiltering",
base::FEATURE_DISABLED_BY_DEFAULT};
base::FEATURE_ENABLED_BY_DEFAULT};

} // namespace features
} // namespace brave_shields

0 comments on commit e7cb37e

Please sign in to comment.