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

Side by Side Diff: net/http/http_response_headers_unittest.cc

Issue 502163003: Remove implicit conversions from scoped_refptr to T* in net/http/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 #include <limits> 6 #include <limits>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 const scoped_refptr<net::HttpResponseHeaders>& headers() { return headers_; } 55 const scoped_refptr<net::HttpResponseHeaders>& headers() { return headers_; }
56 56
57 // Return a pointer to a TimeDelta object. For use when the value doesn't 57 // Return a pointer to a TimeDelta object. For use when the value doesn't
58 // matter. 58 // matter.
59 TimeDelta* TimeDeltaPointer() { return &delta_; } 59 TimeDelta* TimeDeltaPointer() { return &delta_; }
60 60
61 // Get the max-age value. This should only be used in tests where a valid 61 // Get the max-age value. This should only be used in tests where a valid
62 // max-age parameter is expected to be present. 62 // max-age parameter is expected to be present.
63 TimeDelta GetMaxAgeValue() { 63 TimeDelta GetMaxAgeValue() {
64 DCHECK(headers_) << "Call InitializeHeadersWithCacheControl() first"; 64 DCHECK(headers_.get()) << "Call InitializeHeadersWithCacheControl() first";
65 TimeDelta max_age_value; 65 TimeDelta max_age_value;
66 EXPECT_TRUE(headers()->GetMaxAgeValue(&max_age_value)); 66 EXPECT_TRUE(headers()->GetMaxAgeValue(&max_age_value));
67 return max_age_value; 67 return max_age_value;
68 } 68 }
69 69
70 // Get the stale-while-revalidate value. This should only be used in tests 70 // Get the stale-while-revalidate value. This should only be used in tests
71 // where a valid max-age parameter is expected to be present. 71 // where a valid max-age parameter is expected to be present.
72 TimeDelta GetStaleWhileRevalidateValue() { 72 TimeDelta GetStaleWhileRevalidateValue() {
73 DCHECK(headers_) << "Call InitializeHeadersWithCacheControl() first"; 73 DCHECK(headers_.get()) << "Call InitializeHeadersWithCacheControl() first";
74 TimeDelta stale_while_revalidate_value; 74 TimeDelta stale_while_revalidate_value;
75 EXPECT_TRUE( 75 EXPECT_TRUE(
76 headers()->GetStaleWhileRevalidateValue(&stale_while_revalidate_value)); 76 headers()->GetStaleWhileRevalidateValue(&stale_while_revalidate_value));
77 return stale_while_revalidate_value; 77 return stale_while_revalidate_value;
78 } 78 }
79 79
80 private: 80 private:
81 scoped_refptr<net::HttpResponseHeaders> headers_; 81 scoped_refptr<net::HttpResponseHeaders> headers_;
82 TimeDelta delta_; 82 TimeDelta delta_;
83 }; 83 };
(...skipping 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2247 } 2247 }
2248 2248
2249 TEST_F(HttpResponseHeadersCacheControlTest, 2249 TEST_F(HttpResponseHeadersCacheControlTest,
2250 FirstStaleWhileRevalidateValueUsed) { 2250 FirstStaleWhileRevalidateValueUsed) {
2251 InitializeHeadersWithCacheControl( 2251 InitializeHeadersWithCacheControl(
2252 "stale-while-revalidate=1,stale-while-revalidate=7200"); 2252 "stale-while-revalidate=1,stale-while-revalidate=7200");
2253 EXPECT_EQ(TimeDelta::FromSeconds(1), GetStaleWhileRevalidateValue()); 2253 EXPECT_EQ(TimeDelta::FromSeconds(1), GetStaleWhileRevalidateValue());
2254 } 2254 }
2255 2255
2256 } // end namespace 2256 } // end namespace
OLDNEW
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/http/http_stream_factory_impl_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698