Index: chrome/browser/ui/webui/web_ui_unittest.cc |
diff --git a/chrome/browser/ui/webui/web_ui_unittest.cc b/chrome/browser/ui/webui/web_ui_unittest.cc |
index 93955d7915a1685eaa09f7fc9f8084bd85a3058f..11855894989bac20a645f508fe3491487b98690c 100644 |
--- a/chrome/browser/ui/webui/web_ui_unittest.cc |
+++ b/chrome/browser/ui/webui/web_ui_unittest.cc |
@@ -12,12 +12,14 @@ |
#include "content/public/browser/navigation_controller.h" |
#include "content/public/browser/site_instance.h" |
#include "content/test/test_browser_thread.h" |
+#include "content/test/test_renderer_host.h" |
#include "testing/gtest/include/gtest/gtest.h" |
using content::BrowserThread; |
using content::NavigationController; |
+using content::RenderViewHost; |
+using content::RenderViewHostTester; |
using content::SiteInstance; |
-using content::TestRenderViewHost; |
using content::WebContents; |
class WebUITest : public TabContentsWrapperTestHarness { |
@@ -47,7 +49,7 @@ class WebUITest : public TabContentsWrapperTestHarness { |
EXPECT_TRUE(contents->FocusLocationBarByDefault()); |
// Now commit the load. |
- static_cast<TestRenderViewHost*>( |
+ RenderViewHostTester::For( |
contents->GetRenderViewHost())->SendNavigate(page_id, new_tab_url); |
// The same flags should be set as before now that the load has committed. |
@@ -70,12 +72,13 @@ class WebUITest : public TabContentsWrapperTestHarness { |
// process transition, and our RVH pointer will be the "committed" one. |
// In the second call to this function from WebUIToStandard, it won't |
// actually be pending, which is the point of this test. |
- TestRenderViewHost* pending_rvh = |
- TestRenderViewHost::GetPendingForController(controller); |
+ RenderViewHost* pending_rvh = |
+ RenderViewHostTester::GetPendingForController(controller); |
if (pending_rvh) { |
- pending_rvh->SendNavigate(page_id + 1, next_url); |
+ RenderViewHostTester::For( |
+ pending_rvh)->SendNavigate(page_id + 1, next_url); |
} else { |
- static_cast<TestRenderViewHost*>( |
+ RenderViewHostTester::For( |
contents->GetRenderViewHost())->SendNavigate(page_id + 1, next_url); |
} |
@@ -112,13 +115,13 @@ TEST_F(WebUITest, WebUIToWebUI) { |
controller().LoadURL(new_tab_url, content::Referrer(), |
content::PAGE_TRANSITION_LINK, |
std::string()); |
- rvh()->SendNavigate(1, new_tab_url); |
+ rvh_tester()->SendNavigate(1, new_tab_url); |
// Start another pending load of the new tab page. |
controller().LoadURL(new_tab_url, content::Referrer(), |
content::PAGE_TRANSITION_LINK, |
std::string()); |
- rvh()->SendNavigate(2, new_tab_url); |
+ rvh_tester()->SendNavigate(2, new_tab_url); |
// The flags should be the same as the non-pending state. |
EXPECT_FALSE( |
@@ -139,7 +142,7 @@ TEST_F(WebUITest, StandardToWebUI) { |
EXPECT_FALSE(contents()->FocusLocationBarByDefault()); |
// Commit the load, the state should be the same. |
- rvh()->SendNavigate(1, std_url); |
+ rvh_tester()->SendNavigate(1, std_url); |
EXPECT_TRUE(contents_wrapper()->favicon_tab_helper()->ShouldDisplayFavicon()); |
EXPECT_FALSE(contents()->FocusLocationBarByDefault()); |
@@ -182,7 +185,7 @@ TEST_F(WebUITest, FocusOnNavigate) { |
controller().LoadURL(new_tab_url, content::Referrer(), |
content::PAGE_TRANSITION_LINK, |
std::string()); |
- rvh()->SendNavigate(page_id, new_tab_url); |
+ rvh_tester()->SendNavigate(page_id, new_tab_url); |
// Navigate to another page. |
GURL next_url("http://google.com/"); |
@@ -190,19 +193,20 @@ TEST_F(WebUITest, FocusOnNavigate) { |
controller().LoadURL(next_url, content::Referrer(), |
content::PAGE_TRANSITION_LINK, |
std::string()); |
- TestRenderViewHost* old_rvh = rvh(); |
- old_rvh->SendShouldCloseACK(true); |
- pending_rvh()->SendNavigate(next_page_id, next_url); |
- old_rvh->OnSwapOutACK(); |
+ RenderViewHost* old_rvh = rvh(); |
+ RenderViewHostTester::For(old_rvh)->SendShouldCloseACK(true); |
+ RenderViewHostTester::For( |
+ pending_rvh())->SendNavigate(next_page_id, next_url); |
+ RenderViewHostTester::For(old_rvh)->SimulateSwapOutACK(); |
// Navigate back. Should focus the location bar. |
int focus_called = tc->focus_called(); |
ASSERT_TRUE(controller().CanGoBack()); |
controller().GoBack(); |
old_rvh = rvh(); |
- old_rvh->SendShouldCloseACK(true); |
- pending_rvh()->SendNavigate(page_id, new_tab_url); |
- old_rvh->OnSwapOutACK(); |
+ RenderViewHostTester::For(old_rvh)->SendShouldCloseACK(true); |
+ RenderViewHostTester::For(pending_rvh())->SendNavigate(page_id, new_tab_url); |
+ RenderViewHostTester::For(old_rvh)->SimulateSwapOutACK(); |
EXPECT_LT(focus_called, tc->focus_called()); |
// Navigate forward. Shouldn't focus the location bar. |
@@ -210,8 +214,9 @@ TEST_F(WebUITest, FocusOnNavigate) { |
ASSERT_TRUE(controller().CanGoForward()); |
controller().GoForward(); |
old_rvh = rvh(); |
- old_rvh->SendShouldCloseACK(true); |
- pending_rvh()->SendNavigate(next_page_id, next_url); |
- old_rvh->OnSwapOutACK(); |
+ RenderViewHostTester::For(old_rvh)->SendShouldCloseACK(true); |
+ RenderViewHostTester::For( |
+ pending_rvh())->SendNavigate(next_page_id, next_url); |
+ RenderViewHostTester::For(old_rvh)->SimulateSwapOutACK(); |
EXPECT_EQ(focus_called, tc->focus_called()); |
} |