OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/http/http_response_info.h" | 5 #include "net/http/http_response_info.h" |
6 | 6 |
7 #include "base/pickle.h" | 7 #include "base/pickle.h" |
8 #include "net/http/http_response_headers.h" | 8 #include "net/http/http_response_headers.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 namespace net { | 11 namespace net { |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 class HttpResponseInfoTest : public testing::Test { | 15 class HttpResponseInfoTest : public testing::Test { |
16 protected: | 16 protected: |
17 void SetUp() override { | 17 void SetUp() override { |
18 response_info_.headers = new HttpResponseHeaders(""); | 18 response_info_.headers = new HttpResponseHeaders(""); |
19 } | 19 } |
20 | 20 |
21 void PickleAndRestore(const HttpResponseInfo& response_info, | 21 void PickleAndRestore(const HttpResponseInfo& response_info, |
22 HttpResponseInfo* restored_response_info) const { | 22 HttpResponseInfo* restored_response_info) const { |
23 Pickle pickle; | 23 base::Pickle pickle; |
24 response_info.Persist(&pickle, false, false); | 24 response_info.Persist(&pickle, false, false); |
25 bool truncated = false; | 25 bool truncated = false; |
26 restored_response_info->InitFromPickle(pickle, &truncated); | 26 restored_response_info->InitFromPickle(pickle, &truncated); |
27 } | 27 } |
28 | 28 |
29 HttpResponseInfo response_info_; | 29 HttpResponseInfo response_info_; |
30 }; | 30 }; |
31 | 31 |
32 TEST_F(HttpResponseInfoTest, UnusedSincePrefetchDefault) { | 32 TEST_F(HttpResponseInfoTest, UnusedSincePrefetchDefault) { |
33 EXPECT_FALSE(response_info_.unused_since_prefetch); | 33 EXPECT_FALSE(response_info_.unused_since_prefetch); |
(...skipping 14 matching lines...) Expand all Loading... |
48 TEST_F(HttpResponseInfoTest, UnusedSincePrefetchPersistTrue) { | 48 TEST_F(HttpResponseInfoTest, UnusedSincePrefetchPersistTrue) { |
49 response_info_.unused_since_prefetch = true; | 49 response_info_.unused_since_prefetch = true; |
50 HttpResponseInfo restored_response_info; | 50 HttpResponseInfo restored_response_info; |
51 PickleAndRestore(response_info_, &restored_response_info); | 51 PickleAndRestore(response_info_, &restored_response_info); |
52 EXPECT_TRUE(restored_response_info.unused_since_prefetch); | 52 EXPECT_TRUE(restored_response_info.unused_since_prefetch); |
53 } | 53 } |
54 | 54 |
55 } // namespace | 55 } // namespace |
56 | 56 |
57 } // namespace net | 57 } // namespace net |
OLD | NEW |