OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 268 |
269 // Commit. | 269 // Commit. |
270 manager.DidNavigateMainFrame(host); | 270 manager.DidNavigateMainFrame(host); |
271 } | 271 } |
272 | 272 |
273 // Tests that chrome: URLs that are not Web UI pages do not get grouped into | 273 // Tests that chrome: URLs that are not Web UI pages do not get grouped into |
274 // Web UI renderers, even if --process-per-tab is enabled. In that mode, we | 274 // Web UI renderers, even if --process-per-tab is enabled. In that mode, we |
275 // still swap processes if ShouldSwapProcessesForNavigation is true. | 275 // still swap processes if ShouldSwapProcessesForNavigation is true. |
276 // Regression test for bug 46290. | 276 // Regression test for bug 46290. |
277 TEST_F(RenderViewHostManagerTest, NonDOMUIChromeURLs) { | 277 TEST_F(RenderViewHostManagerTest, NonDOMUIChromeURLs) { |
| 278 BrowserThread thread(BrowserThread::UI, &message_loop_); |
278 SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get()); | 279 SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get()); |
279 TestTabContents tab_contents(profile_.get(), instance); | 280 TestTabContents tab_contents(profile_.get(), instance); |
280 RenderViewHostManager manager(&tab_contents, &tab_contents); | 281 RenderViewHostManager manager(&tab_contents, &tab_contents); |
281 manager.Init(profile_.get(), instance, MSG_ROUTING_NONE); | 282 manager.Init(profile_.get(), instance, MSG_ROUTING_NONE); |
282 | 283 |
283 // NTP is a Web UI page. | 284 // NTP is a Web UI page. |
284 GURL ntp_url(chrome::kChromeUINewTabURL); | 285 GURL ntp_url(chrome::kChromeUINewTabURL); |
285 NavigationEntry ntp_entry(NULL /* instance */, -1 /* page_id */, ntp_url, | 286 NavigationEntry ntp_entry(NULL /* instance */, -1 /* page_id */, ntp_url, |
286 GURL() /* referrer */, string16() /* title */, | 287 GURL() /* referrer */, string16() /* title */, |
287 PageTransition::TYPED); | 288 PageTransition::TYPED); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 // That should have cancelled the pending RVH, and the evil RVH should be the | 335 // That should have cancelled the pending RVH, and the evil RVH should be the |
335 // current one. | 336 // current one. |
336 EXPECT_TRUE(contents()->render_manager()->pending_render_view_host() == NULL); | 337 EXPECT_TRUE(contents()->render_manager()->pending_render_view_host() == NULL); |
337 EXPECT_EQ(evil_rvh, contents()->render_manager()->current_host()); | 338 EXPECT_EQ(evil_rvh, contents()->render_manager()->current_host()); |
338 | 339 |
339 // Also we should not have a pending navigation entry. | 340 // Also we should not have a pending navigation entry. |
340 NavigationEntry* entry = contents()->controller().GetActiveEntry(); | 341 NavigationEntry* entry = contents()->controller().GetActiveEntry(); |
341 ASSERT_TRUE(entry != NULL); | 342 ASSERT_TRUE(entry != NULL); |
342 EXPECT_EQ(url2, entry->url()); | 343 EXPECT_EQ(url2, entry->url()); |
343 } | 344 } |
OLD | NEW |