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

Unified Diff: content/browser/browser_side_navigation_browsertest.cc

Issue 1917073002: Block webpages from navigating to view-source URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add layout and browser tests Created 4 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: content/browser/browser_side_navigation_browsertest.cc
diff --git a/content/browser/browser_side_navigation_browsertest.cc b/content/browser/browser_side_navigation_browsertest.cc
index 96a2cb91a02bbe181ee4373ce24aa069673ebdd7..3b7881ff1a9760d286c56c8690b99def55627649 100644
--- a/content/browser/browser_side_navigation_browsertest.cc
+++ b/content/browser/browser_side_navigation_browsertest.cc
@@ -11,6 +11,7 @@
#include "content/common/site_isolation_policy.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_switches.h"
+#include "content/public/common/url_constants.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
@@ -228,4 +229,15 @@ IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, POSTNavigation) {
->GetHasPostData());
}
+// Ensure that browser side navigation handles view-source URLs correctly.
+IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, ViewSourceNavigation) {
+ TestNavigationObserver observer(shell()->web_contents());
+ GURL url(embedded_test_server()->GetURL("/title1.html"));
+ GURL view_source_url(content::kViewSourceScheme + std::string(":") +
+ url.spec());
+ NavigateToURL(shell(), view_source_url);
+ EXPECT_EQ(url, observer.last_navigation_url());
+ EXPECT_TRUE(observer.last_navigation_succeeded());
+}
Charlie Reis 2016/05/24 22:54:16 Thanks for proactively testing the PlzNavigate cas
meacer 2016/05/31 23:57:54 Done.
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698