Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: chrome/browser/tab_contents/web_contents_unittest.cc

Issue 7649009: Merge of 97624 to 835 branch. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/835/src/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/prerender/prerender_manager.cc ('k') | chrome/test/render_view_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 interstitial->Show(); 1703 interstitial->Show();
1704 interstitial->TestDidNavigate(1, url2); 1704 interstitial->TestDidNavigate(1, url2);
1705 EXPECT_TRUE(interstitial->is_showing()); 1705 EXPECT_TRUE(interstitial->is_showing());
1706 EXPECT_EQ(2, controller().entry_count()); 1706 EXPECT_EQ(2, controller().entry_count());
1707 1707
1708 // Create another NavigationController. 1708 // Create another NavigationController.
1709 GURL url3("http://foo2"); 1709 GURL url3("http://foo2");
1710 scoped_ptr<TestTabContents> other_contents(CreateTestTabContents()); 1710 scoped_ptr<TestTabContents> other_contents(CreateTestTabContents());
1711 NavigationController& other_controller = other_contents->controller(); 1711 NavigationController& other_controller = other_contents->controller();
1712 other_contents->NavigateAndCommit(url3); 1712 other_contents->NavigateAndCommit(url3);
1713 other_contents->ExpectSetHistoryLengthAndPrune(
1714 other_controller.GetEntryAtIndex(0)->site_instance(), 1,
1715 other_controller.GetEntryAtIndex(0)->page_id());
1713 other_controller.CopyStateFromAndPrune(&controller(), false); 1716 other_controller.CopyStateFromAndPrune(&controller(), false);
1714 1717
1715 // The merged controller should only have two entries: url1 and url2. 1718 // The merged controller should only have two entries: url1 and url2.
1716 ASSERT_EQ(2, other_controller.entry_count()); 1719 ASSERT_EQ(2, other_controller.entry_count());
1717 EXPECT_EQ(1, other_controller.GetCurrentEntryIndex()); 1720 EXPECT_EQ(1, other_controller.GetCurrentEntryIndex());
1718 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->url()); 1721 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->url());
1719 EXPECT_EQ(url3, other_controller.GetEntryAtIndex(1)->url()); 1722 EXPECT_EQ(url3, other_controller.GetEntryAtIndex(1)->url());
1720 1723
1721 // And the merged controller shouldn't be showing an interstitial. 1724 // And the merged controller shouldn't be showing an interstitial.
1722 EXPECT_FALSE(other_contents->showing_interstitial_page()); 1725 EXPECT_FALSE(other_contents->showing_interstitial_page());
(...skipping 20 matching lines...) Expand all
1743 bool deleted = false; 1746 bool deleted = false;
1744 GURL url3("http://interstitial"); 1747 GURL url3("http://interstitial");
1745 TestInterstitialPage* interstitial = 1748 TestInterstitialPage* interstitial =
1746 new TestInterstitialPage(other_contents.get(), true, url3, &state, 1749 new TestInterstitialPage(other_contents.get(), true, url3, &state,
1747 &deleted); 1750 &deleted);
1748 TestInterstitialPageStateGuard state_guard(interstitial); 1751 TestInterstitialPageStateGuard state_guard(interstitial);
1749 interstitial->Show(); 1752 interstitial->Show();
1750 interstitial->TestDidNavigate(1, url3); 1753 interstitial->TestDidNavigate(1, url3);
1751 EXPECT_TRUE(interstitial->is_showing()); 1754 EXPECT_TRUE(interstitial->is_showing());
1752 EXPECT_EQ(2, other_controller.entry_count()); 1755 EXPECT_EQ(2, other_controller.entry_count());
1753 1756 other_contents->ExpectSetHistoryLengthAndPrune(
1757 other_controller.GetEntryAtIndex(0)->site_instance(), 1,
1758 other_controller.GetEntryAtIndex(0)->page_id());
1754 other_controller.CopyStateFromAndPrune(&controller(), false); 1759 other_controller.CopyStateFromAndPrune(&controller(), false);
1755 1760
1756 // The merged controller should only have two entries: url1 and url2. 1761 // The merged controller should only have two entries: url1 and url2.
1757 ASSERT_EQ(2, other_controller.entry_count()); 1762 ASSERT_EQ(2, other_controller.entry_count());
1758 EXPECT_EQ(1, other_controller.GetCurrentEntryIndex()); 1763 EXPECT_EQ(1, other_controller.GetCurrentEntryIndex());
1759 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->url()); 1764 EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->url());
1760 EXPECT_EQ(url3, other_controller.GetEntryAtIndex(1)->url()); 1765 EXPECT_EQ(url3, other_controller.GetEntryAtIndex(1)->url());
1761 1766
1762 // It should have a transient entry. 1767 // It should have a transient entry.
1763 EXPECT_TRUE(other_controller.GetTransientEntry()); 1768 EXPECT_TRUE(other_controller.GetTransientEntry());
(...skipping 30 matching lines...) Expand all
1794 window.close_count = 0; 1799 window.close_count = 0;
1795 1800
1796 const int kWindowCount = 4; 1801 const int kWindowCount = 4;
1797 for (int i = 0; i < kWindowCount; i++) { 1802 for (int i = 0; i < kWindowCount; i++) {
1798 tab_contents->AddConstrainedDialog(&window); 1803 tab_contents->AddConstrainedDialog(&window);
1799 } 1804 }
1800 EXPECT_EQ(window.close_count, 0); 1805 EXPECT_EQ(window.close_count, 0);
1801 delete tab_contents; 1806 delete tab_contents;
1802 EXPECT_EQ(window.close_count, kWindowCount); 1807 EXPECT_EQ(window.close_count, kWindowCount);
1803 } 1808 }
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_manager.cc ('k') | chrome/test/render_view_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698