| Index: net/http/http_cache_unittest.cc
|
| diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
|
| index bf8cb6bd27230be5f85aa33a83dbc4f4b371bc38..0fb217a7ca87fa9ec4941d5e2010ee0a31cf4e40 100644
|
| --- a/net/http/http_cache_unittest.cc
|
| +++ b/net/http/http_cache_unittest.cc
|
| @@ -3978,6 +3978,30 @@ TEST(HttpCache, WriteResponseInfo_Truncated) {
|
| entry->Close();
|
| }
|
|
|
| +// Tests basic pickling/unpickling of HttpResponseInfo.
|
| +TEST(HttpCache, PersistHttpResponseInfo) {
|
| + // Set some fields (add more if needed.)
|
| + net::HttpResponseInfo response1;
|
| + response1.was_cached = false;
|
| + response1.socket_address = "[::]:80";
|
| + response1.headers = new net::HttpResponseHeaders("HTTP/1.1 200 OK");
|
| +
|
| + // Pickle.
|
| + Pickle pickle;
|
| + response1.Persist(&pickle, false, false);
|
| +
|
| + // Unpickle.
|
| + net::HttpResponseInfo response2;
|
| + bool response_truncated;
|
| + EXPECT_TRUE(response2.InitFromPickle(pickle, &response_truncated));
|
| + EXPECT_FALSE(response_truncated);
|
| +
|
| + // Verify fields.
|
| + EXPECT_TRUE(response2.was_cached); // InitFromPickle sets this flag.
|
| + EXPECT_EQ("[::]:80", response2.socket_address);
|
| + EXPECT_EQ("HTTP/1.1 200 OK", response2.headers->GetStatusLine());
|
| +}
|
| +
|
| // Tests that we delete an entry when the request is cancelled before starting
|
| // to read from the network.
|
| TEST(HttpCache, DoomOnDestruction) {
|
|
|