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

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: engedy review Created 3 years, 8 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..974cae9a8d4f2770fce5a58c79d4ce31412616b1 100644
--- a/chrome/browser/subresource_filter/subresource_filter_browsertest.cc
+++ b/chrome/browser/subresource_filter/subresource_filter_browsertest.cc
@@ -549,6 +549,35 @@ IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest, SubFrameActivation) {
}
IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest,
+ SubframeDocumentLoadFiltering) {
+ GURL url(GetTestUrl(kTestFrameSetPath));
+ ConfigureAsPhishingURL(url);
+
+ // Disallow all the subframes that end up loading included_script.js.
+ ASSERT_NO_FATAL_FAILURE(
+ SetRulesetToDisallowURLsWithPathSuffix("included_script.html"));
+ base::HistogramTester tester;
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ const std::vector<const char*> kSubframeNames{"one", "two", "three"};
+ const std::vector<bool> kExpectScriptInFrameToLoad{false, true, false};
+ ASSERT_NO_FATAL_FAILURE(ExpectParsedScriptElementLoadedStatusInFrames(
+ kSubframeNames, kExpectScriptInFrameToLoad));
+
+ // The subframe navigations never commit.
+ for (size_t i = 0; i < kSubframeNames.size(); ++i) {
+ const char* subframe_name = kSubframeNames[i];
+ bool expect_loaded = kExpectScriptInFrameToLoad[i];
+ content::RenderFrameHost* frame = FindFrameByName(subframe_name);
+ if (!expect_loaded)
+ EXPECT_EQ(GURL(), frame->GetLastCommittedURL());
+ }
+
+ tester.ExpectBucketCount(kSubresourceFilterActionsHistogram, kActionUIShown,
+ 1);
+}
+
+IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest,
HistoryNavigationActivation) {
GURL url_with_activation(GetTestUrl(kTestFrameSetPath));
GURL url_without_activation(
@@ -1007,8 +1036,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 = 5 + 5 + 1;
+ 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