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

Unified Diff: chrome/browser/sessions/tab_restore_service_browsertest.cc

Issue 11054025: [Sync] Add HTTP status codes to NavigationEntry and TabNavigation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase onto 11096037 Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sessions/tab_restore_service_browsertest.cc
diff --git a/chrome/browser/sessions/tab_restore_service_browsertest.cc b/chrome/browser/sessions/tab_restore_service_browsertest.cc
index 4a8ed63b32bdbaad0c10201dd8c4f273486880d1..da63384c27b80dc79b28805d577a48629256082b 100644
--- a/chrome/browser/sessions/tab_restore_service_browsertest.cc
+++ b/chrome/browser/sessions/tab_restore_service_browsertest.cc
@@ -569,6 +569,53 @@ TEST_F(TabRestoreServiceTest, TimestampSurvivesRestore) {
}
}
+// Makes sure we restore status codes correctly.
+TEST_F(TabRestoreServiceTest, StatusCodesSurviveRestore) {
+ AddThreeNavigations();
+
+ // Have the service record the tab.
+ service_->CreateHistoricalTab(contents(), -1);
+
+ // Make sure an entry was created.
+ ASSERT_EQ(1U, service_->entries().size());
+
+ // Make sure the entry matches.
+ std::vector<TabNavigation> old_navigations;
+ {
+ // |entry|/|tab| doesn't survive after RecreateService().
+ TabRestoreService::Entry* entry = service_->entries().front();
+ ASSERT_EQ(TabRestoreService::TAB, entry->type);
+ Tab* tab = static_cast<Tab*>(entry);
+ old_navigations = tab->navigations;
+ }
+
+ EXPECT_EQ(3U, old_navigations.size());
+ for (size_t i = 0; i < old_navigations.size(); ++i) {
+ EXPECT_EQ(200,
+ SessionTypesTestHelper::GetHttpStatusCode(old_navigations[i]));
+ }
+
+ // Set this, otherwise previous session won't be loaded.
+ profile()->set_last_session_exited_cleanly(false);
+
+ RecreateService();
+
+ // One entry should be created.
+ ASSERT_EQ(1U, service_->entries().size());
+
+ // And verify the entry.
+ TabRestoreService::Entry* restored_entry = service_->entries().front();
+ ASSERT_EQ(TabRestoreService::TAB, restored_entry->type);
+ Tab* restored_tab =
+ static_cast<Tab*>(restored_entry);
+ ASSERT_EQ(old_navigations.size(), restored_tab->navigations.size());
+ for (size_t i = 0; i < restored_tab->navigations.size(); ++i) {
+ EXPECT_EQ(200,
+ SessionTypesTestHelper::GetHttpStatusCode(
+ restored_tab->navigations[i]));
+ }
+}
+
TEST_F(TabRestoreServiceTest, PruneEntries) {
service_->ClearEntries();
ASSERT_TRUE(service_->entries().empty());
« no previous file with comments | « chrome/browser/sessions/session_types_unittest.cc ('k') | chrome/browser/sync/glue/session_model_associator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698