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