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

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

Issue 7791029: When the user navigates to the home page, make sure to set the RLZ string (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Taking out session restore changes, not needed Created 9 years, 3 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
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/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 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 } 1431 }
1432 1432
1433 // Tests that we can do a restore and navigate to the restored entries and 1433 // Tests that we can do a restore and navigate to the restored entries and
1434 // everything is updated properly. This can be tricky since there is no 1434 // everything is updated properly. This can be tricky since there is no
1435 // SiteInstance for the entries created initially. 1435 // SiteInstance for the entries created initially.
1436 TEST_F(NavigationControllerTest, RestoreNavigate) { 1436 TEST_F(NavigationControllerTest, RestoreNavigate) {
1437 // Create a NavigationController with a restored set of tabs. 1437 // Create a NavigationController with a restored set of tabs.
1438 GURL url("http://foo"); 1438 GURL url("http://foo");
1439 std::vector<NavigationEntry*> entries; 1439 std::vector<NavigationEntry*> entries;
1440 NavigationEntry* entry = NavigationController::CreateNavigationEntry( 1440 NavigationEntry* entry = NavigationController::CreateNavigationEntry(
1441 url, GURL(), PageTransition::RELOAD, profile()); 1441 url, GURL(), PageTransition::RELOAD, std::string(), profile());
1442 entry->set_page_id(0); 1442 entry->set_page_id(0);
1443 entry->set_title(ASCIIToUTF16("Title")); 1443 entry->set_title(ASCIIToUTF16("Title"));
1444 entry->set_content_state("state"); 1444 entry->set_content_state("state");
1445 entries.push_back(entry); 1445 entries.push_back(entry);
1446 TabContents our_contents(profile(), NULL, MSG_ROUTING_NONE, NULL, NULL); 1446 TabContents our_contents(profile(), NULL, MSG_ROUTING_NONE, NULL, NULL);
1447 NavigationController& our_controller = our_contents.controller(); 1447 NavigationController& our_controller = our_contents.controller();
1448 our_controller.Restore(0, true, &entries); 1448 our_controller.Restore(0, true, &entries);
1449 ASSERT_EQ(0u, entries.size()); 1449 ASSERT_EQ(0u, entries.size());
1450 1450
1451 // Before navigating to the restored entry, it should have a restore_type 1451 // Before navigating to the restored entry, it should have a restore_type
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 our_controller.GetEntryAtIndex(0)->restore_type()); 1489 our_controller.GetEntryAtIndex(0)->restore_type());
1490 } 1490 }
1491 1491
1492 // Tests that we can still navigate to a restored entry after a different 1492 // Tests that we can still navigate to a restored entry after a different
1493 // navigation fails and clears the pending entry. http://crbug.com/90085 1493 // navigation fails and clears the pending entry. http://crbug.com/90085
1494 TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { 1494 TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) {
1495 // Create a NavigationController with a restored set of tabs. 1495 // Create a NavigationController with a restored set of tabs.
1496 GURL url("http://foo"); 1496 GURL url("http://foo");
1497 std::vector<NavigationEntry*> entries; 1497 std::vector<NavigationEntry*> entries;
1498 NavigationEntry* entry = NavigationController::CreateNavigationEntry( 1498 NavigationEntry* entry = NavigationController::CreateNavigationEntry(
1499 url, GURL(), PageTransition::RELOAD, profile()); 1499 url, GURL(), PageTransition::RELOAD, std::string(), profile());
1500 entry->set_page_id(0); 1500 entry->set_page_id(0);
1501 entry->set_title(ASCIIToUTF16("Title")); 1501 entry->set_title(ASCIIToUTF16("Title"));
1502 entry->set_content_state("state"); 1502 entry->set_content_state("state");
1503 entries.push_back(entry); 1503 entries.push_back(entry);
1504 TabContents our_contents(profile(), NULL, MSG_ROUTING_NONE, NULL, NULL); 1504 TabContents our_contents(profile(), NULL, MSG_ROUTING_NONE, NULL, NULL);
1505 NavigationController& our_controller = our_contents.controller(); 1505 NavigationController& our_controller = our_contents.controller();
1506 our_controller.Restore(0, true, &entries); 1506 our_controller.Restore(0, true, &entries);
1507 ASSERT_EQ(0u, entries.size()); 1507 ASSERT_EQ(0u, entries.size());
1508 1508
1509 // Before navigating to the restored entry, it should have a restore_type 1509 // Before navigating to the restored entry, it should have a restore_type
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
2384 TabNavigation nav(0, url0, GURL(), string16(), 2384 TabNavigation nav(0, url0, GURL(), string16(),
2385 webkit_glue::CreateHistoryStateForURL(url0), 2385 webkit_glue::CreateHistoryStateForURL(url0),
2386 PageTransition::LINK); 2386 PageTransition::LINK);
2387 session_helper_.AssertNavigationEquals(nav, 2387 session_helper_.AssertNavigationEquals(nav,
2388 windows_[0]->tabs[0]->navigations[0]); 2388 windows_[0]->tabs[0]->navigations[0]);
2389 nav.set_url(url2); 2389 nav.set_url(url2);
2390 session_helper_.AssertNavigationEquals(nav, 2390 session_helper_.AssertNavigationEquals(nav,
2391 windows_[0]->tabs[0]->navigations[1]); 2391 windows_[0]->tabs[0]->navigations[1]);
2392 } 2392 }
2393 */ 2393 */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698