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

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

Issue 8806011: Make NavigationEntry and friends use content::Referrer instead of plain URLs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 years 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 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 } 1470 }
1471 1471
1472 // Tests that we can do a restore and navigate to the restored entries and 1472 // Tests that we can do a restore and navigate to the restored entries and
1473 // everything is updated properly. This can be tricky since there is no 1473 // everything is updated properly. This can be tricky since there is no
1474 // SiteInstance for the entries created initially. 1474 // SiteInstance for the entries created initially.
1475 TEST_F(NavigationControllerTest, RestoreNavigate) { 1475 TEST_F(NavigationControllerTest, RestoreNavigate) {
1476 // Create a NavigationController with a restored set of tabs. 1476 // Create a NavigationController with a restored set of tabs.
1477 GURL url("http://foo"); 1477 GURL url("http://foo");
1478 std::vector<NavigationEntry*> entries; 1478 std::vector<NavigationEntry*> entries;
1479 NavigationEntry* entry = NavigationController::CreateNavigationEntry( 1479 NavigationEntry* entry = NavigationController::CreateNavigationEntry(
1480 url, GURL(), content::PAGE_TRANSITION_RELOAD, false, std::string(), 1480 url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false,
1481 browser_context()); 1481 std::string(), browser_context());
1482 entry->set_page_id(0); 1482 entry->set_page_id(0);
1483 entry->set_title(ASCIIToUTF16("Title")); 1483 entry->set_title(ASCIIToUTF16("Title"));
1484 entry->set_content_state("state"); 1484 entry->set_content_state("state");
1485 entries.push_back(entry); 1485 entries.push_back(entry);
1486 TabContents our_contents( 1486 TabContents our_contents(
1487 browser_context(), NULL, MSG_ROUTING_NONE, NULL, NULL); 1487 browser_context(), NULL, MSG_ROUTING_NONE, NULL, NULL);
1488 NavigationController& our_controller = our_contents.controller(); 1488 NavigationController& our_controller = our_contents.controller();
1489 our_controller.Restore(0, true, &entries); 1489 our_controller.Restore(0, true, &entries);
1490 ASSERT_EQ(0u, entries.size()); 1490 ASSERT_EQ(0u, entries.size());
1491 1491
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 our_controller.GetEntryAtIndex(0)->restore_type()); 1530 our_controller.GetEntryAtIndex(0)->restore_type());
1531 } 1531 }
1532 1532
1533 // Tests that we can still navigate to a restored entry after a different 1533 // Tests that we can still navigate to a restored entry after a different
1534 // navigation fails and clears the pending entry. http://crbug.com/90085 1534 // navigation fails and clears the pending entry. http://crbug.com/90085
1535 TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { 1535 TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) {
1536 // Create a NavigationController with a restored set of tabs. 1536 // Create a NavigationController with a restored set of tabs.
1537 GURL url("http://foo"); 1537 GURL url("http://foo");
1538 std::vector<NavigationEntry*> entries; 1538 std::vector<NavigationEntry*> entries;
1539 NavigationEntry* entry = NavigationController::CreateNavigationEntry( 1539 NavigationEntry* entry = NavigationController::CreateNavigationEntry(
1540 url, GURL(), content::PAGE_TRANSITION_RELOAD, false, std::string(), 1540 url, content::Referrer(), content::PAGE_TRANSITION_RELOAD, false,
1541 browser_context()); 1541 std::string(), browser_context());
1542 entry->set_page_id(0); 1542 entry->set_page_id(0);
1543 entry->set_title(ASCIIToUTF16("Title")); 1543 entry->set_title(ASCIIToUTF16("Title"));
1544 entry->set_content_state("state"); 1544 entry->set_content_state("state");
1545 entries.push_back(entry); 1545 entries.push_back(entry);
1546 TabContents our_contents( 1546 TabContents our_contents(
1547 browser_context(), NULL, MSG_ROUTING_NONE, NULL, NULL); 1547 browser_context(), NULL, MSG_ROUTING_NONE, NULL, NULL);
1548 NavigationController& our_controller = our_contents.controller(); 1548 NavigationController& our_controller = our_contents.controller();
1549 our_controller.Restore(0, true, &entries); 1549 our_controller.Restore(0, true, &entries);
1550 ASSERT_EQ(0u, entries.size()); 1550 ASSERT_EQ(0u, entries.size());
1551 1551
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
2402 TabNavigation nav(0, url0, GURL(), string16(), 2402 TabNavigation nav(0, url0, GURL(), string16(),
2403 webkit_glue::CreateHistoryStateForURL(url0), 2403 webkit_glue::CreateHistoryStateForURL(url0),
2404 content::PAGE_TRANSITION_LINK); 2404 content::PAGE_TRANSITION_LINK);
2405 session_helper_.AssertNavigationEquals(nav, 2405 session_helper_.AssertNavigationEquals(nav,
2406 windows_[0]->tabs[0]->navigations[0]); 2406 windows_[0]->tabs[0]->navigations[0]);
2407 nav.set_url(url2); 2407 nav.set_url(url2);
2408 session_helper_.AssertNavigationEquals(nav, 2408 session_helper_.AssertNavigationEquals(nav,
2409 windows_[0]->tabs[0]->navigations[1]); 2409 windows_[0]->tabs[0]->navigations[1]);
2410 } 2410 }
2411 */ 2411 */
OLDNEW
« no previous file with comments | « content/browser/tab_contents/navigation_controller.cc ('k') | content/browser/tab_contents/navigation_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698