Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Unified Diff: chrome/browser/subresource_filter/subresource_filter_browsertest.cc

Issue 2762403002: Wire up the ThrottleManager using the existing page activation logic (Closed)
Patch Set: small tweaks Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/subresource_filter/subresource_filter_browsertest.cc
diff --git a/chrome/browser/subresource_filter/subresource_filter_browsertest.cc b/chrome/browser/subresource_filter/subresource_filter_browsertest.cc
index 718ac828c89d5f6793888ab06b77444429b41be1..1f7b7e6df730c51b77c19cde3ec9d5de44fbb5dc 100644
--- a/chrome/browser/subresource_filter/subresource_filter_browsertest.cc
+++ b/chrome/browser/subresource_filter/subresource_filter_browsertest.cc
@@ -548,6 +548,32 @@ IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest, SubFrameActivation) {
1);
}
+IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest, SubFrameFiltering) {
+ GURL url(GetTestUrl(kTestFrameSetPath));
+ ConfigureAsPhishingURL(url);
+
+ // Disallow all the subframes.
+ ASSERT_NO_FATAL_FAILURE(SetRulesetToDisallowURLsWithPathSuffix(".html"));
+ base::HistogramTester tester;
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ const std::vector<const char*> kSubframeNames{"one", "two", "three", "four",
+ "five"};
+ const std::vector<bool> kExpectScriptInFrameToLoad{false, false, false, false,
+ false};
+ ASSERT_NO_FATAL_FAILURE(ExpectParsedScriptElementLoadedStatusInFrames(
+ kSubframeNames, kExpectScriptInFrameToLoad));
+
+ // The subframe navigations never commit.
+ for (const auto* it : kSubframeNames) {
+ content::RenderFrameHost* frame = FindFrameByName(it);
+ EXPECT_EQ(GURL(), frame->GetLastCommittedURL());
+ }
+
+ tester.ExpectBucketCount(kSubresourceFilterActionsHistogram, kActionUIShown,
+ 1);
+}
+
IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest,
HistoryNavigationActivation) {
GURL url_with_activation(GetTestUrl(kTestFrameSetPath));
@@ -1007,8 +1033,12 @@ void ExpectHistogramsAreRecordedForTestFrameSet(
tester.ExpectTotalCount(kEvaluationTotalCPUDurationForDocument,
time_recorded ? 6 : 0);
- tester.ExpectTotalCount(kEvaluationWallDuration, time_recorded ? 6 : 0);
- tester.ExpectTotalCount(kEvaluationCPUDuration, time_recorded ? 6 : 0);
+ // 5 subframes, each with an include.js, plus a top level include.js.
+ int num_subresource_checks = 6 + 5;
+ tester.ExpectTotalCount(kEvaluationWallDuration,
+ time_recorded ? num_subresource_checks : 0);
+ tester.ExpectTotalCount(kEvaluationCPUDuration,
+ time_recorded ? num_subresource_checks : 0);
// Activation timing histograms are always recorded.
tester.ExpectTotalCount(kActivationWallDuration, 6);

Powered by Google App Engine
This is Rietveld 408576698