| 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_sett
ings.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/md5.h" | 8 #include "base/md5.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/test/mock_entropy_provider.h" | 10 #include "base/test/mock_entropy_provider.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // Request 1 day. First day had 0 bytes so should be same as 0 days. | 136 // Request 1 day. First day had 0 bytes so should be same as 0 days. |
| 137 settings_->GetContentLengths(1, | 137 settings_->GetContentLengths(1, |
| 138 &original_content_length, | 138 &original_content_length, |
| 139 &received_content_length, | 139 &received_content_length, |
| 140 &last_update_time); | 140 &last_update_time); |
| 141 EXPECT_EQ(expected_total_original_content_length, original_content_length); | 141 EXPECT_EQ(expected_total_original_content_length, original_content_length); |
| 142 EXPECT_EQ(expected_total_received_content_length, received_content_length); | 142 EXPECT_EQ(expected_total_received_content_length, received_content_length); |
| 143 } | 143 } |
| 144 | 144 |
| 145 TEST(DataReductionProxySettingsStandaloneTest, TestEndToEndSecureProxyCheck) { | 145 TEST(DataReductionProxySettingsStandaloneTest, TestEndToEndSecureProxyCheck) { |
| 146 base::MessageLoopForIO message_loop; |
| 146 struct TestCase { | 147 struct TestCase { |
| 147 const char* response_headers; | 148 const char* response_headers; |
| 148 const char* response_body; | 149 const char* response_body; |
| 149 net::Error net_error_code; | 150 net::Error net_error_code; |
| 150 bool expected_restricted; | 151 bool expected_restricted; |
| 151 }; | 152 }; |
| 152 const TestCase kTestCases[] { | 153 const TestCase kTestCases[] { |
| 153 { "HTTP/1.1 200 OK\r\n\r\n", | 154 { "HTTP/1.1 200 OK\r\n\r\n", |
| 154 "OK", net::OK, false, | 155 "OK", net::OK, false, |
| 155 }, | 156 }, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 drp_test_context->pref_service()->SetBoolean( | 209 drp_test_context->pref_service()->SetBoolean( |
| 209 prefs::kDataReductionProxyEnabled, true); | 210 prefs::kDataReductionProxyEnabled, true); |
| 210 drp_test_context->RunUntilIdle(); | 211 drp_test_context->RunUntilIdle(); |
| 211 | 212 |
| 212 EXPECT_EQ(test_case.expected_restricted, | 213 EXPECT_EQ(test_case.expected_restricted, |
| 213 drp_test_context->test_configurator()->restricted()); | 214 drp_test_context->test_configurator()->restricted()); |
| 214 } | 215 } |
| 215 } | 216 } |
| 216 | 217 |
| 217 TEST(DataReductionProxySettingsStandaloneTest, TestOnProxyEnabledPrefChange) { | 218 TEST(DataReductionProxySettingsStandaloneTest, TestOnProxyEnabledPrefChange) { |
| 219 base::MessageLoopForIO message_loop; |
| 218 scoped_ptr<DataReductionProxyTestContext> drp_test_context = | 220 scoped_ptr<DataReductionProxyTestContext> drp_test_context = |
| 219 DataReductionProxyTestContext::Builder() | 221 DataReductionProxyTestContext::Builder() |
| 220 .WithParamsFlags(DataReductionProxyParams::kAllowed | | 222 .WithParamsFlags(DataReductionProxyParams::kAllowed | |
| 221 DataReductionProxyParams::kFallbackAllowed | | 223 DataReductionProxyParams::kFallbackAllowed | |
| 222 DataReductionProxyParams::kPromoAllowed) | 224 DataReductionProxyParams::kPromoAllowed) |
| 223 .WithParamsDefinitions( | 225 .WithParamsDefinitions( |
| 224 TestDataReductionProxyParams::HAS_EVERYTHING & | 226 TestDataReductionProxyParams::HAS_EVERYTHING & |
| 225 ~TestDataReductionProxyParams::HAS_DEV_ORIGIN & | 227 ~TestDataReductionProxyParams::HAS_DEV_ORIGIN & |
| 226 ~TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN) | 228 ~TestDataReductionProxyParams::HAS_DEV_FALLBACK_ORIGIN) |
| 227 .WithMockConfig() | 229 .WithMockConfig() |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 base::Bind(&DataReductionProxySettingsTestBase:: | 422 base::Bind(&DataReductionProxySettingsTestBase:: |
| 421 SyntheticFieldTrialRegistrationCallback, | 423 SyntheticFieldTrialRegistrationCallback, |
| 422 base::Unretained(this))); | 424 base::Unretained(this))); |
| 423 | 425 |
| 424 EXPECT_EQ(enable_quic, | 426 EXPECT_EQ(enable_quic, |
| 425 test_context_->config()->test_params()->origin().is_quic()) << i; | 427 test_context_->config()->test_params()->origin().is_quic()) << i; |
| 426 } | 428 } |
| 427 } | 429 } |
| 428 | 430 |
| 429 } // namespace data_reduction_proxy | 431 } // namespace data_reduction_proxy |
| OLD | NEW |