| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "content/public/test/test_notification_tracker.h" | 31 #include "content/public/test/test_notification_tracker.h" |
| 32 #include "net/base/net_util.h" | 32 #include "net/base/net_util.h" |
| 33 #include "testing/gtest/include/gtest/gtest.h" | 33 #include "testing/gtest/include/gtest/gtest.h" |
| 34 #include "webkit/glue/webkit_glue.h" | 34 #include "webkit/glue/webkit_glue.h" |
| 35 | 35 |
| 36 using base::Time; | 36 using base::Time; |
| 37 using content::NavigationController; | 37 using content::NavigationController; |
| 38 using content::NavigationEntry; | 38 using content::NavigationEntry; |
| 39 using content::NavigationEntryImpl; | 39 using content::NavigationEntryImpl; |
| 40 using content::RenderViewHostImplTestHarness; | 40 using content::RenderViewHostImplTestHarness; |
| 41 using content::SessionStorageNamespaceMap; |
| 41 using content::SiteInstance; | 42 using content::SiteInstance; |
| 42 using content::TestNotificationTracker; | 43 using content::TestNotificationTracker; |
| 43 using content::TestRenderViewHost; | 44 using content::TestRenderViewHost; |
| 44 using content::TestWebContents; | 45 using content::TestWebContents; |
| 45 using content::WebContents; | 46 using content::WebContents; |
| 46 | 47 |
| 47 // NavigationControllerTest ---------------------------------------------------- | 48 // NavigationControllerTest ---------------------------------------------------- |
| 48 | 49 |
| 49 class NavigationControllerTest : public RenderViewHostImplTestHarness { | 50 class NavigationControllerTest : public RenderViewHostImplTestHarness { |
| 50 public: | 51 public: |
| (...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1571 // Create a NavigationController with a restored set of tabs. | 1572 // Create a NavigationController with a restored set of tabs. |
| 1572 GURL url("http://foo"); | 1573 GURL url("http://foo"); |
| 1573 std::vector<NavigationEntry*> entries; | 1574 std::vector<NavigationEntry*> entries; |
| 1574 NavigationEntry* entry = NavigationControllerImpl::CreateNavigationEntry( | 1575 NavigationEntry* entry = NavigationControllerImpl::CreateNavigationEntry( |
| 1575 url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false, | 1576 url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false, |
| 1576 std::string(), browser_context()); | 1577 std::string(), browser_context()); |
| 1577 entry->SetPageID(0); | 1578 entry->SetPageID(0); |
| 1578 entry->SetTitle(ASCIIToUTF16("Title")); | 1579 entry->SetTitle(ASCIIToUTF16("Title")); |
| 1579 entry->SetContentState("state"); | 1580 entry->SetContentState("state"); |
| 1580 entries.push_back(entry); | 1581 entries.push_back(entry); |
| 1581 WebContentsImpl our_contents( | 1582 scoped_ptr<WebContentsImpl> our_contents( |
| 1582 browser_context(), NULL, MSG_ROUTING_NONE, NULL, NULL, NULL); | 1583 WebContentsImpl::Create(browser_context(), NULL, MSG_ROUTING_NONE, |
| 1583 NavigationControllerImpl& our_controller = our_contents.GetControllerImpl(); | 1584 NULL)); |
| 1585 NavigationControllerImpl& our_controller = our_contents->GetController(); |
| 1584 our_controller.Restore(0, true, &entries); | 1586 our_controller.Restore(0, true, &entries); |
| 1585 ASSERT_EQ(0u, entries.size()); | 1587 ASSERT_EQ(0u, entries.size()); |
| 1586 | 1588 |
| 1587 // Before navigating to the restored entry, it should have a restore_type | 1589 // Before navigating to the restored entry, it should have a restore_type |
| 1588 // and no SiteInstance. | 1590 // and no SiteInstance. |
| 1589 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION, | 1591 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION, |
| 1590 NavigationEntryImpl::FromNavigationEntry( | 1592 NavigationEntryImpl::FromNavigationEntry( |
| 1591 our_controller.GetEntryAtIndex(0))->restore_type()); | 1593 our_controller.GetEntryAtIndex(0))->restore_type()); |
| 1592 EXPECT_FALSE(NavigationEntryImpl::FromNavigationEntry( | 1594 EXPECT_FALSE(NavigationEntryImpl::FromNavigationEntry( |
| 1593 our_controller.GetEntryAtIndex(0))->site_instance()); | 1595 our_controller.GetEntryAtIndex(0))->site_instance()); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 // Create a NavigationController with a restored set of tabs. | 1640 // Create a NavigationController with a restored set of tabs. |
| 1639 GURL url("http://foo"); | 1641 GURL url("http://foo"); |
| 1640 std::vector<NavigationEntry*> entries; | 1642 std::vector<NavigationEntry*> entries; |
| 1641 NavigationEntry* entry = NavigationControllerImpl::CreateNavigationEntry( | 1643 NavigationEntry* entry = NavigationControllerImpl::CreateNavigationEntry( |
| 1642 url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false, | 1644 url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false, |
| 1643 std::string(), browser_context()); | 1645 std::string(), browser_context()); |
| 1644 entry->SetPageID(0); | 1646 entry->SetPageID(0); |
| 1645 entry->SetTitle(ASCIIToUTF16("Title")); | 1647 entry->SetTitle(ASCIIToUTF16("Title")); |
| 1646 entry->SetContentState("state"); | 1648 entry->SetContentState("state"); |
| 1647 entries.push_back(entry); | 1649 entries.push_back(entry); |
| 1648 WebContentsImpl our_contents( | 1650 scoped_ptr<WebContentsImpl> our_contents( |
| 1649 browser_context(), NULL, MSG_ROUTING_NONE, NULL, NULL, NULL); | 1651 WebContentsImpl::Create(browser_context(), NULL, MSG_ROUTING_NONE, |
| 1650 NavigationControllerImpl& our_controller = our_contents.GetControllerImpl(); | 1652 NULL)); |
| 1653 NavigationControllerImpl& our_controller = our_contents->GetController(); |
| 1651 our_controller.Restore(0, true, &entries); | 1654 our_controller.Restore(0, true, &entries); |
| 1652 ASSERT_EQ(0u, entries.size()); | 1655 ASSERT_EQ(0u, entries.size()); |
| 1653 | 1656 |
| 1654 // Before navigating to the restored entry, it should have a restore_type | 1657 // Before navigating to the restored entry, it should have a restore_type |
| 1655 // and no SiteInstance. | 1658 // and no SiteInstance. |
| 1656 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION, | 1659 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION, |
| 1657 NavigationEntryImpl::FromNavigationEntry( | 1660 NavigationEntryImpl::FromNavigationEntry( |
| 1658 our_controller.GetEntryAtIndex(0))->restore_type()); | 1661 our_controller.GetEntryAtIndex(0))->restore_type()); |
| 1659 EXPECT_FALSE(NavigationEntryImpl::FromNavigationEntry( | 1662 EXPECT_FALSE(NavigationEntryImpl::FromNavigationEntry( |
| 1660 our_controller.GetEntryAtIndex(0))->site_instance()); | 1663 our_controller.GetEntryAtIndex(0))->site_instance()); |
| 1661 | 1664 |
| 1662 // After navigating, we should have one entry, and it should be "pending". | 1665 // After navigating, we should have one entry, and it should be "pending". |
| 1663 // It should now have a SiteInstance and no restore_type. | 1666 // It should now have a SiteInstance and no restore_type. |
| 1664 our_controller.GoToIndex(0); | 1667 our_controller.GoToIndex(0); |
| 1665 EXPECT_EQ(1, our_controller.GetEntryCount()); | 1668 EXPECT_EQ(1, our_controller.GetEntryCount()); |
| 1666 EXPECT_EQ(our_controller.GetEntryAtIndex(0), | 1669 EXPECT_EQ(our_controller.GetEntryAtIndex(0), |
| 1667 our_controller.GetPendingEntry()); | 1670 our_controller.GetPendingEntry()); |
| 1668 EXPECT_EQ(0, our_controller.GetEntryAtIndex(0)->GetPageID()); | 1671 EXPECT_EQ(0, our_controller.GetEntryAtIndex(0)->GetPageID()); |
| 1669 EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, | 1672 EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, |
| 1670 NavigationEntryImpl::FromNavigationEntry( | 1673 NavigationEntryImpl::FromNavigationEntry( |
| 1671 our_controller.GetEntryAtIndex(0))->restore_type()); | 1674 our_controller.GetEntryAtIndex(0))->restore_type()); |
| 1672 EXPECT_TRUE(NavigationEntryImpl::FromNavigationEntry( | 1675 EXPECT_TRUE(NavigationEntryImpl::FromNavigationEntry( |
| 1673 our_controller.GetEntryAtIndex(0))->site_instance()); | 1676 our_controller.GetEntryAtIndex(0))->site_instance()); |
| 1674 | 1677 |
| 1675 // This pending navigation may have caused a different navigation to fail, | 1678 // This pending navigation may have caused a different navigation to fail, |
| 1676 // which causes the pending entry to be cleared. | 1679 // which causes the pending entry to be cleared. |
| 1677 TestRenderViewHost* rvh = | 1680 TestRenderViewHost* rvh = |
| 1678 static_cast<TestRenderViewHost*>(our_contents.GetRenderViewHost()); | 1681 static_cast<TestRenderViewHost*>(our_contents->GetRenderViewHost()); |
| 1679 ViewHostMsg_DidFailProvisionalLoadWithError_Params fail_load_params; | 1682 ViewHostMsg_DidFailProvisionalLoadWithError_Params fail_load_params; |
| 1680 fail_load_params.frame_id = 1; | 1683 fail_load_params.frame_id = 1; |
| 1681 fail_load_params.is_main_frame = true; | 1684 fail_load_params.is_main_frame = true; |
| 1682 fail_load_params.error_code = net::ERR_ABORTED; | 1685 fail_load_params.error_code = net::ERR_ABORTED; |
| 1683 fail_load_params.error_description = string16(); | 1686 fail_load_params.error_description = string16(); |
| 1684 fail_load_params.url = url; | 1687 fail_load_params.url = url; |
| 1685 fail_load_params.showing_repost_interstitial = false; | 1688 fail_load_params.showing_repost_interstitial = false; |
| 1686 rvh->OnMessageReceived( | 1689 rvh->OnMessageReceived( |
| 1687 ViewHostMsg_DidFailProvisionalLoadWithError(0, // routing_id | 1690 ViewHostMsg_DidFailProvisionalLoadWithError(0, // routing_id |
| 1688 fail_load_params)); | 1691 fail_load_params)); |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2107 const GURL url1("http://foo1"); | 2110 const GURL url1("http://foo1"); |
| 2108 const GURL url2("http://foo2"); | 2111 const GURL url2("http://foo2"); |
| 2109 | 2112 |
| 2110 NavigateAndCommit(url1); | 2113 NavigateAndCommit(url1); |
| 2111 NavigateAndCommit(url2); | 2114 NavigateAndCommit(url2); |
| 2112 controller.GoBack(); | 2115 controller.GoBack(); |
| 2113 contents()->CommitPendingNavigation(); | 2116 contents()->CommitPendingNavigation(); |
| 2114 | 2117 |
| 2115 scoped_ptr<TestWebContents> other_contents( | 2118 scoped_ptr<TestWebContents> other_contents( |
| 2116 static_cast<TestWebContents*>(CreateTestWebContents())); | 2119 static_cast<TestWebContents*>(CreateTestWebContents())); |
| 2117 NavigationControllerImpl& other_controller = | 2120 NavigationControllerImpl& other_controller = other_contents->GetController(); |
| 2118 other_contents->GetControllerImpl(); | |
| 2119 other_controller.CopyStateFrom(controller); | 2121 other_controller.CopyStateFrom(controller); |
| 2120 | 2122 |
| 2121 // other_controller should now contain 2 urls. | 2123 // other_controller should now contain 2 urls. |
| 2122 ASSERT_EQ(2, other_controller.GetEntryCount()); | 2124 ASSERT_EQ(2, other_controller.GetEntryCount()); |
| 2123 // We should be looking at the first one. | 2125 // We should be looking at the first one. |
| 2124 ASSERT_EQ(0, other_controller.GetCurrentEntryIndex()); | 2126 ASSERT_EQ(0, other_controller.GetCurrentEntryIndex()); |
| 2125 | 2127 |
| 2126 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->GetURL()); | 2128 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->GetURL()); |
| 2127 EXPECT_EQ(0, other_controller.GetEntryAtIndex(0)->GetPageID()); | 2129 EXPECT_EQ(0, other_controller.GetEntryAtIndex(0)->GetPageID()); |
| 2128 EXPECT_EQ(url2, other_controller.GetEntryAtIndex(1)->GetURL()); | 2130 EXPECT_EQ(url2, other_controller.GetEntryAtIndex(1)->GetURL()); |
| 2129 // This is a different site than url1, so the IDs start again at 0. | 2131 // This is a different site than url1, so the IDs start again at 0. |
| 2130 EXPECT_EQ(0, other_controller.GetEntryAtIndex(1)->GetPageID()); | 2132 EXPECT_EQ(0, other_controller.GetEntryAtIndex(1)->GetPageID()); |
| 2131 | 2133 |
| 2132 // The max page ID map should be copied over and updated with the max page ID | 2134 // The max page ID map should be copied over and updated with the max page ID |
| 2133 // from the current tab. | 2135 // from the current tab. |
| 2134 SiteInstance* instance1 = | 2136 SiteInstance* instance1 = |
| 2135 GetSiteInstanceFromEntry(other_controller.GetEntryAtIndex(0)); | 2137 GetSiteInstanceFromEntry(other_controller.GetEntryAtIndex(0)); |
| 2136 EXPECT_EQ(0, other_contents->GetMaxPageIDForSiteInstance(instance1)); | 2138 EXPECT_EQ(0, other_contents->GetMaxPageIDForSiteInstance(instance1)); |
| 2139 |
| 2140 // Ensure the SessionStorageNamespaceMaps are the same size and have |
| 2141 // the same partitons loaded. |
| 2142 // |
| 2143 // TODO(ajwong): We should load up a url from a different partition above. |
| 2144 const SessionStorageNamespaceMap& session_storage_namespace_map = |
| 2145 controller.GetSessionStorageNamespaceMap(); |
| 2146 const SessionStorageNamespaceMap& other_session_storage_namespace_map = |
| 2147 other_controller.GetSessionStorageNamespaceMap(); |
| 2148 EXPECT_EQ(session_storage_namespace_map.size(), |
| 2149 other_session_storage_namespace_map.size()); |
| 2150 for (SessionStorageNamespaceMap::const_iterator it = |
| 2151 session_storage_namespace_map.begin(); |
| 2152 it != session_storage_namespace_map.end(); |
| 2153 ++it) { |
| 2154 SessionStorageNamespaceMap::const_iterator other = |
| 2155 other_session_storage_namespace_map.find(it->first); |
| 2156 EXPECT_TRUE(other != other_session_storage_namespace_map.end()); |
| 2157 } |
| 2137 } | 2158 } |
| 2138 | 2159 |
| 2139 // Tests CopyStateFromAndPrune with 2 urls in source, 1 in dest. | 2160 // Tests CopyStateFromAndPrune with 2 urls in source, 1 in dest. |
| 2140 TEST_F(NavigationControllerTest, CopyStateFromAndPrune) { | 2161 TEST_F(NavigationControllerTest, CopyStateFromAndPrune) { |
| 2141 NavigationControllerImpl& controller = controller_impl(); | 2162 NavigationControllerImpl& controller = controller_impl(); |
| 2142 const GURL url1("http://foo/1"); | 2163 const GURL url1("http://foo/1"); |
| 2143 const GURL url2("http://foo/2"); | 2164 const GURL url2("http://foo/2"); |
| 2144 const GURL url3("http://foo/3"); | 2165 const GURL url3("http://foo/3"); |
| 2145 | 2166 |
| 2146 NavigateAndCommit(url1); | 2167 NavigateAndCommit(url1); |
| 2147 NavigateAndCommit(url2); | 2168 NavigateAndCommit(url2); |
| 2148 | 2169 |
| 2149 // First two entries should have the same SiteInstance. | 2170 // First two entries should have the same SiteInstance. |
| 2150 SiteInstance* instance1 = | 2171 SiteInstance* instance1 = |
| 2151 GetSiteInstanceFromEntry(controller.GetEntryAtIndex(0)); | 2172 GetSiteInstanceFromEntry(controller.GetEntryAtIndex(0)); |
| 2152 SiteInstance* instance2 = | 2173 SiteInstance* instance2 = |
| 2153 GetSiteInstanceFromEntry(controller.GetEntryAtIndex(1)); | 2174 GetSiteInstanceFromEntry(controller.GetEntryAtIndex(1)); |
| 2154 EXPECT_EQ(instance1, instance2); | 2175 EXPECT_EQ(instance1, instance2); |
| 2155 EXPECT_EQ(0, controller.GetEntryAtIndex(0)->GetPageID()); | 2176 EXPECT_EQ(0, controller.GetEntryAtIndex(0)->GetPageID()); |
| 2156 EXPECT_EQ(1, controller.GetEntryAtIndex(1)->GetPageID()); | 2177 EXPECT_EQ(1, controller.GetEntryAtIndex(1)->GetPageID()); |
| 2157 EXPECT_EQ(1, contents()->GetMaxPageIDForSiteInstance(instance1)); | 2178 EXPECT_EQ(1, contents()->GetMaxPageIDForSiteInstance(instance1)); |
| 2158 | 2179 |
| 2159 scoped_ptr<TestWebContents> other_contents( | 2180 scoped_ptr<TestWebContents> other_contents( |
| 2160 static_cast<TestWebContents*>(CreateTestWebContents())); | 2181 static_cast<TestWebContents*>(CreateTestWebContents())); |
| 2161 NavigationControllerImpl& other_controller = | 2182 NavigationControllerImpl& other_controller = other_contents->GetController(); |
| 2162 other_contents->GetControllerImpl(); | |
| 2163 other_contents->NavigateAndCommit(url3); | 2183 other_contents->NavigateAndCommit(url3); |
| 2164 other_contents->ExpectSetHistoryLengthAndPrune( | 2184 other_contents->ExpectSetHistoryLengthAndPrune( |
| 2165 GetSiteInstanceFromEntry(other_controller.GetEntryAtIndex(0)), 2, | 2185 GetSiteInstanceFromEntry(other_controller.GetEntryAtIndex(0)), 2, |
| 2166 other_controller.GetEntryAtIndex(0)->GetPageID()); | 2186 other_controller.GetEntryAtIndex(0)->GetPageID()); |
| 2167 other_controller.CopyStateFromAndPrune(&controller); | 2187 other_controller.CopyStateFromAndPrune(&controller); |
| 2168 | 2188 |
| 2169 // other_controller should now contain the 3 urls: url1, url2 and url3. | 2189 // other_controller should now contain the 3 urls: url1, url2 and url3. |
| 2170 | 2190 |
| 2171 ASSERT_EQ(3, other_controller.GetEntryCount()); | 2191 ASSERT_EQ(3, other_controller.GetEntryCount()); |
| 2172 | 2192 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2197 const GURL url1("http://foo1"); | 2217 const GURL url1("http://foo1"); |
| 2198 const GURL url2("http://foo2"); | 2218 const GURL url2("http://foo2"); |
| 2199 const GURL url3("http://foo3"); | 2219 const GURL url3("http://foo3"); |
| 2200 | 2220 |
| 2201 NavigateAndCommit(url1); | 2221 NavigateAndCommit(url1); |
| 2202 NavigateAndCommit(url2); | 2222 NavigateAndCommit(url2); |
| 2203 controller.GoBack(); | 2223 controller.GoBack(); |
| 2204 | 2224 |
| 2205 scoped_ptr<TestWebContents> other_contents( | 2225 scoped_ptr<TestWebContents> other_contents( |
| 2206 static_cast<TestWebContents*>(CreateTestWebContents())); | 2226 static_cast<TestWebContents*>(CreateTestWebContents())); |
| 2207 NavigationControllerImpl& other_controller = | 2227 NavigationControllerImpl& other_controller = other_contents->GetController(); |
| 2208 other_contents->GetControllerImpl(); | |
| 2209 other_contents->ExpectSetHistoryLengthAndPrune(NULL, 1, -1); | 2228 other_contents->ExpectSetHistoryLengthAndPrune(NULL, 1, -1); |
| 2210 other_controller.CopyStateFromAndPrune(&controller); | 2229 other_controller.CopyStateFromAndPrune(&controller); |
| 2211 | 2230 |
| 2212 // other_controller should now contain the 1 url: url1. | 2231 // other_controller should now contain the 1 url: url1. |
| 2213 | 2232 |
| 2214 ASSERT_EQ(1, other_controller.GetEntryCount()); | 2233 ASSERT_EQ(1, other_controller.GetEntryCount()); |
| 2215 | 2234 |
| 2216 ASSERT_EQ(0, other_controller.GetCurrentEntryIndex()); | 2235 ASSERT_EQ(0, other_controller.GetCurrentEntryIndex()); |
| 2217 | 2236 |
| 2218 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->GetURL()); | 2237 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->GetURL()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2232 const GURL url1("http://foo1"); | 2251 const GURL url1("http://foo1"); |
| 2233 const GURL url2("http://foo2"); | 2252 const GURL url2("http://foo2"); |
| 2234 const GURL url3("http://foo3"); | 2253 const GURL url3("http://foo3"); |
| 2235 | 2254 |
| 2236 NavigateAndCommit(url1); | 2255 NavigateAndCommit(url1); |
| 2237 NavigateAndCommit(url2); | 2256 NavigateAndCommit(url2); |
| 2238 controller.GoBack(); | 2257 controller.GoBack(); |
| 2239 | 2258 |
| 2240 scoped_ptr<TestWebContents> other_contents( | 2259 scoped_ptr<TestWebContents> other_contents( |
| 2241 static_cast<TestWebContents*>(CreateTestWebContents())); | 2260 static_cast<TestWebContents*>(CreateTestWebContents())); |
| 2242 NavigationControllerImpl& other_controller = | 2261 NavigationControllerImpl& other_controller = other_contents->GetController(); |
| 2243 other_contents->GetControllerImpl(); | |
| 2244 other_controller.LoadURL( | 2262 other_controller.LoadURL( |
| 2245 url3, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); | 2263 url3, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); |
| 2246 other_contents->ExpectSetHistoryLengthAndPrune(NULL, 1, -1); | 2264 other_contents->ExpectSetHistoryLengthAndPrune(NULL, 1, -1); |
| 2247 other_controller.CopyStateFromAndPrune(&controller); | 2265 other_controller.CopyStateFromAndPrune(&controller); |
| 2248 | 2266 |
| 2249 // other_controller should now contain 1 entry for url1, and a pending entry | 2267 // other_controller should now contain 1 entry for url1, and a pending entry |
| 2250 // for url3. | 2268 // for url3. |
| 2251 | 2269 |
| 2252 ASSERT_EQ(1, other_controller.GetEntryCount()); | 2270 ASSERT_EQ(1, other_controller.GetEntryCount()); |
| 2253 | 2271 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2283 | 2301 |
| 2284 // Create a PrunedListener to observe prune notifications. | 2302 // Create a PrunedListener to observe prune notifications. |
| 2285 PrunedListener listener(&controller); | 2303 PrunedListener listener(&controller); |
| 2286 | 2304 |
| 2287 NavigateAndCommit(url1); | 2305 NavigateAndCommit(url1); |
| 2288 NavigateAndCommit(url2); | 2306 NavigateAndCommit(url2); |
| 2289 NavigateAndCommit(url3); | 2307 NavigateAndCommit(url3); |
| 2290 | 2308 |
| 2291 scoped_ptr<TestWebContents> other_contents( | 2309 scoped_ptr<TestWebContents> other_contents( |
| 2292 static_cast<TestWebContents*>(CreateTestWebContents())); | 2310 static_cast<TestWebContents*>(CreateTestWebContents())); |
| 2293 NavigationControllerImpl& other_controller = | 2311 NavigationControllerImpl& other_controller = other_contents->GetController(); |
| 2294 other_contents->GetControllerImpl(); | |
| 2295 other_contents->NavigateAndCommit(url4); | 2312 other_contents->NavigateAndCommit(url4); |
| 2296 other_contents->ExpectSetHistoryLengthAndPrune( | 2313 other_contents->ExpectSetHistoryLengthAndPrune( |
| 2297 GetSiteInstanceFromEntry(other_controller.GetEntryAtIndex(0)), 2, | 2314 GetSiteInstanceFromEntry(other_controller.GetEntryAtIndex(0)), 2, |
| 2298 other_controller.GetEntryAtIndex(0)->GetPageID()); | 2315 other_controller.GetEntryAtIndex(0)->GetPageID()); |
| 2299 other_controller.CopyStateFromAndPrune(&controller); | 2316 other_controller.CopyStateFromAndPrune(&controller); |
| 2300 | 2317 |
| 2301 // We should have received a pruned notification. | 2318 // We should have received a pruned notification. |
| 2302 EXPECT_EQ(1, listener.notification_count_); | 2319 EXPECT_EQ(1, listener.notification_count_); |
| 2303 EXPECT_TRUE(listener.details_.from_front); | 2320 EXPECT_TRUE(listener.details_.from_front); |
| 2304 EXPECT_EQ(1, listener.details_.count); | 2321 EXPECT_EQ(1, listener.details_.count); |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2655 TabNavigation nav(0, url0, GURL(), string16(), | 2672 TabNavigation nav(0, url0, GURL(), string16(), |
| 2656 webkit_glue::CreateHistoryStateForURL(url0), | 2673 webkit_glue::CreateHistoryStateForURL(url0), |
| 2657 content::PAGE_TRANSITION_LINK); | 2674 content::PAGE_TRANSITION_LINK); |
| 2658 session_helper_.AssertNavigationEquals(nav, | 2675 session_helper_.AssertNavigationEquals(nav, |
| 2659 windows_[0]->tabs[0]->navigations[0]); | 2676 windows_[0]->tabs[0]->navigations[0]); |
| 2660 nav.set_url(url2); | 2677 nav.set_url(url2); |
| 2661 session_helper_.AssertNavigationEquals(nav, | 2678 session_helper_.AssertNavigationEquals(nav, |
| 2662 windows_[0]->tabs[0]->navigations[1]); | 2679 windows_[0]->tabs[0]->navigations[1]); |
| 2663 } | 2680 } |
| 2664 */ | 2681 */ |
| OLD | NEW |