| OLD | NEW |
| 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 Loading... |
| 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(¶ms); |
| 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 Loading... |
| 4290 params.post_id = -1; | 4303 params.post_id = -1; |
| 4291 test_rvh()->SendNavigateWithParams(¶ms); | 4304 test_rvh()->SendNavigateWithParams(¶ms); |
| 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 |
| OLD | NEW |