| 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 6a4bb8883574d4b23e22a705e8a3b1a277c9259d..da63384c27b80dc79b28805d577a48629256082b 100644
|
| --- a/chrome/browser/sessions/tab_restore_service_browsertest.cc
|
| +++ b/chrome/browser/sessions/tab_restore_service_browsertest.cc
|
| @@ -540,10 +540,11 @@ TEST_F(TabRestoreServiceTest, TimestampSurvivesRestore) {
|
| old_navigations = tab->navigations;
|
| }
|
|
|
| - ASSERT_EQ(3U, old_navigations.size());
|
| - EXPECT_FALSE(old_navigations[0].timestamp().is_null());
|
| - EXPECT_FALSE(old_navigations[1].timestamp().is_null());
|
| - EXPECT_FALSE(old_navigations[2].timestamp().is_null());
|
| + EXPECT_EQ(3U, old_navigations.size());
|
| + for (size_t i = 0; i < old_navigations.size(); ++i) {
|
| + EXPECT_FALSE(
|
| + SessionTypesTestHelper::GetTimestamp(old_navigations[i]).is_null());
|
| + }
|
|
|
| // Set this, otherwise previous session won't be loaded.
|
| profile()->set_last_session_exited_cleanly(false);
|
| @@ -560,13 +561,59 @@ TEST_F(TabRestoreServiceTest, TimestampSurvivesRestore) {
|
| static_cast<Tab*>(restored_entry);
|
| EXPECT_EQ(tab_timestamp.ToInternalValue(),
|
| restored_tab->timestamp.ToInternalValue());
|
| - ASSERT_EQ(3U, restored_tab->navigations.size());
|
| - EXPECT_EQ(old_navigations[0].timestamp(),
|
| - restored_tab->navigations[0].timestamp());
|
| - EXPECT_EQ(old_navigations[1].timestamp(),
|
| - restored_tab->navigations[1].timestamp());
|
| - EXPECT_EQ(old_navigations[2].timestamp(),
|
| - restored_tab->navigations[2].timestamp());
|
| + ASSERT_EQ(old_navigations.size(), restored_tab->navigations.size());
|
| + for (size_t i = 0; i < restored_tab->navigations.size(); ++i) {
|
| + EXPECT_EQ(
|
| + SessionTypesTestHelper::GetTimestamp(old_navigations[i]),
|
| + SessionTypesTestHelper::GetTimestamp(restored_tab->navigations[i]));
|
| + }
|
| +}
|
| +
|
| +// 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) {
|
|
|