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

Unified Diff: content/browser/site_instance_impl_unittest.cc

Issue 11421179: Experimental: Fix HasWrongProcessForURL in --site-per-process mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/site_instance_impl_unittest.cc
diff --git a/content/browser/site_instance_impl_unittest.cc b/content/browser/site_instance_impl_unittest.cc
index 6e76971d3b94806c43128eb2dae12e1ed1da2cf9..35b90bf54768447b0343b04067b8cd3042c06987 100644
--- a/content/browser/site_instance_impl_unittest.cc
+++ b/content/browser/site_instance_impl_unittest.cc
@@ -687,4 +687,37 @@ TEST_F(SiteInstanceTest, HasWrongProcessForURL) {
DrainMessageLoops();
}
+// Test to ensure that HasWrongProcessForURL behaves properly even when
+// --site-per-process is used (http://crbug.com/160671).
+TEST_F(SiteInstanceTest, HasWrongProcessForURLInSitePerProcess) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kSitePerProcess);
+
+ scoped_ptr<TestBrowserContext> browser_context(new TestBrowserContext());
+ scoped_ptr<RenderProcessHost> host;
+ scoped_refptr<SiteInstanceImpl> instance(static_cast<SiteInstanceImpl*>(
+ SiteInstance::Create(browser_context.get())));
+
+ instance->SetSite(GURL("http://evernote.com/"));
+ EXPECT_TRUE(instance->HasSite());
+
+ // Check prior to "assigning" a process to the instance, which is expected
+ // to return false due to not being attached to any process yet.
+ EXPECT_FALSE(instance->HasWrongProcessForURL(GURL("http://google.com")));
+
+ // The call to GetProcess actually creates a new real process, which works
+ // fine, but might be a cause for problems in different contexts.
+ host.reset(instance->GetProcess());
+ EXPECT_TRUE(host.get() != NULL);
+ EXPECT_TRUE(instance->HasProcess());
+
+ EXPECT_FALSE(instance->HasWrongProcessForURL(GURL("http://evernote.com")));
+ EXPECT_FALSE(instance->HasWrongProcessForURL(
+ GURL("javascript:alert(document.location.href);")));
+
+ EXPECT_TRUE(instance->HasWrongProcessForURL(GURL("chrome://settings")));
+
+ DrainMessageLoops();
+}
+
} // namespace content
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698