| 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_metr
ics.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_metr
ics.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig_test_utils.h" | 11 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig_test_utils.h" |
| 12 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test
_utils.h" | 12 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test
_utils.h" |
| 13 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s_test_utils.h" | 13 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s_test_utils.h" |
| 14 #include "net/base/load_flags.h" | 14 #include "net/base/load_flags.h" |
| 15 #include "net/log/net_log.h" | 15 #include "net/log/net_log.h" |
| 16 #include "net/proxy/proxy_server.h" | 16 #include "net/proxy/proxy_server.h" |
| 17 #include "net/proxy/proxy_service.h" | 17 #include "net/proxy/proxy_service.h" |
| 18 #include "net/socket/socket_test_util.h" | 18 #include "net/socket/socket_test_util.h" |
| 19 #include "net/url_request/url_request.h" | 19 #include "net/url_request/url_request.h" |
| 20 #include "net/url_request/url_request_test_util.h" | 20 #include "net/url_request/url_request_test_util.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 22 | 22 |
| 23 using net::MockRead; | 23 using net::MockRead; |
| 24 | 24 |
| 25 namespace data_reduction_proxy { | 25 namespace data_reduction_proxy { |
| 26 | 26 |
| 27 TEST(ChromeNetworkDailyDataSavingMetricsTest, | 27 TEST(ChromeNetworkDailyDataSavingMetricsTest, |
| 28 GetDataReductionProxyRequestType) { | 28 GetDataReductionProxyRequestType) { |
| 29 base::MessageLoopForIO message_loop; |
| 29 scoped_ptr<DataReductionProxyTestContext> test_context = | 30 scoped_ptr<DataReductionProxyTestContext> test_context = |
| 30 DataReductionProxyTestContext::Builder() | 31 DataReductionProxyTestContext::Builder() |
| 31 .WithParamsFlags(DataReductionProxyParams::kAllowed) | 32 .WithParamsFlags(DataReductionProxyParams::kAllowed) |
| 32 .WithParamsDefinitions(TestDataReductionProxyParams::HAS_ORIGIN) | 33 .WithParamsDefinitions(TestDataReductionProxyParams::HAS_ORIGIN) |
| 33 .Build(); | 34 .Build(); |
| 34 TestDataReductionProxyConfig* config = test_context->config(); | 35 TestDataReductionProxyConfig* config = test_context->config(); |
| 35 | 36 |
| 36 net::ProxyConfig data_reduction_proxy_config; | 37 net::ProxyConfig data_reduction_proxy_config; |
| 37 data_reduction_proxy_config.proxy_rules().ParseFromString( | 38 data_reduction_proxy_config.proxy_rules().ParseFromString( |
| 38 "http=" + config->test_params()->origin().host_port_pair().ToString() + | 39 "http=" + config->test_params()->origin().host_port_pair().ToString() + |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 } | 158 } |
| 158 | 159 |
| 159 EXPECT_EQ(test_case.expected_request_type, | 160 EXPECT_EQ(test_case.expected_request_type, |
| 160 GetDataReductionProxyRequestType( | 161 GetDataReductionProxyRequestType( |
| 161 *request, data_reduction_proxy_config, | 162 *request, data_reduction_proxy_config, |
| 162 *test_context->config())); | 163 *test_context->config())); |
| 163 } | 164 } |
| 164 } | 165 } |
| 165 | 166 |
| 166 } // namespace data_reduction_proxy | 167 } // namespace data_reduction_proxy |
| OLD | NEW |