Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: content/browser/frame_host/navigation_controller_impl_unittest.cc

Issue 311783005: Fix crash in NavigationControllerImpl::RendererDidNavigateToNewPage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 2243 matching lines...) Expand 10 before | Expand all | Expand 10 after
2254 { 2254 {
2255 const GURL url("http://foo2/"); 2255 const GURL url("http://foo2/");
2256 controller.GoBack(); 2256 controller.GoBack();
2257 main_test_rfh()->SendNavigate(1, url); 2257 main_test_rfh()->SendNavigate(1, url);
2258 EXPECT_EQ(1U, navigation_entry_committed_counter_); 2258 EXPECT_EQ(1U, navigation_entry_committed_counter_);
2259 navigation_entry_committed_counter_ = 0; 2259 navigation_entry_committed_counter_ = 0;
2260 EXPECT_EQ(url, controller.GetVisibleEntry()->GetURL()); 2260 EXPECT_EQ(url, controller.GetVisibleEntry()->GetURL());
2261 } 2261 }
2262 } 2262 }
2263 2263
2264 TEST_F(NavigationControllerTest, PushStateWithoutPreviousEntry)
2265 {
2266 ASSERT_FALSE(controller_impl().GetLastCommittedEntry());
2267 FrameHostMsg_DidCommitProvisionalLoad_Params params;
2268 GURL url("http://foo");
2269 params.page_id = 1;
2270 params.url = url;
2271 params.page_state = PageState::CreateFromURL(url);
2272 params.was_within_same_page = true;
2273 test_rvh()->SendNavigateWithParams(&params);
2274 // We pass if we don't crash.
2275 }
2276
2264 // NotificationObserver implementation used in verifying we've received the 2277 // NotificationObserver implementation used in verifying we've received the
2265 // NOTIFICATION_NAV_LIST_PRUNED method. 2278 // NOTIFICATION_NAV_LIST_PRUNED method.
2266 class PrunedListener : public NotificationObserver { 2279 class PrunedListener : public NotificationObserver {
2267 public: 2280 public:
2268 explicit PrunedListener(NavigationControllerImpl* controller) 2281 explicit PrunedListener(NavigationControllerImpl* controller)
2269 : notification_count_(0) { 2282 : notification_count_(0) {
2270 registrar_.Add(this, NOTIFICATION_NAV_LIST_PRUNED, 2283 registrar_.Add(this, NOTIFICATION_NAV_LIST_PRUNED,
2271 Source<NavigationController>(controller)); 2284 Source<NavigationController>(controller));
2272 } 2285 }
2273 2286
(...skipping 2016 matching lines...) Expand 10 before | Expand all | Expand 10 after
4290 params.post_id = -1; 4303 params.post_id = -1;
4291 test_rvh()->SendNavigateWithParams(&params); 4304 test_rvh()->SendNavigateWithParams(&params);
4292 4305
4293 // Now reload. replaceState overrides the POST, so we should not show a 4306 // Now reload. replaceState overrides the POST, so we should not show a
4294 // repost warning dialog. 4307 // repost warning dialog.
4295 controller_impl().Reload(true); 4308 controller_impl().Reload(true);
4296 EXPECT_EQ(0, delegate->repost_form_warning_count()); 4309 EXPECT_EQ(0, delegate->repost_form_warning_count());
4297 } 4310 }
4298 4311
4299 } // namespace content 4312 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698