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

Side by Side Diff: components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc

Issue 390533003: Bypassed Bytes UMAs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "Addressed bengr comments" Created 6 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h" 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol. h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 std::replace(headers->begin(), headers->end(), '\n', '\0'); 42 std::replace(headers->begin(), headers->end(), '\n', '\0');
43 if (!headers->empty()) 43 if (!headers->empty())
44 *headers += '\0'; 44 *headers += '\0';
45 } 45 }
46 46
47 } // namespace 47 } // namespace
48 48
49 49
50 namespace data_reduction_proxy { 50 namespace data_reduction_proxy {
51 51
52 // A test network delegate that exercises the bypass logic of the data
53 // reduction proxy.
54 class TestDataReductionProxyNetworkDelegate : public net::NetworkDelegate { 52 class TestDataReductionProxyNetworkDelegate : public net::NetworkDelegate {
55 public: 53 public:
56 TestDataReductionProxyNetworkDelegate( 54 TestDataReductionProxyNetworkDelegate(
57 TestDataReductionProxyParams* test_params) 55 TestDataReductionProxyParams* test_params)
58 : net::NetworkDelegate(), test_data_reduction_proxy_params_(test_params) { 56 : net::NetworkDelegate(), test_data_reduction_proxy_params_(test_params) {
59 } 57 }
60 58
61 virtual int OnHeadersReceived( 59 virtual int OnHeadersReceived(
62 URLRequest* request, 60 URLRequest* request,
63 const net::CompletionCallback& callback, 61 const net::CompletionCallback& callback,
64 const HttpResponseHeaders* original_response_headers, 62 const HttpResponseHeaders* original_response_headers,
65 scoped_refptr<HttpResponseHeaders>* override_response_headers, 63 scoped_refptr<HttpResponseHeaders>* override_response_headers,
66 GURL* allowed_unsafe_redirect_url) OVERRIDE { 64 GURL* allowed_unsafe_redirect_url) OVERRIDE {
67 data_reduction_proxy::MaybeBypassProxyAndPrepareToRetry( 65 data_reduction_proxy::MaybeBypassProxyAndPrepareToRetry(
66 net::ProxyService::DataReductionProxyBypassType::BYPASS_EVENT_TYPE_MAX,
68 test_data_reduction_proxy_params_, 67 test_data_reduction_proxy_params_,
69 request, 68 request,
70 original_response_headers, 69 original_response_headers,
71 override_response_headers); 70 override_response_headers);
72 return net::OK; 71 return net::OK;
73 } 72 }
74 73
75 TestDataReductionProxyParams* test_data_reduction_proxy_params_; 74 TestDataReductionProxyParams* test_data_reduction_proxy_params_;
76 }; 75 };
77 76
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 EXPECT_EQ(net::URLRequestStatus::SUCCESS, r.status().status()); 604 EXPECT_EQ(net::URLRequestStatus::SUCCESS, r.status().status());
606 EXPECT_EQ(net::OK, r.status().error()); 605 EXPECT_EQ(net::OK, r.status().error());
607 606
608 EXPECT_EQ("Bypass message", d.data_received()); 607 EXPECT_EQ("Bypass message", d.data_received());
609 608
610 // We should have no entries in our bad proxy list. 609 // We should have no entries in our bad proxy list.
611 TestBadProxies(0, -1, "", ""); 610 TestBadProxies(0, -1, "", "");
612 } 611 }
613 612
614 } // namespace data_reduction_proxy 613 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698