| 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/files/file_util.h" | 7 #include "base/files/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 3877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3888 EXPECT_EQ(0, controller.GetPendingEntryIndex()); | 3888 EXPECT_EQ(0, controller.GetPendingEntryIndex()); |
| 3889 // The actual cross-navigation is suspended until the current RVH tells us | 3889 // The actual cross-navigation is suspended until the current RVH tells us |
| 3890 // it unloaded, simulate that. | 3890 // it unloaded, simulate that. |
| 3891 contents()->ProceedWithCrossSiteNavigation(); | 3891 contents()->ProceedWithCrossSiteNavigation(); |
| 3892 // Also make sure we told the page to navigate. | 3892 // Also make sure we told the page to navigate. |
| 3893 const IPC::Message* message = | 3893 const IPC::Message* message = |
| 3894 process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID); | 3894 process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID); |
| 3895 ASSERT_TRUE(message != NULL); | 3895 ASSERT_TRUE(message != NULL); |
| 3896 Tuple1<FrameMsg_Navigate_Params> nav_params; | 3896 Tuple1<FrameMsg_Navigate_Params> nav_params; |
| 3897 FrameMsg_Navigate::Read(message, &nav_params); | 3897 FrameMsg_Navigate::Read(message, &nav_params); |
| 3898 EXPECT_EQ(url1, nav_params.a.url); | 3898 EXPECT_EQ(url1, nav_params.a.common_params.url); |
| 3899 process()->sink().ClearMessages(); | 3899 process()->sink().ClearMessages(); |
| 3900 | 3900 |
| 3901 // Now test history.forward() | 3901 // Now test history.forward() |
| 3902 contents()->OnGoToEntryAtOffset(2); | 3902 contents()->OnGoToEntryAtOffset(2); |
| 3903 EXPECT_EQ(2, controller.GetPendingEntryIndex()); | 3903 EXPECT_EQ(2, controller.GetPendingEntryIndex()); |
| 3904 // The actual cross-navigation is suspended until the current RVH tells us | 3904 // The actual cross-navigation is suspended until the current RVH tells us |
| 3905 // it unloaded, simulate that. | 3905 // it unloaded, simulate that. |
| 3906 contents()->ProceedWithCrossSiteNavigation(); | 3906 contents()->ProceedWithCrossSiteNavigation(); |
| 3907 message = process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID); | 3907 message = process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID); |
| 3908 ASSERT_TRUE(message != NULL); | 3908 ASSERT_TRUE(message != NULL); |
| 3909 FrameMsg_Navigate::Read(message, &nav_params); | 3909 FrameMsg_Navigate::Read(message, &nav_params); |
| 3910 EXPECT_EQ(url3, nav_params.a.url); | 3910 EXPECT_EQ(url3, nav_params.a.common_params.url); |
| 3911 process()->sink().ClearMessages(); | 3911 process()->sink().ClearMessages(); |
| 3912 | 3912 |
| 3913 controller.DiscardNonCommittedEntries(); | 3913 controller.DiscardNonCommittedEntries(); |
| 3914 | 3914 |
| 3915 // Make sure an extravagant history.go() doesn't break. | 3915 // Make sure an extravagant history.go() doesn't break. |
| 3916 contents()->OnGoToEntryAtOffset(120); // Out of bounds. | 3916 contents()->OnGoToEntryAtOffset(120); // Out of bounds. |
| 3917 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); | 3917 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); |
| 3918 message = process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID); | 3918 message = process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID); |
| 3919 EXPECT_TRUE(message == NULL); | 3919 EXPECT_TRUE(message == NULL); |
| 3920 } | 3920 } |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4354 params.post_id = -1; | 4354 params.post_id = -1; |
| 4355 test_rvh()->SendNavigateWithParams(¶ms); | 4355 test_rvh()->SendNavigateWithParams(¶ms); |
| 4356 | 4356 |
| 4357 // Now reload. replaceState overrides the POST, so we should not show a | 4357 // Now reload. replaceState overrides the POST, so we should not show a |
| 4358 // repost warning dialog. | 4358 // repost warning dialog. |
| 4359 controller_impl().Reload(true); | 4359 controller_impl().Reload(true); |
| 4360 EXPECT_EQ(0, delegate->repost_form_warning_count()); | 4360 EXPECT_EQ(0, delegate->repost_form_warning_count()); |
| 4361 } | 4361 } |
| 4362 | 4362 |
| 4363 } // namespace content | 4363 } // namespace content |
| OLD | NEW |