Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 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/browser_thread.h" | 5 #include "chrome/browser/browser_thread.h" |
| 6 #include "chrome/browser/browser_url_handler.h" | 6 #include "chrome/browser/browser_url_handler.h" |
| 7 #include "chrome/browser/renderer_host/site_instance.h" | 7 #include "chrome/browser/renderer_host/site_instance.h" |
| 8 #include "chrome/browser/renderer_host/test/test_render_view_host.h" | 8 #include "chrome/browser/renderer_host/test/test_render_view_host.h" |
| 9 #include "chrome/browser/tab_contents/navigation_controller.h" | 9 #include "chrome/browser/tab_contents/navigation_controller.h" |
| 10 #include "chrome/browser/tab_contents/navigation_entry.h" | 10 #include "chrome/browser/tab_contents/navigation_entry.h" |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 | 246 |
| 247 GURL url(chrome::kChromeUINewTabURL); | 247 GURL url(chrome::kChromeUINewTabURL); |
| 248 NavigationEntry entry(NULL /* instance */, -1 /* page_id */, url, | 248 NavigationEntry entry(NULL /* instance */, -1 /* page_id */, url, |
| 249 GURL() /* referrer */, string16() /* title */, | 249 GURL() /* referrer */, string16() /* title */, |
| 250 PageTransition::TYPED); | 250 PageTransition::TYPED); |
| 251 RenderViewHost* host = manager.Navigate(entry); | 251 RenderViewHost* host = manager.Navigate(entry); |
| 252 | 252 |
| 253 EXPECT_TRUE(host); | 253 EXPECT_TRUE(host); |
| 254 EXPECT_TRUE(host == manager.current_host()); | 254 EXPECT_TRUE(host == manager.current_host()); |
| 255 EXPECT_FALSE(manager.pending_render_view_host()); | 255 EXPECT_FALSE(manager.pending_render_view_host()); |
| 256 EXPECT_TRUE(manager.pending_dom_ui()); | |
| 257 EXPECT_FALSE(manager.dom_ui()); | |
| 258 | 256 |
| 259 // It's important that the site instance get set on the DOM UI page as soon | 257 // It's important that the site instance get set on the DOM UI page as soon |
| 260 // as the navigation starts, rather than lazily after it commits, so we don't | 258 // as the navigation starts, rather than lazily after it commits, so we don't |
| 261 // try to re-use the SiteInstance/process for non DOM-UI things that may | 259 // try to re-use the SiteInstance/process for non DOM-UI things that may |
| 262 // get loaded in between. | 260 // get loaded in between. |
| 263 EXPECT_TRUE(host->site_instance()->has_site()); | 261 EXPECT_TRUE(host->site_instance()->has_site()); |
| 264 EXPECT_EQ(url, host->site_instance()->site()); | 262 EXPECT_EQ(url, host->site_instance()->site()); |
| 265 | 263 |
| 266 // Commit. | |
| 267 manager.DidNavigateMainFrame(host); | |
|
Charlie Reis
2011/01/07 23:40:37
Let's keep this commit block as the last line of t
| |
| 268 | |
| 269 EXPECT_FALSE(manager.pending_dom_ui()); | 264 EXPECT_FALSE(manager.pending_dom_ui()); |
|
Charlie Reis
2011/01/07 23:40:37
Let's put a comment above this line saying that th
| |
| 270 EXPECT_TRUE(manager.dom_ui()); | 265 EXPECT_TRUE(manager.dom_ui()); |
| 271 } | 266 } |
| 272 | 267 |
| 273 // Tests that chrome: URLs that are not DOM UI pages do not get grouped into | 268 // Tests that chrome: URLs that are not DOM UI pages do not get grouped into |
| 274 // DOM UI renderers, even if --process-per-tab is enabled. In that mode, we | 269 // DOM UI renderers, even if --process-per-tab is enabled. In that mode, we |
| 275 // still swap processes if ShouldSwapProcessesForNavigation is true. | 270 // still swap processes if ShouldSwapProcessesForNavigation is true. |
| 276 // Regression test for bug 46290. | 271 // Regression test for bug 46290. |
| 277 TEST_F(RenderViewHostManagerTest, NonDOMUIChromeURLs) { | 272 TEST_F(RenderViewHostManagerTest, NonDOMUIChromeURLs) { |
| 278 SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get()); | 273 SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get()); |
| 279 TestTabContents tab_contents(profile_.get(), instance); | 274 TestTabContents tab_contents(profile_.get(), instance); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 // That should have cancelled the pending RVH, and the evil RVH should be the | 334 // That should have cancelled the pending RVH, and the evil RVH should be the |
| 340 // current one. | 335 // current one. |
| 341 EXPECT_TRUE(contents()->render_manager()->pending_render_view_host() == NULL); | 336 EXPECT_TRUE(contents()->render_manager()->pending_render_view_host() == NULL); |
| 342 EXPECT_EQ(evil_rvh, contents()->render_manager()->current_host()); | 337 EXPECT_EQ(evil_rvh, contents()->render_manager()->current_host()); |
| 343 | 338 |
| 344 // Also we should not have a pending navigation entry. | 339 // Also we should not have a pending navigation entry. |
| 345 NavigationEntry* entry = contents()->controller().GetActiveEntry(); | 340 NavigationEntry* entry = contents()->controller().GetActiveEntry(); |
| 346 ASSERT_TRUE(entry != NULL); | 341 ASSERT_TRUE(entry != NULL); |
| 347 EXPECT_EQ(url2, entry->url()); | 342 EXPECT_EQ(url2, entry->url()); |
| 348 } | 343 } |
| OLD | NEW |