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

Unified Diff: chrome/browser/sessions/session_types_unittest.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/session_types_unittest.cc
diff --git a/chrome/browser/sessions/session_types_unittest.cc b/chrome/browser/sessions/session_types_unittest.cc
index 130d4e504a1c5485c25ad92b8e86527929dc4561..17301c4e2bbc5630a309b086f34dbacf99203571 100644
--- a/chrome/browser/sessions/session_types_unittest.cc
+++ b/chrome/browser/sessions/session_types_unittest.cc
@@ -43,6 +43,7 @@ const int64 kPostID = 100;
const GURL kOriginalRequestURL("http://www.original-request.com");
const bool kIsOverridingUserAgent = true;
const base::Time kTimestamp = syncer::ProtoTimeToTime(100);
+const int kHttpStatusCode = 200;
const int kPageID = 10;
@@ -60,6 +61,7 @@ scoped_ptr<content::NavigationEntry> MakeNavigationEntryForTest() {
navigation_entry->SetOriginalRequestURL(kOriginalRequestURL);
navigation_entry->SetIsOverridingUserAgent(kIsOverridingUserAgent);
navigation_entry->SetTimestamp(kTimestamp);
+ navigation_entry->SetHttpStatusCode(kHttpStatusCode);
return navigation_entry.Pass();
}
@@ -76,6 +78,7 @@ sync_pb::TabNavigation MakeSyncDataForTest() {
sync_data.set_timestamp(syncer::TimeToProtoTime(kTimestamp));
sync_data.set_redirect_type(sync_pb::SyncEnums::CLIENT_REDIRECT);
sync_data.set_navigation_home_page(true);
+ sync_data.set_http_status_code(kHttpStatusCode);
return sync_data;
}
@@ -98,6 +101,7 @@ TEST(TabNavigationTest, DefaultInitializer) {
EXPECT_EQ(GURL(), SessionTypesTestHelper::GetOriginalRequestURL(navigation));
EXPECT_FALSE(SessionTypesTestHelper::GetIsOverridingUserAgent(navigation));
EXPECT_TRUE(SessionTypesTestHelper::GetTimestamp(navigation).is_null());
+ EXPECT_EQ(0, SessionTypesTestHelper::GetHttpStatusCode(navigation));
}
// Create a TabNavigation from a NavigationEntry. All its fields
@@ -128,6 +132,8 @@ TEST(TabNavigationTest, FromNavigationEntry) {
EXPECT_EQ(kIsOverridingUserAgent,
SessionTypesTestHelper::GetIsOverridingUserAgent(navigation));
EXPECT_EQ(kTimestamp, SessionTypesTestHelper::GetTimestamp(navigation));
+ EXPECT_EQ(kHttpStatusCode,
+ SessionTypesTestHelper::GetHttpStatusCode(navigation));
}
// Create a TabNavigation from a sync_pb::TabNavigation. All its
@@ -155,6 +161,8 @@ TEST(TabNavigationTest, FromSyncData) {
EXPECT_EQ(GURL(), SessionTypesTestHelper::GetOriginalRequestURL(navigation));
EXPECT_FALSE(SessionTypesTestHelper::GetIsOverridingUserAgent(navigation));
EXPECT_TRUE(SessionTypesTestHelper::GetTimestamp(navigation).is_null());
+ EXPECT_EQ(kHttpStatusCode,
+ SessionTypesTestHelper::GetHttpStatusCode(navigation));
}
// Create a TabNavigation, pickle it, then create another one by
@@ -191,6 +199,8 @@ TEST(TabNavigationTest, Pickle) {
EXPECT_EQ(kIsOverridingUserAgent,
SessionTypesTestHelper::GetIsOverridingUserAgent(new_navigation));
EXPECT_EQ(kTimestamp, SessionTypesTestHelper::GetTimestamp(new_navigation));
+ EXPECT_EQ(kHttpStatusCode,
+ SessionTypesTestHelper::GetHttpStatusCode(new_navigation));
}
// Create a NavigationEntry, then create another one by converting to
@@ -221,6 +231,7 @@ TEST(TabNavigationTest, ToNavigationEntry) {
new_navigation_entry->GetOriginalRequestURL());
EXPECT_EQ(kIsOverridingUserAgent,
new_navigation_entry->GetIsOverridingUserAgent());
+ EXPECT_EQ(kHttpStatusCode, new_navigation_entry->GetHttpStatusCode());
}
// Create a NavigationEntry, convert it to a TabNavigation, then
@@ -244,6 +255,7 @@ TEST(TabNavigationTest, ToSyncData) {
EXPECT_TRUE(sync_data.has_redirect_type());
EXPECT_EQ(navigation_entry->GetUniqueID(), sync_data.unique_id());
EXPECT_EQ(syncer::TimeToProtoTime(kTimestamp), sync_data.timestamp());
+ EXPECT_EQ(kHttpStatusCode, sync_data.http_status_code());
}
// Ensure all transition types and qualifiers are converted to/from the sync
« no previous file with comments | « chrome/browser/sessions/session_types_test_helper.cc ('k') | chrome/browser/sessions/tab_restore_service_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698