summaryrefslogtreecommitdiffstats
path: root/chrome/browser/site_instance_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/site_instance_unittest.cc')
-rw-r--r--chrome/browser/site_instance_unittest.cc27
1 files changed, 17 insertions, 10 deletions
diff --git a/chrome/browser/site_instance_unittest.cc b/chrome/browser/site_instance_unittest.cc
index 12eb0dc..4059fb4 100644
--- a/chrome/browser/site_instance_unittest.cc
+++ b/chrome/browser/site_instance_unittest.cc
@@ -9,7 +9,12 @@
#include "chrome/test/testing_profile.h"
#include "testing/gtest/include/gtest/gtest.h"
-typedef testing::Test SiteInstanceTest;
+namespace {
+
+class SiteInstanceTest : public testing::Test {
+ private:
+ MessageLoopForUI message_loop_;
+};
class TestBrowsingInstance : public BrowsingInstance {
public:
@@ -55,8 +60,10 @@ class TestSiteInstance : public SiteInstance {
int* deleteCounter_;
};
+} // namespace
+
// Test to ensure no memory leaks for SiteInstance objects.
-TEST(SiteInstanceTest, SiteInstanceDestructor) {
+TEST_F(SiteInstanceTest, SiteInstanceDestructor) {
int siteDeleteCounter = 0;
int browsingDeleteCounter = 0;
const GURL url("test:foo");
@@ -114,7 +121,7 @@ TEST(SiteInstanceTest, SiteInstanceDestructor) {
// Test that NavigationEntries with SiteInstances can be cloned, but that their
// SiteInstances can be changed afterwards. Also tests that the ref counts are
// updated properly after the change.
-TEST(SiteInstanceTest, CloneNavigationEntry) {
+TEST_F(SiteInstanceTest, CloneNavigationEntry) {
int siteDeleteCounter1 = 0;
int siteDeleteCounter2 = 0;
int browsingDeleteCounter = 0;
@@ -153,7 +160,7 @@ TEST(SiteInstanceTest, CloneNavigationEntry) {
}
// Test to ensure UpdateMaxPageID is working properly.
-TEST(SiteInstanceTest, UpdateMaxPageID) {
+TEST_F(SiteInstanceTest, UpdateMaxPageID) {
scoped_refptr<SiteInstance> instance(SiteInstance::CreateSiteInstance(NULL));
EXPECT_EQ(-1, instance.get()->max_page_id());
@@ -164,7 +171,7 @@ TEST(SiteInstanceTest, UpdateMaxPageID) {
}
// Test to ensure GetProcess returns and creates processes correctly.
-TEST(SiteInstanceTest, GetProcess) {
+TEST_F(SiteInstanceTest, GetProcess) {
// Ensure that GetProcess returns the process based on its host id.
scoped_ptr<TestingProfile> profile(new TestingProfile());
scoped_ptr<RenderProcessHost> host1(new RenderProcessHost(profile.get()));
@@ -181,7 +188,7 @@ TEST(SiteInstanceTest, GetProcess) {
}
// Test to ensure SetSite and site() work properly.
-TEST(SiteInstanceTest, SetSite) {
+TEST_F(SiteInstanceTest, SetSite) {
scoped_refptr<SiteInstance> instance(SiteInstance::CreateSiteInstance(NULL));
EXPECT_FALSE(instance->has_site());
EXPECT_TRUE(instance.get()->site().is_empty());
@@ -193,7 +200,7 @@ TEST(SiteInstanceTest, SetSite) {
}
// Test to ensure GetSiteForURL properly returns sites for URLs.
-TEST(SiteInstanceTest, GetSiteForURL) {
+TEST_F(SiteInstanceTest, GetSiteForURL) {
GURL test_url = GURL("http://www.google.com/index.html");
EXPECT_EQ(GURL("http://google.com"), SiteInstance::GetSiteForURL(test_url));
@@ -220,7 +227,7 @@ TEST(SiteInstanceTest, GetSiteForURL) {
// Test of distinguishing URLs from different sites. Most of this logic is
// tested in RegistryControlledDomainTest. This test focuses on URLs with
// different schemes or ports.
-TEST(SiteInstanceTest, IsSameWebSite) {
+TEST_F(SiteInstanceTest, IsSameWebSite) {
GURL url_foo = GURL("http://foo/a.html");
GURL url_foo2 = GURL("http://foo/b.html");
GURL url_foo_https = GURL("https://foo/a.html");
@@ -247,7 +254,7 @@ TEST(SiteInstanceTest, IsSameWebSite) {
// Test to ensure that there is only one SiteInstance per site in a given
// BrowsingInstance, when process-per-site is not in use.
-TEST(SiteInstanceTest, OneSiteInstancePerSite) {
+TEST_F(SiteInstanceTest, OneSiteInstancePerSite) {
int deleteCounter = 0;
TestBrowsingInstance* browsing_instance =
new TestBrowsingInstance(NULL, &deleteCounter);
@@ -305,7 +312,7 @@ TEST(SiteInstanceTest, OneSiteInstancePerSite) {
// Test to ensure that there is only one SiteInstance per site for an entire
// Profile, if process-per-site is in use.
-TEST(SiteInstanceTest, OneSiteInstancePerSiteInProfile) {
+TEST_F(SiteInstanceTest, OneSiteInstancePerSiteInProfile) {
int deleteCounter = 0;
TestBrowsingInstance* browsing_instance =
new TestBrowsingInstance(NULL, &deleteCounter);