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

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

Issue 4200007: Refactor automation messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: chrome_frame no longer depends on tab_contents.h Created 10 years, 1 month 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/path_service.h" 6 #include "base/path_service.h"
7 #include "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "base/stl_util-inl.h" 8 #include "base/stl_util-inl.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 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 // Make sure that the page type and stuff is correct after an interstitial. 1367 // Make sure that the page type and stuff is correct after an interstitial.
1368 TEST_F(NavigationControllerTest, Interstitial) { 1368 TEST_F(NavigationControllerTest, Interstitial) {
1369 // First navigate somewhere normal. 1369 // First navigate somewhere normal.
1370 const GURL url1("http://foo"); 1370 const GURL url1("http://foo");
1371 controller().LoadURL(url1, GURL(), PageTransition::TYPED); 1371 controller().LoadURL(url1, GURL(), PageTransition::TYPED);
1372 rvh()->SendNavigate(0, url1); 1372 rvh()->SendNavigate(0, url1);
1373 1373
1374 // Now navigate somewhere with an interstitial. 1374 // Now navigate somewhere with an interstitial.
1375 const GURL url2("http://bar"); 1375 const GURL url2("http://bar");
1376 controller().LoadURL(url1, GURL(), PageTransition::TYPED); 1376 controller().LoadURL(url1, GURL(), PageTransition::TYPED);
1377 controller().pending_entry()->set_page_type( 1377 controller().pending_entry()->set_page_type(INTERSTITIAL_PAGE);
1378 NavigationEntry::INTERSTITIAL_PAGE);
1379 1378
1380 // At this point the interstitial will be displayed and the load will still 1379 // At this point the interstitial will be displayed and the load will still
1381 // be pending. If the user continues, the load will commit. 1380 // be pending. If the user continues, the load will commit.
1382 rvh()->SendNavigate(1, url2); 1381 rvh()->SendNavigate(1, url2);
1383 1382
1384 // The page should be a normal page again. 1383 // The page should be a normal page again.
1385 EXPECT_EQ(url2, controller().GetLastCommittedEntry()->url()); 1384 EXPECT_EQ(url2, controller().GetLastCommittedEntry()->url());
1386 EXPECT_EQ(NavigationEntry::NORMAL_PAGE, 1385 EXPECT_EQ(NORMAL_PAGE, controller().GetLastCommittedEntry()->page_type());
1387 controller().GetLastCommittedEntry()->page_type());
1388 } 1386 }
1389 1387
1390 TEST_F(NavigationControllerTest, RemoveEntry) { 1388 TEST_F(NavigationControllerTest, RemoveEntry) {
1391 const GURL url1("http://foo1"); 1389 const GURL url1("http://foo1");
1392 const GURL url2("http://foo2"); 1390 const GURL url2("http://foo2");
1393 const GURL url3("http://foo3"); 1391 const GURL url3("http://foo3");
1394 const GURL url4("http://foo4"); 1392 const GURL url4("http://foo4");
1395 const GURL url5("http://foo5"); 1393 const GURL url5("http://foo5");
1396 const GURL pending_url("http://pending"); 1394 const GURL pending_url("http://pending");
1397 const GURL default_url("http://default"); 1395 const GURL default_url("http://default");
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 // Make sure that cloning a tabcontents doesn't copy interstitials. 1665 // Make sure that cloning a tabcontents doesn't copy interstitials.
1668 TEST_F(NavigationControllerTest, CloneOmitsInterstitials) { 1666 TEST_F(NavigationControllerTest, CloneOmitsInterstitials) {
1669 const GURL url1("http://foo1"); 1667 const GURL url1("http://foo1");
1670 const GURL url2("http://foo2"); 1668 const GURL url2("http://foo2");
1671 1669
1672 NavigateAndCommit(url1); 1670 NavigateAndCommit(url1);
1673 NavigateAndCommit(url2); 1671 NavigateAndCommit(url2);
1674 1672
1675 // Add an interstitial entry. Should be deleted with controller. 1673 // Add an interstitial entry. Should be deleted with controller.
1676 NavigationEntry* interstitial_entry = new NavigationEntry(); 1674 NavigationEntry* interstitial_entry = new NavigationEntry();
1677 interstitial_entry->set_page_type(NavigationEntry::INTERSTITIAL_PAGE); 1675 interstitial_entry->set_page_type(INTERSTITIAL_PAGE);
1678 controller().AddTransientEntry(interstitial_entry); 1676 controller().AddTransientEntry(interstitial_entry);
1679 1677
1680 scoped_ptr<TabContents> clone(controller().tab_contents()->Clone()); 1678 scoped_ptr<TabContents> clone(controller().tab_contents()->Clone());
1681 1679
1682 ASSERT_EQ(2, clone->controller().entry_count()); 1680 ASSERT_EQ(2, clone->controller().entry_count());
1683 } 1681 }
1684 1682
1685 // Tests a subframe navigation while a toplevel navigation is pending. 1683 // Tests a subframe navigation while a toplevel navigation is pending.
1686 // http://crbug.com/43967 1684 // http://crbug.com/43967
1687 TEST_F(NavigationControllerTest, SubframeWhilePending) { 1685 TEST_F(NavigationControllerTest, SubframeWhilePending) {
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1942 PageTransition::LINK); 1940 PageTransition::LINK);
1943 session_helper_.AssertNavigationEquals(nav, 1941 session_helper_.AssertNavigationEquals(nav,
1944 windows_[0]->tabs[0]->navigations[0]); 1942 windows_[0]->tabs[0]->navigations[0]);
1945 nav.set_url(url2); 1943 nav.set_url(url2);
1946 session_helper_.AssertNavigationEquals(nav, 1944 session_helper_.AssertNavigationEquals(nav,
1947 windows_[0]->tabs[0]->navigations[1]); 1945 windows_[0]->tabs[0]->navigations[1]);
1948 } 1946 }
1949 */ 1947 */
1950 1948
1951 } // namespace 1949 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/navigation_controller.cc ('k') | chrome/browser/tab_contents/navigation_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698