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

Unified Diff: content/browser/tab_contents/tab_contents_unittest.cc

Issue 9264049: Allow SiteInstance for about:blank in new tab to be reused. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 months 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/tab_contents/tab_contents.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/tab_contents/tab_contents_unittest.cc
diff --git a/content/browser/tab_contents/tab_contents_unittest.cc b/content/browser/tab_contents/tab_contents_unittest.cc
index bb7c7d469c3b281c9304c85649d60af32c93652a..1b3aeea1182d5cc28629968f1279285125120d31 100644
--- a/content/browser/tab_contents/tab_contents_unittest.cc
+++ b/content/browser/tab_contents/tab_contents_unittest.cc
@@ -972,8 +972,9 @@ TEST_F(TabContentsTest, NavigationEntryContentState) {
EXPECT_FALSE(entry->GetContentState().empty());
}
-// Test that NavigationEntries have the correct content state after opening
-// a new window to about:blank. Prevents regression for bug 1116137.
+// Test that NavigationEntries have the correct content state and SiteInstance
+// state after opening a new window to about:blank. Prevents regression for
+// bugs b/1116137 and http://crbug.com/111975.
TEST_F(TabContentsTest, NavigationEntryContentStateNewWindow) {
TestRenderViewHost* orig_rvh = rvh();
@@ -986,6 +987,25 @@ TEST_F(TabContentsTest, NavigationEntryContentStateNewWindow) {
// Should have a content state here.
NavigationEntry* entry = controller().GetLastCommittedEntry();
EXPECT_FALSE(entry->GetContentState().empty());
+
+ // The SiteInstance should be available for other navigations to use.
+ NavigationEntryImpl* entry_impl =
+ NavigationEntryImpl::FromNavigationEntry(entry);
+ EXPECT_FALSE(entry_impl->site_instance()->HasSite());
+ int32 site_instance_id = entry_impl->site_instance()->GetId();
+
+ // Navigating to a normal page should not cause a process swap.
+ const GURL newUrl("http://www.google.com");
darin (slow to review) 2012/01/30 22:12:38 nit: new_url
+ controller().LoadURL(
+ url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string());
+ EXPECT_FALSE(contents()->cross_navigation_pending());
+ EXPECT_EQ(orig_rvh, contents()->GetRenderViewHost());
+ contents()->TestDidNavigate(orig_rvh, 1, newUrl,
+ content::PAGE_TRANSITION_TYPED);
+ NavigationEntryImpl* entry_impl2 = NavigationEntryImpl::FromNavigationEntry(
+ controller().GetLastCommittedEntry());
+ EXPECT_EQ(site_instance_id, entry_impl2->site_instance()->GetId());
+ EXPECT_TRUE(entry_impl2->site_instance()->HasSite());
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « content/browser/tab_contents/tab_contents.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698