| OLD | NEW |
| 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/core/browser/data_reduction_proxy_bypa
ss_stats.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypa
ss_stats.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 MockDataReductionProxyConfig* config() const { | 124 MockDataReductionProxyConfig* config() const { |
| 125 return test_context_->mock_config(); | 125 return test_context_->mock_config(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void RunUntilIdle() { | 128 void RunUntilIdle() { |
| 129 test_context_->RunUntilIdle(); | 129 test_context_->RunUntilIdle(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 private: | 132 private: |
| 133 base::MessageLoopForIO message_loop_; |
| 133 net::TestURLRequestContext context_; | 134 net::TestURLRequestContext context_; |
| 134 net::TestDelegate delegate_; | 135 net::TestDelegate delegate_; |
| 135 scoped_ptr<net::URLRequest> mock_url_request_; | 136 scoped_ptr<net::URLRequest> mock_url_request_; |
| 136 // |test_job_interceptor_| is owned by |test_job_factory_|. | 137 // |test_job_interceptor_| is owned by |test_job_factory_|. |
| 137 net::TestJobInterceptor* test_job_interceptor_; | 138 net::TestJobInterceptor* test_job_interceptor_; |
| 138 net::URLRequestJobFactoryImpl test_job_factory_; | 139 net::URLRequestJobFactoryImpl test_job_factory_; |
| 139 scoped_ptr<DataReductionProxyTestContext> test_context_; | 140 scoped_ptr<DataReductionProxyTestContext> test_context_; |
| 140 }; | 141 }; |
| 141 | 142 |
| 142 TEST_F(DataReductionProxyBypassStatsTest, IsDataReductionProxyUnreachable) { | 143 TEST_F(DataReductionProxyBypassStatsTest, IsDataReductionProxyUnreachable) { |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 const std::string& first_excluded_histogram, | 698 const std::string& first_excluded_histogram, |
| 698 const std::string& second_excluded_histogram) const { | 699 const std::string& second_excluded_histogram) const { |
| 699 std::set<std::string> excluded_histograms; | 700 std::set<std::string> excluded_histograms; |
| 700 excluded_histograms.insert(first_excluded_histogram); | 701 excluded_histograms.insert(first_excluded_histogram); |
| 701 excluded_histograms.insert(second_excluded_histogram); | 702 excluded_histograms.insert(second_excluded_histogram); |
| 702 ExpectOtherBypassedBytesHistogramsEmpty(histogram_tester, | 703 ExpectOtherBypassedBytesHistogramsEmpty(histogram_tester, |
| 703 excluded_histograms); | 704 excluded_histograms); |
| 704 } | 705 } |
| 705 | 706 |
| 706 private: | 707 private: |
| 708 base::MessageLoopForIO message_loop_; |
| 707 net::TestDelegate delegate_; | 709 net::TestDelegate delegate_; |
| 708 net::MockClientSocketFactory mock_socket_factory_; | 710 net::MockClientSocketFactory mock_socket_factory_; |
| 709 net::TestURLRequestContext context_; | 711 net::TestURLRequestContext context_; |
| 710 net::URLRequestContextStorage context_storage_; | 712 net::URLRequestContextStorage context_storage_; |
| 711 scoped_ptr<DataReductionProxyTestContext> drp_test_context_; | 713 scoped_ptr<DataReductionProxyTestContext> drp_test_context_; |
| 712 }; | 714 }; |
| 713 | 715 |
| 714 TEST_F(DataReductionProxyBypassStatsEndToEndTest, BypassedBytesNoRetry) { | 716 TEST_F(DataReductionProxyBypassStatsEndToEndTest, BypassedBytesNoRetry) { |
| 715 struct TestCase { | 717 struct TestCase { |
| 716 GURL url; | 718 GURL url; |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 histogram_tester.ExpectUniqueSample( | 932 histogram_tester.ExpectUniqueSample( |
| 931 "DataReductionProxy.BypassedBytes.NetworkErrorOther", kBody.size(), 1); | 933 "DataReductionProxy.BypassedBytes.NetworkErrorOther", kBody.size(), 1); |
| 932 ExpectOtherBypassedBytesHistogramsEmpty( | 934 ExpectOtherBypassedBytesHistogramsEmpty( |
| 933 histogram_tester, "DataReductionProxy.BypassedBytes.NetworkErrorOther"); | 935 histogram_tester, "DataReductionProxy.BypassedBytes.NetworkErrorOther"); |
| 934 histogram_tester.ExpectUniqueSample( | 936 histogram_tester.ExpectUniqueSample( |
| 935 "DataReductionProxy.BypassOnNetworkErrorPrimary", | 937 "DataReductionProxy.BypassOnNetworkErrorPrimary", |
| 936 -net::ERR_PROXY_CONNECTION_FAILED, 1); | 938 -net::ERR_PROXY_CONNECTION_FAILED, 1); |
| 937 } | 939 } |
| 938 | 940 |
| 939 } // namespace data_reduction_proxy | 941 } // namespace data_reduction_proxy |
| OLD | NEW |