OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/logging.h" | 5 #include "base/logging.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/dom_operation_notification_details.h" | 7 #include "chrome/browser/dom_operation_notification_details.h" |
8 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
9 #include "chrome/browser/tab_contents/chrome_interstitial_page.h" | 9 #include "chrome/browser/tab_contents/chrome_interstitial_page.h" |
10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1704 interstitial->Show(); | 1704 interstitial->Show(); |
1705 interstitial->TestDidNavigate(1, url2); | 1705 interstitial->TestDidNavigate(1, url2); |
1706 EXPECT_TRUE(interstitial->is_showing()); | 1706 EXPECT_TRUE(interstitial->is_showing()); |
1707 EXPECT_EQ(2, controller().entry_count()); | 1707 EXPECT_EQ(2, controller().entry_count()); |
1708 | 1708 |
1709 // Create another NavigationController. | 1709 // Create another NavigationController. |
1710 GURL url3("http://foo2"); | 1710 GURL url3("http://foo2"); |
1711 scoped_ptr<TestTabContents> other_contents(CreateTestTabContents()); | 1711 scoped_ptr<TestTabContents> other_contents(CreateTestTabContents()); |
1712 NavigationController& other_controller = other_contents->controller(); | 1712 NavigationController& other_controller = other_contents->controller(); |
1713 other_contents->NavigateAndCommit(url3); | 1713 other_contents->NavigateAndCommit(url3); |
| 1714 other_contents->ExpectSetHistoryLengthAndPrune( |
| 1715 other_controller.GetEntryAtIndex(0)->site_instance(), 1, |
| 1716 other_controller.GetEntryAtIndex(0)->page_id()); |
1714 other_controller.CopyStateFromAndPrune(&controller(), false); | 1717 other_controller.CopyStateFromAndPrune(&controller(), false); |
1715 | 1718 |
1716 // The merged controller should only have two entries: url1 and url2. | 1719 // The merged controller should only have two entries: url1 and url2. |
1717 ASSERT_EQ(2, other_controller.entry_count()); | 1720 ASSERT_EQ(2, other_controller.entry_count()); |
1718 EXPECT_EQ(1, other_controller.GetCurrentEntryIndex()); | 1721 EXPECT_EQ(1, other_controller.GetCurrentEntryIndex()); |
1719 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->url()); | 1722 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->url()); |
1720 EXPECT_EQ(url3, other_controller.GetEntryAtIndex(1)->url()); | 1723 EXPECT_EQ(url3, other_controller.GetEntryAtIndex(1)->url()); |
1721 | 1724 |
1722 // And the merged controller shouldn't be showing an interstitial. | 1725 // And the merged controller shouldn't be showing an interstitial. |
1723 EXPECT_FALSE(other_contents->showing_interstitial_page()); | 1726 EXPECT_FALSE(other_contents->showing_interstitial_page()); |
(...skipping 20 matching lines...) Expand all Loading... |
1744 bool deleted = false; | 1747 bool deleted = false; |
1745 GURL url3("http://interstitial"); | 1748 GURL url3("http://interstitial"); |
1746 TestInterstitialPage* interstitial = | 1749 TestInterstitialPage* interstitial = |
1747 new TestInterstitialPage(other_contents.get(), true, url3, &state, | 1750 new TestInterstitialPage(other_contents.get(), true, url3, &state, |
1748 &deleted); | 1751 &deleted); |
1749 TestInterstitialPageStateGuard state_guard(interstitial); | 1752 TestInterstitialPageStateGuard state_guard(interstitial); |
1750 interstitial->Show(); | 1753 interstitial->Show(); |
1751 interstitial->TestDidNavigate(1, url3); | 1754 interstitial->TestDidNavigate(1, url3); |
1752 EXPECT_TRUE(interstitial->is_showing()); | 1755 EXPECT_TRUE(interstitial->is_showing()); |
1753 EXPECT_EQ(2, other_controller.entry_count()); | 1756 EXPECT_EQ(2, other_controller.entry_count()); |
1754 | 1757 other_contents->ExpectSetHistoryLengthAndPrune( |
| 1758 other_controller.GetEntryAtIndex(0)->site_instance(), 1, |
| 1759 other_controller.GetEntryAtIndex(0)->page_id()); |
1755 other_controller.CopyStateFromAndPrune(&controller(), false); | 1760 other_controller.CopyStateFromAndPrune(&controller(), false); |
1756 | 1761 |
1757 // The merged controller should only have two entries: url1 and url2. | 1762 // The merged controller should only have two entries: url1 and url2. |
1758 ASSERT_EQ(2, other_controller.entry_count()); | 1763 ASSERT_EQ(2, other_controller.entry_count()); |
1759 EXPECT_EQ(1, other_controller.GetCurrentEntryIndex()); | 1764 EXPECT_EQ(1, other_controller.GetCurrentEntryIndex()); |
1760 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->url()); | 1765 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->url()); |
1761 EXPECT_EQ(url3, other_controller.GetEntryAtIndex(1)->url()); | 1766 EXPECT_EQ(url3, other_controller.GetEntryAtIndex(1)->url()); |
1762 | 1767 |
1763 // It should have a transient entry. | 1768 // It should have a transient entry. |
1764 EXPECT_TRUE(other_controller.GetTransientEntry()); | 1769 EXPECT_TRUE(other_controller.GetTransientEntry()); |
(...skipping 30 matching lines...) Expand all Loading... |
1795 window.close_count = 0; | 1800 window.close_count = 0; |
1796 | 1801 |
1797 const int kWindowCount = 4; | 1802 const int kWindowCount = 4; |
1798 for (int i = 0; i < kWindowCount; i++) { | 1803 for (int i = 0; i < kWindowCount; i++) { |
1799 tab_contents->AddConstrainedDialog(&window); | 1804 tab_contents->AddConstrainedDialog(&window); |
1800 } | 1805 } |
1801 EXPECT_EQ(window.close_count, 0); | 1806 EXPECT_EQ(window.close_count, 0); |
1802 delete tab_contents; | 1807 delete tab_contents; |
1803 EXPECT_EQ(window.close_count, kWindowCount); | 1808 EXPECT_EQ(window.close_count, kWindowCount); |
1804 } | 1809 } |
OLD | NEW |