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); |