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

Unified Diff: chrome/browser/site_instance_unittest.cc

Issue 12451: Don't create separate SiteInstances for pages from the same domain and scheme... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 1 month 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/browser/site_instance.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/site_instance_unittest.cc
===================================================================
--- chrome/browser/site_instance_unittest.cc (revision 6002)
+++ chrome/browser/site_instance_unittest.cc (working copy)
@@ -202,13 +202,15 @@
// Test to ensure GetSiteForURL properly returns sites for URLs.
TEST_F(SiteInstanceTest, GetSiteForURL) {
+ // Pages are irrelevant.
GURL test_url = GURL("http://www.google.com/index.html");
EXPECT_EQ(GURL("http://google.com"), SiteInstance::GetSiteForURL(test_url));
+ // Ports are irrlevant.
test_url = GURL("https://www.google.com:8080");
- EXPECT_EQ(GURL("https://google.com:8080"),
- SiteInstance::GetSiteForURL(test_url));
+ EXPECT_EQ(GURL("https://google.com"), SiteInstance::GetSiteForURL(test_url));
+ // Javascript URLs have no site.
test_url = GURL("javascript:foo();");
EXPECT_EQ(GURL::EmptyGURL(), SiteInstance::GetSiteForURL(test_url));
@@ -238,10 +240,16 @@
GURL url_hang = GURL("about:hang");
GURL url_shorthang = GURL("about:shorthang");
+ // Same scheme and port -> same site.
EXPECT_TRUE(SiteInstance::IsSameWebSite(url_foo, url_foo2));
+
+ // Different scheme -> different site.
EXPECT_FALSE(SiteInstance::IsSameWebSite(url_foo, url_foo_https));
- EXPECT_FALSE(SiteInstance::IsSameWebSite(url_foo, url_foo_port));
+ // Different port -> same site.
+ // (Changes to document.domain make renderer ignore the port.)
+ EXPECT_TRUE(SiteInstance::IsSameWebSite(url_foo, url_foo_port));
+
// JavaScript links should be considered same site for anything.
EXPECT_TRUE(SiteInstance::IsSameWebSite(url_javascript, url_foo));
EXPECT_TRUE(SiteInstance::IsSameWebSite(url_javascript, url_foo_https));
« no previous file with comments | « chrome/browser/site_instance.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698