summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorrogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-14 17:56:30 +0000
committerrogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-14 17:56:30 +0000
commitb7d015a9eac961615877ece6ff80e82e520ef225 (patch)
treee03577a82aeb320cbfb755e5daae0844f9107f93 /chrome
parent9d15e827d53a4c8b90e986ea67afff15a25476b2 (diff)
downloadchromium_src-b7d015a9eac961615877ece6ff80e82e520ef225.zip
chromium_src-b7d015a9eac961615877ece6ff80e82e520ef225.tar.gz
chromium_src-b7d015a9eac961615877ece6ff80e82e520ef225.tar.bz2
Fix for memory leak in unit test. The test used to leak SiteInstance object
returned from GetSiteInstanceForURL(). BUG=24769 TEST=None Review URL: http://codereview.chromium.org/271088 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28982 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/renderer_host/test/site_instance_unittest.cc56
1 files changed, 34 insertions, 22 deletions
diff --git a/chrome/browser/renderer_host/test/site_instance_unittest.cc b/chrome/browser/renderer_host/test/site_instance_unittest.cc
index af6e5a3..5791ee0 100644
--- a/chrome/browser/renderer_host/test/site_instance_unittest.cc
+++ b/chrome/browser/renderer_host/test/site_instance_unittest.cc
@@ -480,32 +480,44 @@ TEST_F(SiteInstanceTest, GetSiteInstanceMap) {
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")));
+ scoped_refptr<SiteInstance> s1a(instance1->GetSiteInstanceForURL(
+ GURL("chrome-extension://baz/bar")));
+ scoped_refptr<SiteInstance> s1b(instance1->GetSiteInstanceForURL(
+ GURL("chrome-extension://baz/bar")));
+ EXPECT_EQ(s1a, s1b);
// The same profile with different sites.
- EXPECT_NE(
- instance1->GetSiteInstanceForURL(GURL("chrome-extension://baz/bar")),
- instance1->GetSiteInstanceForURL(GURL("chrome-extension://foo/boo")));
+ scoped_refptr<SiteInstance> s2a(instance1->GetSiteInstanceForURL(
+ GURL("chrome-extension://baz/bar")));
+ scoped_refptr<SiteInstance> s2b(instance1->GetSiteInstanceForURL(
+ GURL("chrome-extension://foo/boo")));
+ EXPECT_NE(s2a, s2b);
// The different profiles with the same site.
- EXPECT_NE(
- instance1->GetSiteInstanceForURL(GURL("chrome-extension://baz/bar")),
- instance2->GetSiteInstanceForURL(GURL("chrome-extension://baz/bar")));
+ scoped_refptr<SiteInstance> s3a(instance1->GetSiteInstanceForURL(
+ GURL("chrome-extension://baz/bar")));
+ scoped_refptr<SiteInstance> s3b(instance2->GetSiteInstanceForURL(
+ GURL("chrome-extension://baz/bar")));
+ EXPECT_NE(s3a, s3b);
// 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")));
+ scoped_refptr<SiteInstance> s4a(instance1->GetSiteInstanceForURL(
+ GURL("chrome-extension://baz/bar")));
+ scoped_refptr<SiteInstance> s4b(instance2->GetSiteInstanceForURL(
+ GURL("chrome-extension://foo/boo")));
+ EXPECT_NE(s4a, s4b);
+
+ // The derived profiles with the same site.
+ scoped_refptr<SiteInstance> s5a(instance1->GetSiteInstanceForURL(
+ GURL("chrome-extension://baz/bar")));
+ scoped_refptr<SiteInstance> s5b(instance3->GetSiteInstanceForURL(
+ GURL("chrome-extension://baz/bar")));
+ EXPECT_EQ(s5a, s5b);
+
+ // The derived profiles with the different sites.
+ scoped_refptr<SiteInstance> s6a(instance1->GetSiteInstanceForURL(
+ GURL("chrome-extension://baz/bar")));
+ scoped_refptr<SiteInstance> s6b(instance3->GetSiteInstanceForURL(
+ GURL("chrome-extension://foo/boo")));
+ EXPECT_NE(s6a, s6b);
}