summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorrogerta@google.com <rogerta@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-13 18:21:43 +0000
committerrogerta@google.com <rogerta@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-13 18:21:43 +0000
commit0bb04791d56dd2fa075dce1e22c29261fe8e9ae4 (patch)
tree397550d764964b843c354b971fe5a21574a75ec9 /chrome
parentf5f13f5cd6638bd73769942e6c6c873d89d6357b (diff)
downloadchromium_src-0bb04791d56dd2fa075dce1e22c29261fe8e9ae4.zip
chromium_src-0bb04791d56dd2fa075dce1e22c29261fe8e9ae4.tar.gz
chromium_src-0bb04791d56dd2fa075dce1e22c29261fe8e9ae4.tar.bz2
I had written unit tests for the change to add a runtime id to Profiles, but
I forgot to include those tests in the CL (255087). So here they are. BUG=0 TEST=this change includes only tests for existing code Review URL: http://codereview.chromium.org/273006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28846 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/renderer_host/test/site_instance_unittest.cc51
1 files changed, 51 insertions, 0 deletions
diff --git a/chrome/browser/renderer_host/test/site_instance_unittest.cc b/chrome/browser/renderer_host/test/site_instance_unittest.cc
index 8f0b894..af6e5a3 100644
--- a/chrome/browser/renderer_host/test/site_instance_unittest.cc
+++ b/chrome/browser/renderer_host/test/site_instance_unittest.cc
@@ -458,3 +458,54 @@ TEST_F(SiteInstanceTest, ProcessSharingByType) {
STLDeleteContainerPointers(hosts.begin(), hosts.end());
}
+
+// Test to ensure that profiles that derive from each other share site
+// information.
+TEST_F(SiteInstanceTest, GetSiteInstanceMap) {
+ int deleteCounter = 0;
+
+ scoped_ptr<Profile> p1(new TestingProfile());
+ scoped_ptr<Profile> p2(new TestingProfile());
+ scoped_ptr<Profile> p3(new DerivedTestingProfile(p1.get()));
+
+ TestBrowsingInstance* instance1(new TestBrowsingInstance(p1.get(),
+ &deleteCounter));
+ TestBrowsingInstance* instance2(new TestBrowsingInstance(p2.get(),
+ &deleteCounter));
+ TestBrowsingInstance* instance3(new TestBrowsingInstance(p3.get(),
+ &deleteCounter));
+
+ instance1->use_process_per_site = true;
+ instance2->use_process_per_site = true;
+ instance3->use_process_per_site = true;
+
+ // The same profile with the same site.
+ EXPECT_EQ(
+ instance1->GetSiteInstanceForURL(GURL("chrome-extension://baz/bar")),
+ instance1->GetSiteInstanceForURL(GURL("chrome-extension://baz/bar")));
+
+ // The same profile with different sites.
+ EXPECT_NE(
+ instance1->GetSiteInstanceForURL(GURL("chrome-extension://baz/bar")),
+ instance1->GetSiteInstanceForURL(GURL("chrome-extension://foo/boo")));
+
+ // The different profiles with the same site.
+ EXPECT_NE(
+ instance1->GetSiteInstanceForURL(GURL("chrome-extension://baz/bar")),
+ instance2->GetSiteInstanceForURL(GURL("chrome-extension://baz/bar")));
+
+ // The different profiles with different sites.
+ EXPECT_NE(
+ instance1->GetSiteInstanceForURL(GURL("chrome-extension://baz/bar")),
+ instance2->GetSiteInstanceForURL(GURL("chrome-extension://foo/boo")));
+
+ // The dervived profiles with the same site.
+ EXPECT_EQ(
+ instance1->GetSiteInstanceForURL(GURL("chrome-extension://baz/bar")),
+ instance3->GetSiteInstanceForURL(GURL("chrome-extension://baz/bar")));
+
+ // The dervived profiles with the different sites.
+ EXPECT_NE(
+ instance1->GetSiteInstanceForURL(GURL("chrome-extension://baz/bar")),
+ instance3->GetSiteInstanceForURL(GURL("chrome-extension://foo/boo")));
+}