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 22 matching lines...) Expand all Loading... |
33 #include "content/public/test/test_notification_tracker.h" | 33 #include "content/public/test/test_notification_tracker.h" |
34 #include "net/base/net_util.h" | 34 #include "net/base/net_util.h" |
35 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
36 #include "webkit/glue/webkit_glue.h" | 36 #include "webkit/glue/webkit_glue.h" |
37 | 37 |
38 using base::Time; | 38 using base::Time; |
39 using content::NavigationController; | 39 using content::NavigationController; |
40 using content::NavigationEntry; | 40 using content::NavigationEntry; |
41 using content::NavigationEntryImpl; | 41 using content::NavigationEntryImpl; |
42 using content::RenderViewHostImplTestHarness; | 42 using content::RenderViewHostImplTestHarness; |
| 43 using content::SessionStorageNamespaceMap; |
43 using content::SiteInstance; | 44 using content::SiteInstance; |
44 using content::TestNotificationTracker; | 45 using content::TestNotificationTracker; |
45 using content::TestRenderViewHost; | 46 using content::TestRenderViewHost; |
46 using content::TestWebContents; | 47 using content::TestWebContents; |
47 using content::WebContents; | 48 using content::WebContents; |
48 | 49 |
49 // NavigationControllerTest ---------------------------------------------------- | 50 // NavigationControllerTest ---------------------------------------------------- |
50 | 51 |
51 class NavigationControllerTest : public RenderViewHostImplTestHarness { | 52 class NavigationControllerTest : public RenderViewHostImplTestHarness { |
52 public: | 53 public: |
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1649 // Create a NavigationController with a restored set of tabs. | 1650 // Create a NavigationController with a restored set of tabs. |
1650 GURL url("http://foo"); | 1651 GURL url("http://foo"); |
1651 std::vector<NavigationEntry*> entries; | 1652 std::vector<NavigationEntry*> entries; |
1652 NavigationEntry* entry = NavigationControllerImpl::CreateNavigationEntry( | 1653 NavigationEntry* entry = NavigationControllerImpl::CreateNavigationEntry( |
1653 url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false, | 1654 url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false, |
1654 std::string(), browser_context()); | 1655 std::string(), browser_context()); |
1655 entry->SetPageID(0); | 1656 entry->SetPageID(0); |
1656 entry->SetTitle(ASCIIToUTF16("Title")); | 1657 entry->SetTitle(ASCIIToUTF16("Title")); |
1657 entry->SetContentState("state"); | 1658 entry->SetContentState("state"); |
1658 entries.push_back(entry); | 1659 entries.push_back(entry); |
1659 WebContentsImpl our_contents( | 1660 scoped_ptr<WebContentsImpl> our_contents( |
1660 browser_context(), NULL, MSG_ROUTING_NONE, NULL, NULL, NULL); | 1661 WebContentsImpl::Create(browser_context(), NULL, MSG_ROUTING_NONE, |
1661 NavigationControllerImpl& our_controller = our_contents.GetControllerImpl(); | 1662 NULL)); |
| 1663 NavigationControllerImpl& our_controller = our_contents->GetController(); |
1662 our_controller.Restore(0, true, &entries); | 1664 our_controller.Restore(0, true, &entries); |
1663 ASSERT_EQ(0u, entries.size()); | 1665 ASSERT_EQ(0u, entries.size()); |
1664 | 1666 |
1665 // Before navigating to the restored entry, it should have a restore_type | 1667 // Before navigating to the restored entry, it should have a restore_type |
1666 // and no SiteInstance. | 1668 // and no SiteInstance. |
1667 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION, | 1669 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION, |
1668 NavigationEntryImpl::FromNavigationEntry( | 1670 NavigationEntryImpl::FromNavigationEntry( |
1669 our_controller.GetEntryAtIndex(0))->restore_type()); | 1671 our_controller.GetEntryAtIndex(0))->restore_type()); |
1670 EXPECT_FALSE(NavigationEntryImpl::FromNavigationEntry( | 1672 EXPECT_FALSE(NavigationEntryImpl::FromNavigationEntry( |
1671 our_controller.GetEntryAtIndex(0))->site_instance()); | 1673 our_controller.GetEntryAtIndex(0))->site_instance()); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1716 // Create a NavigationController with a restored set of tabs. | 1718 // Create a NavigationController with a restored set of tabs. |
1717 GURL url("http://foo"); | 1719 GURL url("http://foo"); |
1718 std::vector<NavigationEntry*> entries; | 1720 std::vector<NavigationEntry*> entries; |
1719 NavigationEntry* entry = NavigationControllerImpl::CreateNavigationEntry( | 1721 NavigationEntry* entry = NavigationControllerImpl::CreateNavigationEntry( |
1720 url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false, | 1722 url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false, |
1721 std::string(), browser_context()); | 1723 std::string(), browser_context()); |
1722 entry->SetPageID(0); | 1724 entry->SetPageID(0); |
1723 entry->SetTitle(ASCIIToUTF16("Title")); | 1725 entry->SetTitle(ASCIIToUTF16("Title")); |
1724 entry->SetContentState("state"); | 1726 entry->SetContentState("state"); |
1725 entries.push_back(entry); | 1727 entries.push_back(entry); |
1726 WebContentsImpl our_contents( | 1728 scoped_ptr<WebContentsImpl> our_contents( |
1727 browser_context(), NULL, MSG_ROUTING_NONE, NULL, NULL, NULL); | 1729 WebContentsImpl::Create(browser_context(), NULL, MSG_ROUTING_NONE, |
1728 NavigationControllerImpl& our_controller = our_contents.GetControllerImpl(); | 1730 NULL)); |
| 1731 NavigationControllerImpl& our_controller = our_contents->GetController(); |
1729 our_controller.Restore(0, true, &entries); | 1732 our_controller.Restore(0, true, &entries); |
1730 ASSERT_EQ(0u, entries.size()); | 1733 ASSERT_EQ(0u, entries.size()); |
1731 | 1734 |
1732 // Before navigating to the restored entry, it should have a restore_type | 1735 // Before navigating to the restored entry, it should have a restore_type |
1733 // and no SiteInstance. | 1736 // and no SiteInstance. |
1734 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION, | 1737 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION, |
1735 NavigationEntryImpl::FromNavigationEntry( | 1738 NavigationEntryImpl::FromNavigationEntry( |
1736 our_controller.GetEntryAtIndex(0))->restore_type()); | 1739 our_controller.GetEntryAtIndex(0))->restore_type()); |
1737 EXPECT_FALSE(NavigationEntryImpl::FromNavigationEntry( | 1740 EXPECT_FALSE(NavigationEntryImpl::FromNavigationEntry( |
1738 our_controller.GetEntryAtIndex(0))->site_instance()); | 1741 our_controller.GetEntryAtIndex(0))->site_instance()); |
1739 | 1742 |
1740 // After navigating, we should have one entry, and it should be "pending". | 1743 // After navigating, we should have one entry, and it should be "pending". |
1741 // It should now have a SiteInstance and no restore_type. | 1744 // It should now have a SiteInstance and no restore_type. |
1742 our_controller.GoToIndex(0); | 1745 our_controller.GoToIndex(0); |
1743 EXPECT_EQ(1, our_controller.GetEntryCount()); | 1746 EXPECT_EQ(1, our_controller.GetEntryCount()); |
1744 EXPECT_EQ(our_controller.GetEntryAtIndex(0), | 1747 EXPECT_EQ(our_controller.GetEntryAtIndex(0), |
1745 our_controller.GetPendingEntry()); | 1748 our_controller.GetPendingEntry()); |
1746 EXPECT_EQ(0, our_controller.GetEntryAtIndex(0)->GetPageID()); | 1749 EXPECT_EQ(0, our_controller.GetEntryAtIndex(0)->GetPageID()); |
1747 EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, | 1750 EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, |
1748 NavigationEntryImpl::FromNavigationEntry( | 1751 NavigationEntryImpl::FromNavigationEntry( |
1749 our_controller.GetEntryAtIndex(0))->restore_type()); | 1752 our_controller.GetEntryAtIndex(0))->restore_type()); |
1750 EXPECT_TRUE(NavigationEntryImpl::FromNavigationEntry( | 1753 EXPECT_TRUE(NavigationEntryImpl::FromNavigationEntry( |
1751 our_controller.GetEntryAtIndex(0))->site_instance()); | 1754 our_controller.GetEntryAtIndex(0))->site_instance()); |
1752 | 1755 |
1753 // This pending navigation may have caused a different navigation to fail, | 1756 // This pending navigation may have caused a different navigation to fail, |
1754 // which causes the pending entry to be cleared. | 1757 // which causes the pending entry to be cleared. |
1755 TestRenderViewHost* rvh = | 1758 TestRenderViewHost* rvh = |
1756 static_cast<TestRenderViewHost*>(our_contents.GetRenderViewHost()); | 1759 static_cast<TestRenderViewHost*>(our_contents->GetRenderViewHost()); |
1757 ViewHostMsg_DidFailProvisionalLoadWithError_Params fail_load_params; | 1760 ViewHostMsg_DidFailProvisionalLoadWithError_Params fail_load_params; |
1758 fail_load_params.frame_id = 1; | 1761 fail_load_params.frame_id = 1; |
1759 fail_load_params.is_main_frame = true; | 1762 fail_load_params.is_main_frame = true; |
1760 fail_load_params.error_code = net::ERR_ABORTED; | 1763 fail_load_params.error_code = net::ERR_ABORTED; |
1761 fail_load_params.error_description = string16(); | 1764 fail_load_params.error_description = string16(); |
1762 fail_load_params.url = url; | 1765 fail_load_params.url = url; |
1763 fail_load_params.showing_repost_interstitial = false; | 1766 fail_load_params.showing_repost_interstitial = false; |
1764 rvh->OnMessageReceived( | 1767 rvh->OnMessageReceived( |
1765 ViewHostMsg_DidFailProvisionalLoadWithError(0, // routing_id | 1768 ViewHostMsg_DidFailProvisionalLoadWithError(0, // routing_id |
1766 fail_load_params)); | 1769 fail_load_params)); |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2185 const GURL url1("http://foo1"); | 2188 const GURL url1("http://foo1"); |
2186 const GURL url2("http://foo2"); | 2189 const GURL url2("http://foo2"); |
2187 | 2190 |
2188 NavigateAndCommit(url1); | 2191 NavigateAndCommit(url1); |
2189 NavigateAndCommit(url2); | 2192 NavigateAndCommit(url2); |
2190 controller.GoBack(); | 2193 controller.GoBack(); |
2191 contents()->CommitPendingNavigation(); | 2194 contents()->CommitPendingNavigation(); |
2192 | 2195 |
2193 scoped_ptr<TestWebContents> other_contents( | 2196 scoped_ptr<TestWebContents> other_contents( |
2194 static_cast<TestWebContents*>(CreateTestWebContents())); | 2197 static_cast<TestWebContents*>(CreateTestWebContents())); |
2195 NavigationControllerImpl& other_controller = | 2198 NavigationControllerImpl& other_controller = other_contents->GetController(); |
2196 other_contents->GetControllerImpl(); | |
2197 other_controller.CopyStateFrom(controller); | 2199 other_controller.CopyStateFrom(controller); |
2198 | 2200 |
2199 // other_controller should now contain 2 urls. | 2201 // other_controller should now contain 2 urls. |
2200 ASSERT_EQ(2, other_controller.GetEntryCount()); | 2202 ASSERT_EQ(2, other_controller.GetEntryCount()); |
2201 // We should be looking at the first one. | 2203 // We should be looking at the first one. |
2202 ASSERT_EQ(0, other_controller.GetCurrentEntryIndex()); | 2204 ASSERT_EQ(0, other_controller.GetCurrentEntryIndex()); |
2203 | 2205 |
2204 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->GetURL()); | 2206 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->GetURL()); |
2205 EXPECT_EQ(0, other_controller.GetEntryAtIndex(0)->GetPageID()); | 2207 EXPECT_EQ(0, other_controller.GetEntryAtIndex(0)->GetPageID()); |
2206 EXPECT_EQ(url2, other_controller.GetEntryAtIndex(1)->GetURL()); | 2208 EXPECT_EQ(url2, other_controller.GetEntryAtIndex(1)->GetURL()); |
2207 // This is a different site than url1, so the IDs start again at 0. | 2209 // This is a different site than url1, so the IDs start again at 0. |
2208 EXPECT_EQ(0, other_controller.GetEntryAtIndex(1)->GetPageID()); | 2210 EXPECT_EQ(0, other_controller.GetEntryAtIndex(1)->GetPageID()); |
2209 | 2211 |
2210 // The max page ID map should be copied over and updated with the max page ID | 2212 // The max page ID map should be copied over and updated with the max page ID |
2211 // from the current tab. | 2213 // from the current tab. |
2212 SiteInstance* instance1 = | 2214 SiteInstance* instance1 = |
2213 GetSiteInstanceFromEntry(other_controller.GetEntryAtIndex(0)); | 2215 GetSiteInstanceFromEntry(other_controller.GetEntryAtIndex(0)); |
2214 EXPECT_EQ(0, other_contents->GetMaxPageIDForSiteInstance(instance1)); | 2216 EXPECT_EQ(0, other_contents->GetMaxPageIDForSiteInstance(instance1)); |
| 2217 |
| 2218 // Ensure the SessionStorageNamespaceMaps are the same size and have |
| 2219 // the same partitons loaded. |
| 2220 // |
| 2221 // TODO(ajwong): We should load a url from a different partition earlier |
| 2222 // to make sure this map has more than one entry. |
| 2223 const SessionStorageNamespaceMap& session_storage_namespace_map = |
| 2224 controller.GetSessionStorageNamespaceMap(); |
| 2225 const SessionStorageNamespaceMap& other_session_storage_namespace_map = |
| 2226 other_controller.GetSessionStorageNamespaceMap(); |
| 2227 EXPECT_EQ(session_storage_namespace_map.size(), |
| 2228 other_session_storage_namespace_map.size()); |
| 2229 for (SessionStorageNamespaceMap::const_iterator it = |
| 2230 session_storage_namespace_map.begin(); |
| 2231 it != session_storage_namespace_map.end(); |
| 2232 ++it) { |
| 2233 SessionStorageNamespaceMap::const_iterator other = |
| 2234 other_session_storage_namespace_map.find(it->first); |
| 2235 EXPECT_TRUE(other != other_session_storage_namespace_map.end()); |
| 2236 } |
2215 } | 2237 } |
2216 | 2238 |
2217 // Tests CopyStateFromAndPrune with 2 urls in source, 1 in dest. | 2239 // Tests CopyStateFromAndPrune with 2 urls in source, 1 in dest. |
2218 TEST_F(NavigationControllerTest, CopyStateFromAndPrune) { | 2240 TEST_F(NavigationControllerTest, CopyStateFromAndPrune) { |
2219 NavigationControllerImpl& controller = controller_impl(); | 2241 NavigationControllerImpl& controller = controller_impl(); |
2220 const GURL url1("http://foo/1"); | 2242 const GURL url1("http://foo/1"); |
2221 const GURL url2("http://foo/2"); | 2243 const GURL url2("http://foo/2"); |
2222 const GURL url3("http://foo/3"); | 2244 const GURL url3("http://foo/3"); |
2223 | 2245 |
2224 NavigateAndCommit(url1); | 2246 NavigateAndCommit(url1); |
2225 NavigateAndCommit(url2); | 2247 NavigateAndCommit(url2); |
2226 | 2248 |
2227 // First two entries should have the same SiteInstance. | 2249 // First two entries should have the same SiteInstance. |
2228 SiteInstance* instance1 = | 2250 SiteInstance* instance1 = |
2229 GetSiteInstanceFromEntry(controller.GetEntryAtIndex(0)); | 2251 GetSiteInstanceFromEntry(controller.GetEntryAtIndex(0)); |
2230 SiteInstance* instance2 = | 2252 SiteInstance* instance2 = |
2231 GetSiteInstanceFromEntry(controller.GetEntryAtIndex(1)); | 2253 GetSiteInstanceFromEntry(controller.GetEntryAtIndex(1)); |
2232 EXPECT_EQ(instance1, instance2); | 2254 EXPECT_EQ(instance1, instance2); |
2233 EXPECT_EQ(0, controller.GetEntryAtIndex(0)->GetPageID()); | 2255 EXPECT_EQ(0, controller.GetEntryAtIndex(0)->GetPageID()); |
2234 EXPECT_EQ(1, controller.GetEntryAtIndex(1)->GetPageID()); | 2256 EXPECT_EQ(1, controller.GetEntryAtIndex(1)->GetPageID()); |
2235 EXPECT_EQ(1, contents()->GetMaxPageIDForSiteInstance(instance1)); | 2257 EXPECT_EQ(1, contents()->GetMaxPageIDForSiteInstance(instance1)); |
2236 | 2258 |
2237 scoped_ptr<TestWebContents> other_contents( | 2259 scoped_ptr<TestWebContents> other_contents( |
2238 static_cast<TestWebContents*>(CreateTestWebContents())); | 2260 static_cast<TestWebContents*>(CreateTestWebContents())); |
2239 NavigationControllerImpl& other_controller = | 2261 NavigationControllerImpl& other_controller = other_contents->GetController(); |
2240 other_contents->GetControllerImpl(); | |
2241 other_contents->NavigateAndCommit(url3); | 2262 other_contents->NavigateAndCommit(url3); |
2242 other_contents->ExpectSetHistoryLengthAndPrune( | 2263 other_contents->ExpectSetHistoryLengthAndPrune( |
2243 GetSiteInstanceFromEntry(other_controller.GetEntryAtIndex(0)), 2, | 2264 GetSiteInstanceFromEntry(other_controller.GetEntryAtIndex(0)), 2, |
2244 other_controller.GetEntryAtIndex(0)->GetPageID()); | 2265 other_controller.GetEntryAtIndex(0)->GetPageID()); |
2245 other_controller.CopyStateFromAndPrune(&controller); | 2266 other_controller.CopyStateFromAndPrune(&controller); |
2246 | 2267 |
2247 // other_controller should now contain the 3 urls: url1, url2 and url3. | 2268 // other_controller should now contain the 3 urls: url1, url2 and url3. |
2248 | 2269 |
2249 ASSERT_EQ(3, other_controller.GetEntryCount()); | 2270 ASSERT_EQ(3, other_controller.GetEntryCount()); |
2250 | 2271 |
(...skipping 24 matching lines...) Expand all Loading... |
2275 const GURL url1("http://foo1"); | 2296 const GURL url1("http://foo1"); |
2276 const GURL url2("http://foo2"); | 2297 const GURL url2("http://foo2"); |
2277 const GURL url3("http://foo3"); | 2298 const GURL url3("http://foo3"); |
2278 | 2299 |
2279 NavigateAndCommit(url1); | 2300 NavigateAndCommit(url1); |
2280 NavigateAndCommit(url2); | 2301 NavigateAndCommit(url2); |
2281 controller.GoBack(); | 2302 controller.GoBack(); |
2282 | 2303 |
2283 scoped_ptr<TestWebContents> other_contents( | 2304 scoped_ptr<TestWebContents> other_contents( |
2284 static_cast<TestWebContents*>(CreateTestWebContents())); | 2305 static_cast<TestWebContents*>(CreateTestWebContents())); |
2285 NavigationControllerImpl& other_controller = | 2306 NavigationControllerImpl& other_controller = other_contents->GetController(); |
2286 other_contents->GetControllerImpl(); | |
2287 other_contents->ExpectSetHistoryLengthAndPrune(NULL, 1, -1); | 2307 other_contents->ExpectSetHistoryLengthAndPrune(NULL, 1, -1); |
2288 other_controller.CopyStateFromAndPrune(&controller); | 2308 other_controller.CopyStateFromAndPrune(&controller); |
2289 | 2309 |
2290 // other_controller should now contain the 1 url: url1. | 2310 // other_controller should now contain the 1 url: url1. |
2291 | 2311 |
2292 ASSERT_EQ(1, other_controller.GetEntryCount()); | 2312 ASSERT_EQ(1, other_controller.GetEntryCount()); |
2293 | 2313 |
2294 ASSERT_EQ(0, other_controller.GetCurrentEntryIndex()); | 2314 ASSERT_EQ(0, other_controller.GetCurrentEntryIndex()); |
2295 | 2315 |
2296 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->GetURL()); | 2316 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->GetURL()); |
(...skipping 13 matching lines...) Expand all Loading... |
2310 const GURL url1("http://foo1"); | 2330 const GURL url1("http://foo1"); |
2311 const GURL url2("http://foo2"); | 2331 const GURL url2("http://foo2"); |
2312 const GURL url3("http://foo3"); | 2332 const GURL url3("http://foo3"); |
2313 | 2333 |
2314 NavigateAndCommit(url1); | 2334 NavigateAndCommit(url1); |
2315 NavigateAndCommit(url2); | 2335 NavigateAndCommit(url2); |
2316 controller.GoBack(); | 2336 controller.GoBack(); |
2317 | 2337 |
2318 scoped_ptr<TestWebContents> other_contents( | 2338 scoped_ptr<TestWebContents> other_contents( |
2319 static_cast<TestWebContents*>(CreateTestWebContents())); | 2339 static_cast<TestWebContents*>(CreateTestWebContents())); |
2320 NavigationControllerImpl& other_controller = | 2340 NavigationControllerImpl& other_controller = other_contents->GetController(); |
2321 other_contents->GetControllerImpl(); | |
2322 other_controller.LoadURL( | 2341 other_controller.LoadURL( |
2323 url3, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); | 2342 url3, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); |
2324 other_contents->ExpectSetHistoryLengthAndPrune(NULL, 1, -1); | 2343 other_contents->ExpectSetHistoryLengthAndPrune(NULL, 1, -1); |
2325 other_controller.CopyStateFromAndPrune(&controller); | 2344 other_controller.CopyStateFromAndPrune(&controller); |
2326 | 2345 |
2327 // other_controller should now contain 1 entry for url1, and a pending entry | 2346 // other_controller should now contain 1 entry for url1, and a pending entry |
2328 // for url3. | 2347 // for url3. |
2329 | 2348 |
2330 ASSERT_EQ(1, other_controller.GetEntryCount()); | 2349 ASSERT_EQ(1, other_controller.GetEntryCount()); |
2331 | 2350 |
(...skipping 29 matching lines...) Expand all Loading... |
2361 | 2380 |
2362 // Create a PrunedListener to observe prune notifications. | 2381 // Create a PrunedListener to observe prune notifications. |
2363 PrunedListener listener(&controller); | 2382 PrunedListener listener(&controller); |
2364 | 2383 |
2365 NavigateAndCommit(url1); | 2384 NavigateAndCommit(url1); |
2366 NavigateAndCommit(url2); | 2385 NavigateAndCommit(url2); |
2367 NavigateAndCommit(url3); | 2386 NavigateAndCommit(url3); |
2368 | 2387 |
2369 scoped_ptr<TestWebContents> other_contents( | 2388 scoped_ptr<TestWebContents> other_contents( |
2370 static_cast<TestWebContents*>(CreateTestWebContents())); | 2389 static_cast<TestWebContents*>(CreateTestWebContents())); |
2371 NavigationControllerImpl& other_controller = | 2390 NavigationControllerImpl& other_controller = other_contents->GetController(); |
2372 other_contents->GetControllerImpl(); | |
2373 other_contents->NavigateAndCommit(url4); | 2391 other_contents->NavigateAndCommit(url4); |
2374 other_contents->ExpectSetHistoryLengthAndPrune( | 2392 other_contents->ExpectSetHistoryLengthAndPrune( |
2375 GetSiteInstanceFromEntry(other_controller.GetEntryAtIndex(0)), 2, | 2393 GetSiteInstanceFromEntry(other_controller.GetEntryAtIndex(0)), 2, |
2376 other_controller.GetEntryAtIndex(0)->GetPageID()); | 2394 other_controller.GetEntryAtIndex(0)->GetPageID()); |
2377 other_controller.CopyStateFromAndPrune(&controller); | 2395 other_controller.CopyStateFromAndPrune(&controller); |
2378 | 2396 |
2379 // We should have received a pruned notification. | 2397 // We should have received a pruned notification. |
2380 EXPECT_EQ(1, listener.notification_count_); | 2398 EXPECT_EQ(1, listener.notification_count_); |
2381 EXPECT_TRUE(listener.details_.from_front); | 2399 EXPECT_TRUE(listener.details_.from_front); |
2382 EXPECT_EQ(1, listener.details_.count); | 2400 EXPECT_EQ(1, listener.details_.count); |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2733 TabNavigation nav(0, url0, GURL(), string16(), | 2751 TabNavigation nav(0, url0, GURL(), string16(), |
2734 webkit_glue::CreateHistoryStateForURL(url0), | 2752 webkit_glue::CreateHistoryStateForURL(url0), |
2735 content::PAGE_TRANSITION_LINK); | 2753 content::PAGE_TRANSITION_LINK); |
2736 session_helper_.AssertNavigationEquals(nav, | 2754 session_helper_.AssertNavigationEquals(nav, |
2737 windows_[0]->tabs[0]->navigations[0]); | 2755 windows_[0]->tabs[0]->navigations[0]); |
2738 nav.set_url(url2); | 2756 nav.set_url(url2); |
2739 session_helper_.AssertNavigationEquals(nav, | 2757 session_helper_.AssertNavigationEquals(nav, |
2740 windows_[0]->tabs[0]->navigations[1]); | 2758 windows_[0]->tabs[0]->navigations[1]); |
2741 } | 2759 } |
2742 */ | 2760 */ |
OLD | NEW |