diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-24 19:44:57 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-24 19:44:57 +0000 |
commit | 38b8f4e7fdbf9e4ce2b97f045f4be1cceba3372d (patch) | |
tree | ea755a1c191432c4b1d4c08b9fa12c9f45e21d7a | |
parent | 14a75f4de62dd3c114fd10aae324dd3df5ffcf1f (diff) | |
download | chromium_src-38b8f4e7fdbf9e4ce2b97f045f4be1cceba3372d.zip chromium_src-38b8f4e7fdbf9e4ce2b97f045f4be1cceba3372d.tar.gz chromium_src-38b8f4e7fdbf9e4ce2b97f045f4be1cceba3372d.tar.bz2 |
Initialize user_gesture_observed_ in NavigationController constructor.
BUG=18268
TEST=run the included test under valgrind without the navigation_controller.cc change, then with. The memcheck condititional jump error shouldn't fire with the fix.
Review URL: http://codereview.chromium.org/220002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27105 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/tab_contents/navigation_controller.cc | 3 | ||||
-rw-r--r-- | chrome/browser/tab_contents/navigation_controller_unittest.cc | 44 | ||||
-rw-r--r-- | tools/valgrind/memcheck/suppressions.txt | 6 |
3 files changed, 46 insertions, 7 deletions
diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc index 4a4afbe..82210ed 100644 --- a/chrome/browser/tab_contents/navigation_controller.cc +++ b/chrome/browser/tab_contents/navigation_controller.cc @@ -125,7 +125,8 @@ NavigationController::NavigationController(TabContents* contents, tab_contents_(contents), max_restored_page_id_(-1), ALLOW_THIS_IN_INITIALIZER_LIST(ssl_manager_(this)), - needs_reload_(false) { + needs_reload_(false), + user_gesture_observed_(false) { DCHECK(profile_); } diff --git a/chrome/browser/tab_contents/navigation_controller_unittest.cc b/chrome/browser/tab_contents/navigation_controller_unittest.cc index 3f3e203..24e2d7b 100644 --- a/chrome/browser/tab_contents/navigation_controller_unittest.cc +++ b/chrome/browser/tab_contents/navigation_controller_unittest.cc @@ -767,6 +767,50 @@ TEST_F(NavigationControllerTest, Redirect) { EXPECT_FALSE(controller().CanGoForward()); } +// A redirect right off the bat should be a NEW_PAGE. +TEST_F(NavigationControllerTest, ImmediateRedirect) { + TestNotificationTracker notifications; + RegisterForAllNavNotifications(¬ifications, &controller()); + + const GURL url1("http://foo1"); + const GURL url2("http://foo2"); // Redirection target + + // First request + controller().LoadURL(url1, GURL(), PageTransition::TYPED); + + EXPECT_TRUE(controller().pending_entry()); + EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(url1, controller().GetActiveEntry()->url()); + + ViewHostMsg_FrameNavigate_Params params = {0}; + params.page_id = 0; + params.url = url2; + params.transition = PageTransition::SERVER_REDIRECT; + params.redirects.push_back(GURL("http://foo1")); + params.redirects.push_back(GURL("http://foo2")); + params.should_update_history = false; + params.gesture = NavigationGestureAuto; + params.is_post = false; + + NavigationController::LoadCommittedDetails details; + + EXPECT_EQ(0U, notifications.size()); + EXPECT_TRUE(controller().RendererDidNavigate(params, &details)); + EXPECT_TRUE(notifications.Check1AndReset( + NotificationType::NAV_ENTRY_COMMITTED)); + + EXPECT_TRUE(details.type == NavigationType::NEW_PAGE); + EXPECT_EQ(controller().entry_count(), 1); + EXPECT_EQ(controller().last_committed_entry_index(), 0); + EXPECT_TRUE(controller().GetLastCommittedEntry()); + EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_FALSE(controller().pending_entry()); + EXPECT_EQ(url2, controller().GetActiveEntry()->url()); + + EXPECT_FALSE(controller().CanGoBack()); + EXPECT_FALSE(controller().CanGoForward()); +} + // Tests navigation via link click within a subframe. A new navigation entry // should be created. TEST_F(NavigationControllerTest, NewSubframe) { diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt index d92288f..c970654 100644 --- a/tools/valgrind/memcheck/suppressions.txt +++ b/tools/valgrind/memcheck/suppressions.txt @@ -917,12 +917,6 @@ fun:_ZN7WebCore8SVGNames4initEv } { - bug_18268 - Memcheck:Cond - fun:_ZN20NavigationController22IsLikelyAutoNavigationEN4base9TimeTicksE - fun:_ZN20NavigationController28RendererDidNavigateToNewPageERK32ViewHostMsg_FrameNavigate_ParamsPb -} -{ bug_18654 Memcheck:Leak ... |