Commit 900d3d42 authored by dcheng's avatar dcheng Committed by Commit bot

Remove implicit conversions from scoped_refptr to T* in components/data_reduction_proxy/

This patch was generated by running the rewrite_scoped_refptr clang tool
on a Linux build.

BUG=110610

Review URL: https://codereview.chromium.org/501413003

Cr-Commit-Position: refs/heads/master@{#291934}
parent 45252e8e
...@@ -314,8 +314,9 @@ DataReductionProxyRequestType GetDataReductionProxyRequestType( ...@@ -314,8 +314,9 @@ DataReductionProxyRequestType GetDataReductionProxyRequestType(
return SHORT_BYPASS; return SHORT_BYPASS;
} }
#endif #endif
if (request->response_info().headers && if (request->response_info().headers.get() &&
HasDataReductionProxyViaHeader(request->response_info().headers, NULL)) { HasDataReductionProxyViaHeader(request->response_info().headers.get(),
NULL)) {
return VIA_DATA_REDUCTION_PROXY; return VIA_DATA_REDUCTION_PROXY;
} }
return UNKNOWN_TYPE; return UNKNOWN_TYPE;
......
...@@ -351,9 +351,8 @@ TEST_F(DataReductionProxyProtocolTest, OverrideResponseAsRedirect) { ...@@ -351,9 +351,8 @@ TEST_F(DataReductionProxyProtocolTest, OverrideResponseAsRedirect) {
net::DEFAULT_PRIORITY, net::DEFAULT_PRIORITY,
NULL, NULL,
&context); &context);
OverrideResponseAsRedirect(&request, OverrideResponseAsRedirect(
original_response_headers, &request, original_response_headers.get(), &override_response_headers);
&override_response_headers);
int expected_flags = net::LOAD_DISABLE_CACHE | net::LOAD_BYPASS_PROXY; int expected_flags = net::LOAD_DISABLE_CACHE | net::LOAD_BYPASS_PROXY;
EXPECT_EQ(expected_flags, request.load_flags()); EXPECT_EQ(expected_flags, request.load_flags());
std::string override_headers; std::string override_headers;
......
...@@ -250,7 +250,7 @@ TEST_F(DataReductionProxyTamperDetectionTest, ChromeProxy) { ...@@ -250,7 +250,7 @@ TEST_F(DataReductionProxyTamperDetectionTest, ChromeProxy) {
scoped_refptr<net::HttpResponseHeaders> headers( scoped_refptr<net::HttpResponseHeaders> headers(
new net::HttpResponseHeaders(raw_headers)); new net::HttpResponseHeaders(raw_headers));
DataReductionProxyTamperDetection tamper_detection(headers, true, 0); DataReductionProxyTamperDetection tamper_detection(headers.get(), true, 0);
bool tampered = tamper_detection.ValidateChromeProxyHeader( bool tampered = tamper_detection.ValidateChromeProxyHeader(
test[i].received_fingerprint); test[i].received_fingerprint);
...@@ -374,7 +374,7 @@ TEST_F(DataReductionProxyTamperDetectionTest, Via) { ...@@ -374,7 +374,7 @@ TEST_F(DataReductionProxyTamperDetectionTest, Via) {
scoped_refptr<net::HttpResponseHeaders> headers( scoped_refptr<net::HttpResponseHeaders> headers(
new net::HttpResponseHeaders(raw_headers)); new net::HttpResponseHeaders(raw_headers));
DataReductionProxyTamperDetection tamper_detection(headers, true, 0); DataReductionProxyTamperDetection tamper_detection(headers.get(), true, 0);
bool has_chrome_proxy_via_header; bool has_chrome_proxy_via_header;
bool tampered = tamper_detection.ValidateViaHeader( bool tampered = tamper_detection.ValidateViaHeader(
...@@ -507,7 +507,7 @@ TEST_F(DataReductionProxyTamperDetectionTest, OtherHeaders) { ...@@ -507,7 +507,7 @@ TEST_F(DataReductionProxyTamperDetectionTest, OtherHeaders) {
scoped_refptr<net::HttpResponseHeaders> headers( scoped_refptr<net::HttpResponseHeaders> headers(
new net::HttpResponseHeaders(raw_headers)); new net::HttpResponseHeaders(raw_headers));
DataReductionProxyTamperDetection tamper_detection(headers, true, 0); DataReductionProxyTamperDetection tamper_detection(headers.get(), true, 0);
bool tampered = tamper_detection.ValidateOtherHeaders( bool tampered = tamper_detection.ValidateOtherHeaders(
test[i].received_fingerprint); test[i].received_fingerprint);
...@@ -583,7 +583,7 @@ TEST_F(DataReductionProxyTamperDetectionTest, ContentLength) { ...@@ -583,7 +583,7 @@ TEST_F(DataReductionProxyTamperDetectionTest, ContentLength) {
scoped_refptr<net::HttpResponseHeaders> headers( scoped_refptr<net::HttpResponseHeaders> headers(
new net::HttpResponseHeaders(raw_headers)); new net::HttpResponseHeaders(raw_headers));
DataReductionProxyTamperDetection tamper_detection(headers, true, 0); DataReductionProxyTamperDetection tamper_detection(headers.get(), true, 0);
bool tampered = tamper_detection.ValidateContentLengthHeader( bool tampered = tamper_detection.ValidateContentLengthHeader(
test[i].received_fingerprint); test[i].received_fingerprint);
...@@ -674,8 +674,8 @@ TEST_F(DataReductionProxyTamperDetectionTest, GetHeaderValues) { ...@@ -674,8 +674,8 @@ TEST_F(DataReductionProxyTamperDetectionTest, GetHeaderValues) {
StringsToVector(test[i].expected_output_values); StringsToVector(test[i].expected_output_values);
std::vector<std::string> output_values = std::vector<std::string> output_values =
DataReductionProxyTamperDetection::GetHeaderValues( DataReductionProxyTamperDetection::GetHeaderValues(headers.get(),
headers, test[i].header_name); test[i].header_name);
EXPECT_EQ(expected_output_values, output_values) << test[i].label; EXPECT_EQ(expected_output_values, output_values) << test[i].label;
} }
} }
...@@ -747,8 +747,9 @@ TEST_F(DataReductionProxyTamperDetectionTest, DetectAndReport) { ...@@ -747,8 +747,9 @@ TEST_F(DataReductionProxyTamperDetectionTest, DetectAndReport) {
scoped_refptr<net::HttpResponseHeaders> headers( scoped_refptr<net::HttpResponseHeaders> headers(
new net::HttpResponseHeaders(raw_headers)); new net::HttpResponseHeaders(raw_headers));
EXPECT_EQ(test[i].expected_tampered_with, EXPECT_EQ(
DataReductionProxyTamperDetection::DetectAndReport(headers, true)) test[i].expected_tampered_with,
DataReductionProxyTamperDetection::DetectAndReport(headers.get(), true))
<< test[i].label; << test[i].label;
} }
} }
......
...@@ -112,7 +112,7 @@ TEST_F(DataReductionProxyHeadersTest, GetDataReductionProxyActionValue) { ...@@ -112,7 +112,7 @@ TEST_F(DataReductionProxyHeadersTest, GetDataReductionProxyActionValue) {
std::string action_value; std::string action_value;
bool has_action_key = GetDataReductionProxyActionValue( bool has_action_key = GetDataReductionProxyActionValue(
parsed, tests[i].action_key, &action_value); parsed.get(), tests[i].action_key, &action_value);
EXPECT_EQ(tests[i].expected_result, has_action_key); EXPECT_EQ(tests[i].expected_result, has_action_key);
if (has_action_key) { if (has_action_key) {
EXPECT_EQ(tests[i].expected_action_value, action_value); EXPECT_EQ(tests[i].expected_action_value, action_value);
...@@ -361,8 +361,9 @@ TEST_F(DataReductionProxyHeadersTest, GetProxyBypassInfo) { ...@@ -361,8 +361,9 @@ TEST_F(DataReductionProxyHeadersTest, GetProxyBypassInfo) {
new net::HttpResponseHeaders(headers)); new net::HttpResponseHeaders(headers));
DataReductionProxyInfo data_reduction_proxy_info; DataReductionProxyInfo data_reduction_proxy_info;
EXPECT_EQ(tests[i].expected_result, EXPECT_EQ(
ParseHeadersAndSetProxyInfo(parsed, &data_reduction_proxy_info)); tests[i].expected_result,
ParseHeadersAndSetProxyInfo(parsed.get(), &data_reduction_proxy_info));
EXPECT_EQ(tests[i].expected_retry_delay, EXPECT_EQ(tests[i].expected_retry_delay,
data_reduction_proxy_info.bypass_duration.InSeconds()); data_reduction_proxy_info.bypass_duration.InSeconds());
EXPECT_EQ(tests[i].expected_bypass_all, EXPECT_EQ(tests[i].expected_bypass_all,
...@@ -383,7 +384,8 @@ TEST_F(DataReductionProxyHeadersTest, ParseHeadersAndSetProxyInfo) { ...@@ -383,7 +384,8 @@ TEST_F(DataReductionProxyHeadersTest, ParseHeadersAndSetProxyInfo) {
new net::HttpResponseHeaders(headers)); new net::HttpResponseHeaders(headers));
DataReductionProxyInfo data_reduction_proxy_info; DataReductionProxyInfo data_reduction_proxy_info;
EXPECT_TRUE(ParseHeadersAndSetProxyInfo(parsed, &data_reduction_proxy_info)); EXPECT_TRUE(
ParseHeadersAndSetProxyInfo(parsed.get(), &data_reduction_proxy_info));
EXPECT_LE(60, data_reduction_proxy_info.bypass_duration.InSeconds()); EXPECT_LE(60, data_reduction_proxy_info.bypass_duration.InSeconds());
EXPECT_GE(5 * 60, data_reduction_proxy_info.bypass_duration.InSeconds()); EXPECT_GE(5 * 60, data_reduction_proxy_info.bypass_duration.InSeconds());
EXPECT_FALSE(data_reduction_proxy_info.bypass_all); EXPECT_FALSE(data_reduction_proxy_info.bypass_all);
...@@ -513,11 +515,11 @@ TEST_F(DataReductionProxyHeadersTest, HasDataReductionProxyViaHeader) { ...@@ -513,11 +515,11 @@ TEST_F(DataReductionProxyHeadersTest, HasDataReductionProxyViaHeader) {
bool has_chrome_proxy_via_header, has_intermediary; bool has_chrome_proxy_via_header, has_intermediary;
if (tests[i].ignore_intermediary) { if (tests[i].ignore_intermediary) {
has_chrome_proxy_via_header = has_chrome_proxy_via_header =
HasDataReductionProxyViaHeader(parsed, NULL); HasDataReductionProxyViaHeader(parsed.get(), NULL);
} }
else { else {
has_chrome_proxy_via_header = has_chrome_proxy_via_header =
HasDataReductionProxyViaHeader(parsed, &has_intermediary); HasDataReductionProxyViaHeader(parsed.get(), &has_intermediary);
} }
EXPECT_EQ(tests[i].expected_result, has_chrome_proxy_via_header); EXPECT_EQ(tests[i].expected_result, has_chrome_proxy_via_header);
if (has_chrome_proxy_via_header && !tests[i].ignore_intermediary) { if (has_chrome_proxy_via_header && !tests[i].ignore_intermediary) {
...@@ -633,8 +635,9 @@ TEST_F(DataReductionProxyHeadersTest, GetDataReductionProxyBypassEventType) { ...@@ -633,8 +635,9 @@ TEST_F(DataReductionProxyHeadersTest, GetDataReductionProxyBypassEventType) {
scoped_refptr<net::HttpResponseHeaders> parsed( scoped_refptr<net::HttpResponseHeaders> parsed(
new net::HttpResponseHeaders(headers)); new net::HttpResponseHeaders(headers));
DataReductionProxyInfo chrome_proxy_info; DataReductionProxyInfo chrome_proxy_info;
EXPECT_EQ(tests[i].expected_result, EXPECT_EQ(
GetDataReductionProxyBypassType(parsed, &chrome_proxy_info)); tests[i].expected_result,
GetDataReductionProxyBypassType(parsed.get(), &chrome_proxy_info));
} }
} }
...@@ -673,7 +676,7 @@ TEST_F(DataReductionProxyHeadersTest, ...@@ -673,7 +676,7 @@ TEST_F(DataReductionProxyHeadersTest,
std::string fingerprint; std::string fingerprint;
bool fingerprint_exist = GetDataReductionProxyActionFingerprintChromeProxy( bool fingerprint_exist = GetDataReductionProxyActionFingerprintChromeProxy(
parsed, &fingerprint); parsed.get(), &fingerprint);
EXPECT_EQ(tests[i].expected_fingerprint_exist, fingerprint_exist) EXPECT_EQ(tests[i].expected_fingerprint_exist, fingerprint_exist)
<< tests[i].label; << tests[i].label;
...@@ -717,7 +720,7 @@ TEST_F(DataReductionProxyHeadersTest, ...@@ -717,7 +720,7 @@ TEST_F(DataReductionProxyHeadersTest,
std::string fingerprint; std::string fingerprint;
bool fingerprint_exist = bool fingerprint_exist =
GetDataReductionProxyActionFingerprintVia(parsed, &fingerprint); GetDataReductionProxyActionFingerprintVia(parsed.get(), &fingerprint);
EXPECT_EQ(tests[i].expected_fingerprint_exist, fingerprint_exist) EXPECT_EQ(tests[i].expected_fingerprint_exist, fingerprint_exist)
<< tests[i].label; << tests[i].label;
...@@ -760,9 +763,8 @@ TEST_F(DataReductionProxyHeadersTest, ...@@ -760,9 +763,8 @@ TEST_F(DataReductionProxyHeadersTest,
new net::HttpResponseHeaders(headers)); new net::HttpResponseHeaders(headers));
std::string fingerprint; std::string fingerprint;
bool fingerprint_exist = bool fingerprint_exist = GetDataReductionProxyActionFingerprintOtherHeaders(
GetDataReductionProxyActionFingerprintOtherHeaders( parsed.get(), &fingerprint);
parsed, &fingerprint);
EXPECT_EQ(tests[i].expected_fingerprint_exist, fingerprint_exist) EXPECT_EQ(tests[i].expected_fingerprint_exist, fingerprint_exist)
<< tests[i].label; << tests[i].label;
...@@ -806,8 +808,8 @@ TEST_F(DataReductionProxyHeadersTest, ...@@ -806,8 +808,8 @@ TEST_F(DataReductionProxyHeadersTest,
std::string fingerprint; std::string fingerprint;
bool fingerprint_exist = bool fingerprint_exist =
GetDataReductionProxyActionFingerprintContentLength( GetDataReductionProxyActionFingerprintContentLength(parsed.get(),
parsed, &fingerprint); &fingerprint);
EXPECT_EQ(tests[i].expected_fingerprint_exist, fingerprint_exist) EXPECT_EQ(tests[i].expected_fingerprint_exist, fingerprint_exist)
<< tests[i].label; << tests[i].label;
...@@ -870,7 +872,8 @@ TEST_F(DataReductionProxyHeadersTest, ...@@ -870,7 +872,8 @@ TEST_F(DataReductionProxyHeadersTest,
new net::HttpResponseHeaders(headers)); new net::HttpResponseHeaders(headers));
std::vector<std::string> output_values; std::vector<std::string> output_values;
GetDataReductionProxyHeaderWithFingerprintRemoved(parsed, &output_values); GetDataReductionProxyHeaderWithFingerprintRemoved(parsed.get(),
&output_values);
std::string output_values_string; std::string output_values_string;
for (size_t j = 0; j < output_values.size(); ++j) for (size_t j = 0; j < output_values.size(); ++j)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment