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

Side by Side Diff: chrome/browser/tab_contents/render_view_host_manager_unittest.cc

Issue 1519025: Set the site instance in all cases when we start a new load. If you navigate ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/tab_contents/render_view_host_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/renderer_host/test/test_render_view_host.h" 5 #include "chrome/browser/renderer_host/test/test_render_view_host.h"
6 #include "chrome/browser/tab_contents/navigation_controller.h" 6 #include "chrome/browser/tab_contents/navigation_controller.h"
7 #include "chrome/browser/tab_contents/navigation_entry.h" 7 #include "chrome/browser/tab_contents/navigation_entry.h"
8 #include "chrome/browser/tab_contents/render_view_host_manager.h" 8 #include "chrome/browser/tab_contents/render_view_host_manager.h"
9 #include "chrome/common/render_messages.h" 9 #include "chrome/common/render_messages.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
11 #include "chrome/test/test_notification_tracker.h" 11 #include "chrome/test/test_notification_tracker.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 // Tests DOMUI creation. 223 // Tests DOMUI creation.
224 TEST_F(RenderViewHostManagerTest, DOMUI) { 224 TEST_F(RenderViewHostManagerTest, DOMUI) {
225 ChromeThread ui_thread(ChromeThread::UI, MessageLoop::current()); 225 ChromeThread ui_thread(ChromeThread::UI, MessageLoop::current());
226 SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get()); 226 SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get());
227 227
228 TestTabContents tab_contents(profile_.get(), instance); 228 TestTabContents tab_contents(profile_.get(), instance);
229 RenderViewHostManager manager(&tab_contents, &tab_contents); 229 RenderViewHostManager manager(&tab_contents, &tab_contents);
230 230
231 manager.Init(profile_.get(), instance, MSG_ROUTING_NONE); 231 manager.Init(profile_.get(), instance, MSG_ROUTING_NONE);
232 232
233 GURL url("chrome://newtab"); 233 GURL url(chrome::kChromeUINewTabURL);
234 NavigationEntry entry(NULL /* instance */, -1 /* page_id */, url, 234 NavigationEntry entry(NULL /* instance */, -1 /* page_id */, url,
235 GURL() /* referrer */, string16() /* title */, 235 GURL() /* referrer */, string16() /* title */,
236 PageTransition::TYPED); 236 PageTransition::TYPED);
237 RenderViewHost* host = manager.Navigate(entry); 237 RenderViewHost* host = manager.Navigate(entry);
238 238
239 EXPECT_TRUE(host); 239 EXPECT_TRUE(host);
240 EXPECT_TRUE(host == manager.current_host()); 240 EXPECT_TRUE(host == manager.current_host());
241 EXPECT_FALSE(manager.pending_render_view_host()); 241 EXPECT_FALSE(manager.pending_render_view_host());
242 EXPECT_TRUE(manager.pending_dom_ui()); 242 EXPECT_TRUE(manager.pending_dom_ui());
243 EXPECT_FALSE(manager.dom_ui()); 243 EXPECT_FALSE(manager.dom_ui());
244 244
245 // It's important that the site instance get set on the DOM UI page as soon
246 // as the navigation starts, rather than lazily after it commits, so we don't
247 // try to re-use the SiteInstance/process for non DOM-UI things that may
248 // get loaded in between.
249 EXPECT_TRUE(host->site_instance()->has_site());
250 EXPECT_EQ(url, host->site_instance()->site());
251
245 // Commit. 252 // Commit.
246 manager.DidNavigateMainFrame(host); 253 manager.DidNavigateMainFrame(host);
247 254
248 EXPECT_FALSE(manager.pending_dom_ui()); 255 EXPECT_FALSE(manager.pending_dom_ui());
249 EXPECT_TRUE(manager.dom_ui()); 256 EXPECT_TRUE(manager.dom_ui());
250 } 257 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/render_view_host_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698