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

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

Issue 4194007: Revert "Refactor automation messages." due to mysterious problems on mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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(INTERSTITIAL_PAGE); 1377 controller().pending_entry()->set_page_type(
1378 NavigationEntry::INTERSTITIAL_PAGE);
1378 1379
1379 // At this point the interstitial will be displayed and the load will still 1380 // At this point the interstitial will be displayed and the load will still
1380 // be pending. If the user continues, the load will commit. 1381 // be pending. If the user continues, the load will commit.
1381 rvh()->SendNavigate(1, url2); 1382 rvh()->SendNavigate(1, url2);
1382 1383
1383 // The page should be a normal page again. 1384 // The page should be a normal page again.
1384 EXPECT_EQ(url2, controller().GetLastCommittedEntry()->url()); 1385 EXPECT_EQ(url2, controller().GetLastCommittedEntry()->url());
1385 EXPECT_EQ(NORMAL_PAGE, controller().GetLastCommittedEntry()->page_type()); 1386 EXPECT_EQ(NavigationEntry::NORMAL_PAGE,
1387 controller().GetLastCommittedEntry()->page_type());
1386 } 1388 }
1387 1389
1388 TEST_F(NavigationControllerTest, RemoveEntry) { 1390 TEST_F(NavigationControllerTest, RemoveEntry) {
1389 const GURL url1("http://foo1"); 1391 const GURL url1("http://foo1");
1390 const GURL url2("http://foo2"); 1392 const GURL url2("http://foo2");
1391 const GURL url3("http://foo3"); 1393 const GURL url3("http://foo3");
1392 const GURL url4("http://foo4"); 1394 const GURL url4("http://foo4");
1393 const GURL url5("http://foo5"); 1395 const GURL url5("http://foo5");
1394 const GURL pending_url("http://pending"); 1396 const GURL pending_url("http://pending");
1395 const GURL default_url("http://default"); 1397 const GURL default_url("http://default");
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 // Make sure that cloning a tabcontents doesn't copy interstitials. 1667 // Make sure that cloning a tabcontents doesn't copy interstitials.
1666 TEST_F(NavigationControllerTest, CloneOmitsInterstitials) { 1668 TEST_F(NavigationControllerTest, CloneOmitsInterstitials) {
1667 const GURL url1("http://foo1"); 1669 const GURL url1("http://foo1");
1668 const GURL url2("http://foo2"); 1670 const GURL url2("http://foo2");
1669 1671
1670 NavigateAndCommit(url1); 1672 NavigateAndCommit(url1);
1671 NavigateAndCommit(url2); 1673 NavigateAndCommit(url2);
1672 1674
1673 // Add an interstitial entry. Should be deleted with controller. 1675 // Add an interstitial entry. Should be deleted with controller.
1674 NavigationEntry* interstitial_entry = new NavigationEntry(); 1676 NavigationEntry* interstitial_entry = new NavigationEntry();
1675 interstitial_entry->set_page_type(INTERSTITIAL_PAGE); 1677 interstitial_entry->set_page_type(NavigationEntry::INTERSTITIAL_PAGE);
1676 controller().AddTransientEntry(interstitial_entry); 1678 controller().AddTransientEntry(interstitial_entry);
1677 1679
1678 scoped_ptr<TabContents> clone(controller().tab_contents()->Clone()); 1680 scoped_ptr<TabContents> clone(controller().tab_contents()->Clone());
1679 1681
1680 ASSERT_EQ(2, clone->controller().entry_count()); 1682 ASSERT_EQ(2, clone->controller().entry_count());
1681 } 1683 }
1682 1684
1683 // Tests a subframe navigation while a toplevel navigation is pending. 1685 // Tests a subframe navigation while a toplevel navigation is pending.
1684 // http://crbug.com/43967 1686 // http://crbug.com/43967
1685 TEST_F(NavigationControllerTest, SubframeWhilePending) { 1687 TEST_F(NavigationControllerTest, SubframeWhilePending) {
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1940 PageTransition::LINK); 1942 PageTransition::LINK);
1941 session_helper_.AssertNavigationEquals(nav, 1943 session_helper_.AssertNavigationEquals(nav,
1942 windows_[0]->tabs[0]->navigations[0]); 1944 windows_[0]->tabs[0]->navigations[0]);
1943 nav.set_url(url2); 1945 nav.set_url(url2);
1944 session_helper_.AssertNavigationEquals(nav, 1946 session_helper_.AssertNavigationEquals(nav,
1945 windows_[0]->tabs[0]->navigations[1]); 1947 windows_[0]->tabs[0]->navigations[1]);
1946 } 1948 }
1947 */ 1949 */
1948 1950
1949 } // namespace 1951 } // 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