| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "net/http/http_response_info.h" | |
| 6 | |
| 7 #include "base/pickle.h" | |
| 8 #include "net/http/http_response_headers.h" | |
| 9 #include "testing/gtest/include/gtest/gtest.h" | |
| 10 | |
| 11 class HttpResponseInfoTest : public testing::Test { | |
| 12 protected: | |
| 13 void SetUp() override { | |
| 14 response_info_.headers = new net::HttpResponseHeaders(""); | |
| 15 } | |
| 16 | |
| 17 void PickleAndRestore(const net::HttpResponseInfo& response_info, | |
| 18 net::HttpResponseInfo* restored_response_info) const { | |
| 19 Pickle pickle; | |
| 20 response_info.Persist(&pickle, false, false); | |
| 21 bool truncated = false; | |
| 22 restored_response_info->InitFromPickle(pickle, &truncated); | |
| 23 } | |
| 24 | |
| 25 net::HttpResponseInfo response_info_; | |
| 26 }; | |
| 27 | |
| 28 TEST_F(HttpResponseInfoTest, UnusedSincePrefetchDefault) { | |
| 29 EXPECT_FALSE(response_info_.unused_since_prefetch); | |
| 30 } | |
| 31 | |
| 32 TEST_F(HttpResponseInfoTest, UnusedSincePrefetchCopy) { | |
| 33 response_info_.unused_since_prefetch = true; | |
| 34 net::HttpResponseInfo response_info_clone(response_info_); | |
| 35 EXPECT_TRUE(response_info_clone.unused_since_prefetch); | |
| 36 } | |
| 37 | |
| 38 TEST_F(HttpResponseInfoTest, UnusedSincePrefetchPersistFalse) { | |
| 39 net::HttpResponseInfo restored_response_info; | |
| 40 PickleAndRestore(response_info_, &restored_response_info); | |
| 41 EXPECT_FALSE(restored_response_info.unused_since_prefetch); | |
| 42 } | |
| 43 | |
| 44 TEST_F(HttpResponseInfoTest, UnusedSincePrefetchPersistTrue) { | |
| 45 response_info_.unused_since_prefetch = true; | |
| 46 net::HttpResponseInfo restored_response_info; | |
| 47 PickleAndRestore(response_info_, &restored_response_info); | |
| 48 EXPECT_TRUE(restored_response_info.unused_since_prefetch); | |
| 49 } | |
| OLD | NEW |