Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(612)

Unified Diff: net/http/http_response_info_unittest.cc

Issue 851503003: Update from https://crrev.com/311076 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_response_info.cc ('k') | net/http/http_server_properties.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_response_info_unittest.cc
diff --git a/net/http/http_response_info_unittest.cc b/net/http/http_response_info_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..07e4b6de145449a4c46cd02c8122f6bc6ec937bf
--- /dev/null
+++ b/net/http/http_response_info_unittest.cc
@@ -0,0 +1,49 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/http/http_response_info.h"
+
+#include "base/pickle.h"
+#include "net/http/http_response_headers.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+class HttpResponseInfoTest : public testing::Test {
+ protected:
+ void SetUp() override {
+ response_info_.headers = new net::HttpResponseHeaders("");
+ }
+
+ void PickleAndRestore(const net::HttpResponseInfo& response_info,
+ net::HttpResponseInfo* restored_response_info) const {
+ Pickle pickle;
+ response_info.Persist(&pickle, false, false);
+ bool truncated = false;
+ restored_response_info->InitFromPickle(pickle, &truncated);
+ }
+
+ net::HttpResponseInfo response_info_;
+};
+
+TEST_F(HttpResponseInfoTest, UnusedSincePrefetchDefault) {
+ EXPECT_FALSE(response_info_.unused_since_prefetch);
+}
+
+TEST_F(HttpResponseInfoTest, UnusedSincePrefetchCopy) {
+ response_info_.unused_since_prefetch = true;
+ net::HttpResponseInfo response_info_clone(response_info_);
+ EXPECT_TRUE(response_info_clone.unused_since_prefetch);
+}
+
+TEST_F(HttpResponseInfoTest, UnusedSincePrefetchPersistFalse) {
+ net::HttpResponseInfo restored_response_info;
+ PickleAndRestore(response_info_, &restored_response_info);
+ EXPECT_FALSE(restored_response_info.unused_since_prefetch);
+}
+
+TEST_F(HttpResponseInfoTest, UnusedSincePrefetchPersistTrue) {
+ response_info_.unused_since_prefetch = true;
+ net::HttpResponseInfo restored_response_info;
+ PickleAndRestore(response_info_, &restored_response_info);
+ EXPECT_TRUE(restored_response_info.unused_since_prefetch);
+}
« no previous file with comments | « net/http/http_response_info.cc ('k') | net/http/http_server_properties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698