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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 2032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2043 EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), params, | 2043 EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), params, |
2044 &details)); | 2044 &details)); |
2045 EXPECT_EQ(1U, navigation_entry_committed_counter_); | 2045 EXPECT_EQ(1U, navigation_entry_committed_counter_); |
2046 navigation_entry_committed_counter_ = 0; | 2046 navigation_entry_committed_counter_ = 0; |
2047 EXPECT_EQ(2, controller.GetEntryCount()); | 2047 EXPECT_EQ(2, controller.GetEntryCount()); |
2048 | 2048 |
2049 // Second manual subframe navigation should also make a new entry. | 2049 // Second manual subframe navigation should also make a new entry. |
2050 const GURL url3("http://foo3"); | 2050 const GURL url3("http://foo3"); |
2051 params.page_id = 2; | 2051 params.page_id = 2; |
2052 params.url = url3; | 2052 params.url = url3; |
| 2053 params.transition = ui::PAGE_TRANSITION_MANUAL_SUBFRAME; |
2053 EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), params, | 2054 EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), params, |
2054 &details)); | 2055 &details)); |
2055 EXPECT_EQ(1U, navigation_entry_committed_counter_); | 2056 EXPECT_EQ(1U, navigation_entry_committed_counter_); |
2056 navigation_entry_committed_counter_ = 0; | 2057 navigation_entry_committed_counter_ = 0; |
2057 EXPECT_EQ(3, controller.GetEntryCount()); | 2058 EXPECT_EQ(3, controller.GetEntryCount()); |
2058 EXPECT_EQ(2, controller.GetCurrentEntryIndex()); | 2059 EXPECT_EQ(2, controller.GetCurrentEntryIndex()); |
2059 | 2060 |
2060 // Go back one. | 2061 // Go back one. |
2061 controller.GoBack(); | 2062 controller.GoBack(); |
| 2063 params.page_id = 1; |
2062 params.url = url2; | 2064 params.url = url2; |
2063 params.page_id = 1; | 2065 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; |
2064 EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), params, | 2066 EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), params, |
2065 &details)); | 2067 &details)); |
2066 EXPECT_EQ(1U, navigation_entry_committed_counter_); | 2068 EXPECT_EQ(1U, navigation_entry_committed_counter_); |
2067 navigation_entry_committed_counter_ = 0; | 2069 navigation_entry_committed_counter_ = 0; |
2068 EXPECT_EQ(3, controller.GetEntryCount()); | 2070 EXPECT_EQ(3, controller.GetEntryCount()); |
2069 EXPECT_EQ(1, controller.GetCurrentEntryIndex()); | 2071 EXPECT_EQ(1, controller.GetCurrentEntryIndex()); |
2070 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); | 2072 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); |
2071 EXPECT_FALSE(controller.GetPendingEntry()); | 2073 EXPECT_FALSE(controller.GetPendingEntry()); |
2072 | 2074 |
2073 // Go back one more. | 2075 // Go back one more. |
2074 controller.GoBack(); | 2076 controller.GoBack(); |
| 2077 params.page_id = 0; |
2075 params.url = url1; | 2078 params.url = url1; |
2076 params.page_id = 0; | 2079 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; |
2077 EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), params, | 2080 EXPECT_TRUE(controller.RendererDidNavigate(main_test_rfh(), params, |
2078 &details)); | 2081 &details)); |
2079 EXPECT_EQ(1U, navigation_entry_committed_counter_); | 2082 EXPECT_EQ(1U, navigation_entry_committed_counter_); |
2080 navigation_entry_committed_counter_ = 0; | 2083 navigation_entry_committed_counter_ = 0; |
2081 EXPECT_EQ(3, controller.GetEntryCount()); | 2084 EXPECT_EQ(3, controller.GetEntryCount()); |
2082 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); | 2085 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); |
2083 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); | 2086 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); |
2084 EXPECT_FALSE(controller.GetPendingEntry()); | 2087 EXPECT_FALSE(controller.GetPendingEntry()); |
2085 } | 2088 } |
2086 | 2089 |
(...skipping 2433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4520 params.post_id = -1; | 4523 params.post_id = -1; |
4521 contents()->GetMainFrame()->SendNavigateWithParams(¶ms); | 4524 contents()->GetMainFrame()->SendNavigateWithParams(¶ms); |
4522 | 4525 |
4523 // Now reload. replaceState overrides the POST, so we should not show a | 4526 // Now reload. replaceState overrides the POST, so we should not show a |
4524 // repost warning dialog. | 4527 // repost warning dialog. |
4525 controller_impl().Reload(true); | 4528 controller_impl().Reload(true); |
4526 EXPECT_EQ(0, delegate->repost_form_warning_count()); | 4529 EXPECT_EQ(0, delegate->repost_form_warning_count()); |
4527 } | 4530 } |
4528 | 4531 |
4529 } // namespace content | 4532 } // namespace content |
OLD | NEW |