diff options
author | pvalenzuela@chromium.org <pvalenzuela@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-28 07:51:44 +0000 |
---|---|---|
committer | pvalenzuela@chromium.org <pvalenzuela@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-28 07:51:44 +0000 |
commit | f49737b38742a270515974c6e20780eaf4f06fa2 (patch) | |
tree | c3b8ae39faa1ebe84bc3a99c3ab21c00960a4c9f /android_webview | |
parent | c65f676922a747565ccba68a69f6d61f8fe009ca (diff) | |
download | chromium_src-f49737b38742a270515974c6e20780eaf4f06fa2.zip chromium_src-f49737b38742a270515974c6e20780eaf4f06fa2.tar.gz chromium_src-f49737b38742a270515974c6e20780eaf4f06fa2.tar.bz2 |
Add HTTP status code to navigation data structures
This is a reboot of https://codereview.chromium.org/11054025/
BUG=153936,260276
Review URL: https://chromiumcodereview.appspot.com/22837005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219954 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
-rw-r--r-- | android_webview/native/state_serializer.cc | 12 | ||||
-rw-r--r-- | android_webview/native/state_serializer_unittests.cc | 3 |
2 files changed, 14 insertions, 1 deletions
diff --git a/android_webview/native/state_serializer.cc b/android_webview/native/state_serializer.cc index 6aa3ae1..6791108 100644 --- a/android_webview/native/state_serializer.cc +++ b/android_webview/native/state_serializer.cc @@ -35,7 +35,7 @@ namespace { // Sanity check value that we are restoring from a valid pickle. // This can potentially used as an actual serialization version number in the // future if we ever decide to support restoring from older versions. -const uint32 AW_STATE_VERSION = 20121126; +const uint32 AW_STATE_VERSION = 20130814; } // namespace @@ -186,6 +186,9 @@ bool WriteNavigationEntryToPickle(const content::NavigationEntry& entry, if (!pickle->WriteInt64(entry.GetTimestamp().ToInternalValue())) return false; + if (!pickle->WriteInt(entry.GetHttpStatusCode())) + return false; + // Please update AW_STATE_VERSION if serialization format is changed. return true; @@ -272,6 +275,13 @@ bool RestoreNavigationEntryFromPickle(PickleIterator* iterator, entry->SetTimestamp(base::Time::FromInternalValue(timestamp)); } + { + int http_status_code; + if (!iterator->ReadInt(&http_status_code)) + return false; + entry->SetHttpStatusCode(http_status_code); + } + return true; } diff --git a/android_webview/native/state_serializer_unittests.cc b/android_webview/native/state_serializer_unittests.cc index f592d29..408c888 100644 --- a/android_webview/native/state_serializer_unittests.cc +++ b/android_webview/native/state_serializer_unittests.cc @@ -54,6 +54,7 @@ TEST(AndroidWebViewStateSerializerTest, TestNavigationEntrySerialization) { const GURL base_url_for_data_url("http://base_url"); const bool is_overriding_user_agent = true; const base::Time timestamp = base::Time::FromInternalValue(12345); + const int http_status_code = 404; entry->SetURL(url); entry->SetVirtualURL(virtual_url); @@ -65,6 +66,7 @@ TEST(AndroidWebViewStateSerializerTest, TestNavigationEntrySerialization) { entry->SetBaseURLForDataURL(base_url_for_data_url); entry->SetIsOverridingUserAgent(is_overriding_user_agent); entry->SetTimestamp(timestamp); + entry->SetHttpStatusCode(http_status_code); Pickle pickle; bool result = internal::WriteNavigationEntryToPickle(*entry, &pickle); @@ -86,6 +88,7 @@ TEST(AndroidWebViewStateSerializerTest, TestNavigationEntrySerialization) { EXPECT_EQ(base_url_for_data_url, copy->GetBaseURLForDataURL()); EXPECT_EQ(is_overriding_user_agent, copy->GetIsOverridingUserAgent()); EXPECT_EQ(timestamp, copy->GetTimestamp()); + EXPECT_EQ(http_status_code, copy->GetHttpStatusCode()); } } // namespace android_webview |