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

Unified Diff: content/browser/child_process_security_policy_unittest.cc

Issue 7068007: Revise about: and chrome: url handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update special_tabs.py from Nirnimesh's codereview.chromium.org/6995057/. Created 9 years, 6 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 | « chrome/test/functional/special_tabs.py ('k') | content/browser/site_instance.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/child_process_security_policy_unittest.cc
diff --git a/content/browser/child_process_security_policy_unittest.cc b/content/browser/child_process_security_policy_unittest.cc
index f1f214c45c5b01069dd6f87d142ef47e4fd0c5b2..4ef3306e8aee18a28c7b6892a28582db72e3e00b 100644
--- a/content/browser/child_process_security_policy_unittest.cc
+++ b/content/browser/child_process_security_policy_unittest.cc
@@ -45,6 +45,8 @@ TEST_F(ChildProcessSecurityPolicyTest, IsWebSafeSchemeTest) {
EXPECT_FALSE(p->IsWebSafeScheme("registered-web-safe-scheme"));
p->RegisterWebSafeScheme("registered-web-safe-scheme");
EXPECT_TRUE(p->IsWebSafeScheme("registered-web-safe-scheme"));
+
+ EXPECT_FALSE(p->IsWebSafeScheme(chrome::kChromeUIScheme));
}
TEST_F(ChildProcessSecurityPolicyTest, IsPseudoSchemeTest) {
@@ -57,6 +59,8 @@ TEST_F(ChildProcessSecurityPolicyTest, IsPseudoSchemeTest) {
EXPECT_FALSE(p->IsPseudoScheme("registered-pseudo-scheme"));
p->RegisterPseudoScheme("registered-pseudo-scheme");
EXPECT_TRUE(p->IsPseudoScheme("registered-pseudo-scheme"));
+
+ EXPECT_FALSE(p->IsPseudoScheme(chrome::kChromeUIScheme));
}
TEST_F(ChildProcessSecurityPolicyTest, IsDisabledSchemeTest) {
@@ -119,6 +123,7 @@ TEST_F(ChildProcessSecurityPolicyTest, AboutTest) {
EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("about:CrASh")));
EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("abOuT:cAChe")));
+ // These requests for about: pages should be denied.
p->GrantRequestURL(kRendererID, GURL(chrome::kTestMemoryURL));
EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL(chrome::kTestMemoryURL)));
@@ -131,6 +136,16 @@ TEST_F(ChildProcessSecurityPolicyTest, AboutTest) {
p->GrantRequestURL(kRendererID, GURL(chrome::kTestHangURL));
EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL(chrome::kTestHangURL)));
+ // These requests for chrome:// pages should be granted.
+ p->GrantRequestURL(kRendererID, GURL(chrome::kTestNewTabURL));
+ EXPECT_TRUE(p->CanRequestURL(kRendererID, GURL(chrome::kTestNewTabURL)));
+
+ p->GrantRequestURL(kRendererID, GURL(chrome::kTestHistoryURL));
+ EXPECT_TRUE(p->CanRequestURL(kRendererID, GURL(chrome::kTestHistoryURL)));
+
+ p->GrantRequestURL(kRendererID, GURL(chrome::kTestBookmarksURL));
+ EXPECT_TRUE(p->CanRequestURL(kRendererID, GURL(chrome::kTestBookmarksURL)));
+
p->Remove(kRendererID);
}
« no previous file with comments | « chrome/test/functional/special_tabs.py ('k') | content/browser/site_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698