Skip to content

Commit

Permalink
Added test.
Browse files Browse the repository at this point in the history
  • Loading branch information
boocmp committed Sep 23, 2024
1 parent a034f73 commit 107800e
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions browser/brave_shields/ad_block_service_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "brave/components/constants/pref_names.h"
#include "brave/components/de_amp/common/pref_names.h"
#include "brave/components/playlist/common/buildflags/buildflags.h"
#include "brave/components/speedreader/common/buildflags/buildflags.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
Expand Down Expand Up @@ -73,6 +74,12 @@
#include "brave/components/playlist/common/features.h"
#endif

#if BUILDFLAG(ENABLE_SPEEDREADER) && !BUILDFLAG(IS_ANDROID)
#include "brave/browser/speedreader/speedreader_service_factory.h"
#include "brave/components/speedreader/speedreader_service.h"
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
#endif

const char kAdBlockTestPage[] = "/blocking.html";

const char kAdBlockEasyListFranceUUID[] =
Expand Down Expand Up @@ -3170,3 +3177,25 @@ IN_PROC_BROWSER_TEST_F(AdBlockServiceTestJsPerformance,
EvalJs(iframe, "checkSelector('.div-class-499', 'display', 'block')")
.ExtractBool());
}

#if BUILDFLAG(ENABLE_SPEEDREADER) && !BUILDFLAG(IS_ANDROID)
IN_PROC_BROWSER_TEST_F(AdBlockServiceTest, NoCosmeticFiltersOnSpeedreaderPage) {
UpdateAdBlockInstanceWithRules(
"##body,html:style(overflow: auto !important;");

auto* speedreader_service =
speedreader::SpeedreaderServiceFactory::GetForBrowserContext(
browser()->profile());
speedreader_service->EnableForAllSites(true);
const GURL url = embedded_test_server()->GetURL(
"a.com", "/speedreader/article/simple.html");
NavigateToURL(url);

const auto& web_prefs = web_contents()->GetOrCreateWebPreferences();
EXPECT_TRUE(web_prefs.page_in_reader_mode);

EXPECT_EQ("visible",
EvalJs(web_contents(), "getComputedStyle(document.body).overflow")
.ExtractString());
}
#endif

0 comments on commit 107800e

Please sign in to comment.