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 3858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3869 EXPECT_EQ(0, controller.GetPendingEntryIndex()); | 3869 EXPECT_EQ(0, controller.GetPendingEntryIndex()); |
3870 // The actual cross-navigation is suspended until the current RVH tells us | 3870 // The actual cross-navigation is suspended until the current RVH tells us |
3871 // it unloaded, simulate that. | 3871 // it unloaded, simulate that. |
3872 contents()->ProceedWithCrossSiteNavigation(); | 3872 contents()->ProceedWithCrossSiteNavigation(); |
3873 // Also make sure we told the page to navigate. | 3873 // Also make sure we told the page to navigate. |
3874 const IPC::Message* message = | 3874 const IPC::Message* message = |
3875 process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID); | 3875 process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID); |
3876 ASSERT_TRUE(message != NULL); | 3876 ASSERT_TRUE(message != NULL); |
3877 Tuple1<FrameMsg_Navigate_Params> nav_params; | 3877 Tuple1<FrameMsg_Navigate_Params> nav_params; |
3878 FrameMsg_Navigate::Read(message, &nav_params); | 3878 FrameMsg_Navigate::Read(message, &nav_params); |
3879 EXPECT_EQ(url1, nav_params.a.url); | 3879 EXPECT_EQ(url1, nav_params.a.core_params.url); |
3880 process()->sink().ClearMessages(); | 3880 process()->sink().ClearMessages(); |
3881 | 3881 |
3882 // Now test history.forward() | 3882 // Now test history.forward() |
3883 contents()->OnGoToEntryAtOffset(2); | 3883 contents()->OnGoToEntryAtOffset(2); |
3884 EXPECT_EQ(2, controller.GetPendingEntryIndex()); | 3884 EXPECT_EQ(2, controller.GetPendingEntryIndex()); |
3885 // The actual cross-navigation is suspended until the current RVH tells us | 3885 // The actual cross-navigation is suspended until the current RVH tells us |
3886 // it unloaded, simulate that. | 3886 // it unloaded, simulate that. |
3887 contents()->ProceedWithCrossSiteNavigation(); | 3887 contents()->ProceedWithCrossSiteNavigation(); |
3888 message = process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID); | 3888 message = process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID); |
3889 ASSERT_TRUE(message != NULL); | 3889 ASSERT_TRUE(message != NULL); |
3890 FrameMsg_Navigate::Read(message, &nav_params); | 3890 FrameMsg_Navigate::Read(message, &nav_params); |
3891 EXPECT_EQ(url3, nav_params.a.url); | 3891 EXPECT_EQ(url3, nav_params.a.core_params.url); |
3892 process()->sink().ClearMessages(); | 3892 process()->sink().ClearMessages(); |
3893 | 3893 |
3894 controller.DiscardNonCommittedEntries(); | 3894 controller.DiscardNonCommittedEntries(); |
3895 | 3895 |
3896 // Make sure an extravagant history.go() doesn't break. | 3896 // Make sure an extravagant history.go() doesn't break. |
3897 contents()->OnGoToEntryAtOffset(120); // Out of bounds. | 3897 contents()->OnGoToEntryAtOffset(120); // Out of bounds. |
3898 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); | 3898 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); |
3899 message = process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID); | 3899 message = process()->sink().GetFirstMessageMatching(FrameMsg_Navigate::ID); |
3900 EXPECT_TRUE(message == NULL); | 3900 EXPECT_TRUE(message == NULL); |
3901 } | 3901 } |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4335 params.post_id = -1; | 4335 params.post_id = -1; |
4336 test_rvh()->SendNavigateWithParams(¶ms); | 4336 test_rvh()->SendNavigateWithParams(¶ms); |
4337 | 4337 |
4338 // Now reload. replaceState overrides the POST, so we should not show a | 4338 // Now reload. replaceState overrides the POST, so we should not show a |
4339 // repost warning dialog. | 4339 // repost warning dialog. |
4340 controller_impl().Reload(true); | 4340 controller_impl().Reload(true); |
4341 EXPECT_EQ(0, delegate->repost_form_warning_count()); | 4341 EXPECT_EQ(0, delegate->repost_form_warning_count()); |
4342 } | 4342 } |
4343 | 4343 |
4344 } // namespace content | 4344 } // namespace content |
OLD | NEW |