| 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 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1536 GURL url("http://foo"); | 1536 GURL url("http://foo"); |
| 1537 std::vector<NavigationEntry*> entries; | 1537 std::vector<NavigationEntry*> entries; |
| 1538 NavigationEntry* entry = NavigationControllerImpl::CreateNavigationEntry( | 1538 NavigationEntry* entry = NavigationControllerImpl::CreateNavigationEntry( |
| 1539 url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false, | 1539 url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false, |
| 1540 std::string(), browser_context()); | 1540 std::string(), browser_context()); |
| 1541 entry->SetPageID(0); | 1541 entry->SetPageID(0); |
| 1542 entry->SetTitle(ASCIIToUTF16("Title")); | 1542 entry->SetTitle(ASCIIToUTF16("Title")); |
| 1543 entry->SetContentState("state"); | 1543 entry->SetContentState("state"); |
| 1544 entries.push_back(entry); | 1544 entries.push_back(entry); |
| 1545 WebContentsImpl our_contents( | 1545 WebContentsImpl our_contents( |
| 1546 browser_context(), NULL, MSG_ROUTING_NONE, NULL, NULL); | 1546 browser_context(), NULL, MSG_ROUTING_NONE, NULL, NULL, NULL); |
| 1547 NavigationControllerImpl& our_controller = our_contents.GetControllerImpl(); | 1547 NavigationControllerImpl& our_controller = our_contents.GetControllerImpl(); |
| 1548 our_controller.Restore(0, true, &entries); | 1548 our_controller.Restore(0, true, &entries); |
| 1549 ASSERT_EQ(0u, entries.size()); | 1549 ASSERT_EQ(0u, entries.size()); |
| 1550 | 1550 |
| 1551 // Before navigating to the restored entry, it should have a restore_type | 1551 // Before navigating to the restored entry, it should have a restore_type |
| 1552 // and no SiteInstance. | 1552 // and no SiteInstance. |
| 1553 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION, | 1553 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION, |
| 1554 NavigationEntryImpl::FromNavigationEntry( | 1554 NavigationEntryImpl::FromNavigationEntry( |
| 1555 our_controller.GetEntryAtIndex(0))->restore_type()); | 1555 our_controller.GetEntryAtIndex(0))->restore_type()); |
| 1556 EXPECT_FALSE(NavigationEntryImpl::FromNavigationEntry( | 1556 EXPECT_FALSE(NavigationEntryImpl::FromNavigationEntry( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1603 GURL url("http://foo"); | 1603 GURL url("http://foo"); |
| 1604 std::vector<NavigationEntry*> entries; | 1604 std::vector<NavigationEntry*> entries; |
| 1605 NavigationEntry* entry = NavigationControllerImpl::CreateNavigationEntry( | 1605 NavigationEntry* entry = NavigationControllerImpl::CreateNavigationEntry( |
| 1606 url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false, | 1606 url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false, |
| 1607 std::string(), browser_context()); | 1607 std::string(), browser_context()); |
| 1608 entry->SetPageID(0); | 1608 entry->SetPageID(0); |
| 1609 entry->SetTitle(ASCIIToUTF16("Title")); | 1609 entry->SetTitle(ASCIIToUTF16("Title")); |
| 1610 entry->SetContentState("state"); | 1610 entry->SetContentState("state"); |
| 1611 entries.push_back(entry); | 1611 entries.push_back(entry); |
| 1612 WebContentsImpl our_contents( | 1612 WebContentsImpl our_contents( |
| 1613 browser_context(), NULL, MSG_ROUTING_NONE, NULL, NULL); | 1613 browser_context(), NULL, MSG_ROUTING_NONE, NULL, NULL, NULL); |
| 1614 NavigationControllerImpl& our_controller = our_contents.GetControllerImpl(); | 1614 NavigationControllerImpl& our_controller = our_contents.GetControllerImpl(); |
| 1615 our_controller.Restore(0, true, &entries); | 1615 our_controller.Restore(0, true, &entries); |
| 1616 ASSERT_EQ(0u, entries.size()); | 1616 ASSERT_EQ(0u, entries.size()); |
| 1617 | 1617 |
| 1618 // Before navigating to the restored entry, it should have a restore_type | 1618 // Before navigating to the restored entry, it should have a restore_type |
| 1619 // and no SiteInstance. | 1619 // and no SiteInstance. |
| 1620 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION, | 1620 EXPECT_EQ(NavigationEntryImpl::RESTORE_LAST_SESSION, |
| 1621 NavigationEntryImpl::FromNavigationEntry( | 1621 NavigationEntryImpl::FromNavigationEntry( |
| 1622 our_controller.GetEntryAtIndex(0))->restore_type()); | 1622 our_controller.GetEntryAtIndex(0))->restore_type()); |
| 1623 EXPECT_FALSE(NavigationEntryImpl::FromNavigationEntry( | 1623 EXPECT_FALSE(NavigationEntryImpl::FromNavigationEntry( |
| (...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2619 TabNavigation nav(0, url0, GURL(), string16(), | 2619 TabNavigation nav(0, url0, GURL(), string16(), |
| 2620 webkit_glue::CreateHistoryStateForURL(url0), | 2620 webkit_glue::CreateHistoryStateForURL(url0), |
| 2621 content::PAGE_TRANSITION_LINK); | 2621 content::PAGE_TRANSITION_LINK); |
| 2622 session_helper_.AssertNavigationEquals(nav, | 2622 session_helper_.AssertNavigationEquals(nav, |
| 2623 windows_[0]->tabs[0]->navigations[0]); | 2623 windows_[0]->tabs[0]->navigations[0]); |
| 2624 nav.set_url(url2); | 2624 nav.set_url(url2); |
| 2625 session_helper_.AssertNavigationEquals(nav, | 2625 session_helper_.AssertNavigationEquals(nav, |
| 2626 windows_[0]->tabs[0]->navigations[1]); | 2626 windows_[0]->tabs[0]->navigations[1]); |
| 2627 } | 2627 } |
| 2628 */ | 2628 */ |
| OLD | NEW |