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