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

Unified Diff: components/subresource_filter/content/browser/subframe_navigation_filtering_throttle_unittest.cc

Issue 2632633006: Implement NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE. (Closed)
Patch Set: Rebase. Created 3 years, 7 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: components/subresource_filter/content/browser/subframe_navigation_filtering_throttle_unittest.cc
diff --git a/components/subresource_filter/content/browser/subframe_navigation_filtering_throttle_unittest.cc b/components/subresource_filter/content/browser/subframe_navigation_filtering_throttle_unittest.cc
index 71a590963eecba369f8e45737b22cd27c9c061a8..eeb687726313983955b6d14f49cc8481217a5eee 100644
--- a/components/subresource_filter/content/browser/subframe_navigation_filtering_throttle_unittest.cc
+++ b/components/subresource_filter/content/browser/subframe_navigation_filtering_throttle_unittest.cc
@@ -18,6 +18,7 @@
#include "components/subresource_filter/core/common/test_ruleset_creator.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents_observer.h"
+#include "content/public/common/browser_side_navigation_policy.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/test_renderer_host.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -137,7 +138,8 @@ TEST_F(SubframeNavigationFilteringThrottleTest, FilterOnStart) {
InitializeDocumentSubresourceFilter(GURL("https://example.test"));
CreateTestSubframeAndInitNavigation(
GURL("https://example.test/disallowed.html"), main_rfh());
- SimulateStartAndExpectResult(content::NavigationThrottle::CANCEL);
+ SimulateStartAndExpectResult(
+ content::NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE);
}
TEST_F(SubframeNavigationFilteringThrottleTest, FilterOnRedirect) {
@@ -146,8 +148,12 @@ TEST_F(SubframeNavigationFilteringThrottleTest, FilterOnRedirect) {
main_rfh());
SimulateStartAndExpectResult(content::NavigationThrottle::PROCEED);
+ content::NavigationThrottle::ThrottleCheckResult expected_result =
+ content::IsBrowserSideNavigationEnabled()
+ ? content::NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE
+ : content::NavigationThrottle::CANCEL;
SimulateRedirectAndExpectResult(GURL("https://example.test/disallowed.html"),
- content::NavigationThrottle::CANCEL);
+ expected_result);
}
TEST_F(SubframeNavigationFilteringThrottleTest, FilterOnSecondRedirect) {
@@ -158,8 +164,12 @@ TEST_F(SubframeNavigationFilteringThrottleTest, FilterOnSecondRedirect) {
SimulateStartAndExpectResult(content::NavigationThrottle::PROCEED);
SimulateRedirectAndExpectResult(GURL("https://example.test/allowed2.html"),
content::NavigationThrottle::PROCEED);
+ content::NavigationThrottle::ThrottleCheckResult expected_result =
+ content::IsBrowserSideNavigationEnabled()
+ ? content::NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE
+ : content::NavigationThrottle::CANCEL;
SimulateRedirectAndExpectResult(GURL("https://example.test/disallowed.html"),
- content::NavigationThrottle::CANCEL);
+ expected_result);
}
TEST_F(SubframeNavigationFilteringThrottleTest, NeverFilterNonMatchingRule) {
@@ -187,7 +197,8 @@ TEST_F(SubframeNavigationFilteringThrottleTest, FilterSubsubframe) {
CreateTestSubframeAndInitNavigation(
GURL("https://example.test/disallowed.html"), parent_subframe);
- SimulateStartAndExpectResult(content::NavigationThrottle::CANCEL);
+ SimulateStartAndExpectResult(
+ content::NavigationThrottle::BLOCK_REQUEST_AND_COLLAPSE);
}
} // namespace subresource_filter

Powered by Google App Engine
This is Rietveld 408576698