Include all dupe types (event when value is zero) in scan stats.
[chromium-blink-merge.git] / net / http / http_response_info_unittest.cc
blobef7d4118eac4368526805e1b881fc817d855c8b9
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.
5 #include "net/http/http_response_info.h"
7 #include "base/pickle.h"
8 #include "net/http/http_response_headers.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 namespace net {
13 namespace {
15 class HttpResponseInfoTest : public testing::Test {
16 protected:
17 void SetUp() override {
18 response_info_.headers = new HttpResponseHeaders("");
21 void PickleAndRestore(const HttpResponseInfo& response_info,
22 HttpResponseInfo* restored_response_info) const {
23 base::Pickle pickle;
24 response_info.Persist(&pickle, false, false);
25 bool truncated = false;
26 restored_response_info->InitFromPickle(pickle, &truncated);
29 HttpResponseInfo response_info_;
32 TEST_F(HttpResponseInfoTest, UnusedSincePrefetchDefault) {
33 EXPECT_FALSE(response_info_.unused_since_prefetch);
36 TEST_F(HttpResponseInfoTest, UnusedSincePrefetchCopy) {
37 response_info_.unused_since_prefetch = true;
38 HttpResponseInfo response_info_clone(response_info_);
39 EXPECT_TRUE(response_info_clone.unused_since_prefetch);
42 TEST_F(HttpResponseInfoTest, UnusedSincePrefetchPersistFalse) {
43 HttpResponseInfo restored_response_info;
44 PickleAndRestore(response_info_, &restored_response_info);
45 EXPECT_FALSE(restored_response_info.unused_since_prefetch);
48 TEST_F(HttpResponseInfoTest, UnusedSincePrefetchPersistTrue) {
49 response_info_.unused_since_prefetch = true;
50 HttpResponseInfo restored_response_info;
51 PickleAndRestore(response_info_, &restored_response_info);
52 EXPECT_TRUE(restored_response_info.unused_since_prefetch);
55 } // namespace
57 } // namespace net