summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui/dom_ui_unittest.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-30 15:09:32 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-30 15:09:32 +0000
commit09247ce046ae7fa18a868d7f07ad292899b3798c (patch)
tree5e70c214b6f4674da1c92c0107c2a71fc9c66609 /chrome/browser/dom_ui/dom_ui_unittest.cc
parenta3e9a035f9dab82efb3e02dc9ecf53313ba30be1 (diff)
downloadchromium_src-09247ce046ae7fa18a868d7f07ad292899b3798c.zip
chromium_src-09247ce046ae7fa18a868d7f07ad292899b3798c.tar.gz
chromium_src-09247ce046ae7fa18a868d7f07ad292899b3798c.tar.bz2
Fix the DOMUIToStandard unit test and uncomment it. The NavigationController
wasn't getting hooked up properly to the WebContents, and we were getting the wrong RenderViewHost out of it later on in the test. Review URL: http://codereview.chromium.org/55045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12773 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui/dom_ui_unittest.cc')
-rw-r--r--chrome/browser/dom_ui/dom_ui_unittest.cc28
1 files changed, 20 insertions, 8 deletions
diff --git a/chrome/browser/dom_ui/dom_ui_unittest.cc b/chrome/browser/dom_ui/dom_ui_unittest.cc
index 7dedc1b..63eb2e7 100644
--- a/chrome/browser/dom_ui/dom_ui_unittest.cc
+++ b/chrome/browser/dom_ui/dom_ui_unittest.cc
@@ -54,11 +54,18 @@ class DOMUITest : public RenderViewHostTestHarness {
EXPECT_FALSE(contents->FocusLocationBarByDefault());
// Commit the regular page load. Note that we must send it to the "pending"
- // RenderViewHost, since this transition will also cause a process
- // transition, and our RVH pointer will be the "committed" one.
- static_cast<TestRenderViewHost*>(
- contents->render_manager()->pending_render_view_host())->SendNavigate(
- page_id + 1, next_url);
+ // RenderViewHost if there is one, since this transition will also cause a
+ // process transition, and our RVH pointer will be the "committed" one.
+ // In the second call to this function from DOMUIToStandard, it won't
+ // actually be pending, which is the point of this test.
+ if (contents->render_manager()->pending_render_view_host()) {
+ static_cast<TestRenderViewHost*>(
+ contents->render_manager()->pending_render_view_host())->SendNavigate(
+ page_id + 1, next_url);
+ } else {
+ static_cast<TestRenderViewHost*>(
+ contents->render_view_host())->SendNavigate(page_id + 1, next_url);
+ }
// The state should now reflect a regular page.
EXPECT_TRUE(contents->ShouldDisplayURL());
@@ -74,17 +81,22 @@ class DOMUITest : public RenderViewHostTestHarness {
// Tests that the New Tab Page flags are correctly set and propogated by
// WebContents when we first navigate to a DOM UI page, then to a standard
// non-DOM-UI page.
-/* TODO(brettw) uncomment this test when it doesn't crash.
TEST_F(DOMUITest, DOMUIToStandard) {
DoNavigationTest(contents(), 1);
- // Check for a non-first
+ // Test the case where we're not doing the initial navigation. This is
+ // slightly different than the very-first-navigation case since the
+ // SiteInstance will be the same (the original WebContents must still be
+ // alive), which will trigger different behavior in RenderViewHostManager.
WebContents* contents2 = new TestWebContents(profile_.get(), NULL,
&rvh_factory_);
+ NavigationController* controller2 =
+ new NavigationController(contents2, profile_.get());
+ contents2->set_controller(controller2);
+
DoNavigationTest(contents2, 101);
contents2->CloseContents();
}
-*/
TEST_F(DOMUITest, DOMUIToDOMUI) {
// Do a load (this state is tested above).