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

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

Issue 2843153002: [subresource_filter] Add browser test verifying cancel behavior (Closed)
Patch Set: fix silly typo 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 61e93674f650ec1f7ab7e28416e58eaf3002a530..273ad8bab8a3fd3986f54237ae7ae96fc3d4ae1c 100644
--- a/chrome/browser/subresource_filter/subresource_filter_browsertest.cc
+++ b/chrome/browser/subresource_filter/subresource_filter_browsertest.cc
@@ -29,6 +29,8 @@
#include "chrome/browser/subresource_filter/test_ruleset_publisher.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
+#include "chrome/browser/ui/browser_navigator.h"
+#include "chrome/browser/ui/browser_navigator_params.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
@@ -692,6 +694,41 @@ IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest,
EXPECT_FALSE(WasParsedScriptElementLoaded(dynamic_frame));
}
+// If a navigation starts but aborts before commit, page level activation should
+// remain unchanged.
+IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest,
+ PageLevelActivationOutlivesAbortedNavigation) {
+ GURL url(GetTestUrl(kTestFrameSetPath));
+ ConfigureAsPhishingURL(url);
+ ASSERT_NO_FATAL_FAILURE(
+ SetRulesetToDisallowURLsWithPathSuffix("included_script.js"));
+ ui_test_utils::NavigateToURL(browser(), url);
+
+ content::RenderFrameHost* frame = FindFrameByName("one");
+ EXPECT_FALSE(WasParsedScriptElementLoaded(frame));
+
+ // Start a new navigation, but abort it right away.
+ GURL aborted_url = GURL("https://abort-me.com");
+ content::TestNavigationManager manager(
+ browser()->tab_strip_model()->GetActiveWebContents(), aborted_url);
+
+ chrome::NavigateParams params(browser(), aborted_url,
+ ui::PAGE_TRANSITION_LINK);
+ chrome::Navigate(&params);
+ ASSERT_TRUE(manager.WaitForRequestStart());
+ browser()->tab_strip_model()->GetActiveWebContents()->Stop();
+
+ // Will return false if the navigation was successfully aborted.
+ ASSERT_FALSE(manager.WaitForResponse());
+ manager.WaitForNavigationFinished();
+
+ // Now, dynamically insert a frame and expect that it is still activated.
+ ASSERT_NO_FATAL_FAILURE(InsertDynamicFrameWithScript());
+ content::RenderFrameHost* dynamic_frame = FindFrameByName("dynamic");
+ ASSERT_TRUE(dynamic_frame);
+ EXPECT_FALSE(WasParsedScriptElementLoaded(dynamic_frame));
+}
+
IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest, DynamicFrame) {
GURL url(GetTestUrl("subresource_filter/frame_set.html"));
ConfigureAsPhishingURL(url);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698