| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/renderer_host/test_render_view_host.h" |
| 6 #include "chrome/common/url_constants.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 |
| 9 class RenderViewHostManagerTest : public RenderViewHostTestHarness { |
| 10 |
| 11 }; |
| 12 |
| 13 // Tests that when you navigate from the New TabPage to another page, and |
| 14 // then do that sam ething in another tab, that the two resulting pages have |
| 15 // different SiteInstances, BrowsingInstances, and RenderProcessHosts. This is |
| 16 // a regression test for bug 9364. |
| 17 TEST_F(RenderViewHostManagerTest, NewTabPageProcesses) { |
| 18 GURL ntp(chrome::kChromeUINewTabURL); |
| 19 GURL dest("http://www.google.com/"); |
| 20 |
| 21 // Navigate our first tab to the new tab page and then to the destination. |
| 22 NavigateAndCommit(ntp); |
| 23 NavigateAndCommit(dest); |
| 24 |
| 25 // Make a second tab. |
| 26 WebContents* contents2 = new TestWebContents(profile_.get(), NULL); |
| 27 NavigationController* controller2 = |
| 28 new NavigationController(contents2, profile_.get()); |
| 29 contents2->set_controller(controller2); |
| 30 |
| 31 // Load the two URLs in the second tab. Note that the first situation create |
| 32 // a RVH that's not pending (since there is no cross-site transition), so |
| 33 // we use the committed one, but the second one is the opposite. |
| 34 contents2->controller()->LoadURL(ntp, GURL(), PageTransition::LINK); |
| 35 static_cast<TestRenderViewHost*>(contents2->render_manager()-> |
| 36 current_host())->SendNavigate(100, ntp); |
| 37 contents2->controller()->LoadURL(dest, GURL(), PageTransition::LINK); |
| 38 static_cast<TestRenderViewHost*>(contents2->render_manager()-> |
| 39 pending_render_view_host())->SendNavigate(101, dest); |
| 40 |
| 41 // The two RVH's should be different in every way. |
| 42 EXPECT_NE(rvh()->process(), contents2->render_view_host()->process()); |
| 43 EXPECT_NE(rvh()->site_instance(), |
| 44 contents2->render_view_host()->site_instance()); |
| 45 EXPECT_NE(rvh()->site_instance()->browsing_instance(), |
| 46 contents2->render_view_host()->site_instance()->browsing_instance()); |
| 47 |
| 48 contents2->CloseContents(); |
| 49 } |
| OLD | NEW |