| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h" | 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 .Times(AnyNumber()) | 74 .Times(AnyNumber()) |
| 75 .WillRepeatedly(Return(&pref_service_)); | 75 .WillRepeatedly(Return(&pref_service_)); |
| 76 EXPECT_CALL(*settings, GetURLFetcherForAvailabilityCheck()).Times(0); | 76 EXPECT_CALL(*settings, GetURLFetcherForAvailabilityCheck()).Times(0); |
| 77 EXPECT_CALL(*settings, LogProxyState(_, _, _)).Times(0); | 77 EXPECT_CALL(*settings, LogProxyState(_, _, _)).Times(0); |
| 78 settings_.reset(settings); | 78 settings_.reset(settings); |
| 79 } | 79 } |
| 80 | 80 |
| 81 template <class C> | 81 template <class C> |
| 82 void data_reduction_proxy::DataReductionProxySettingsTestBase::SetProbeResult( | 82 void data_reduction_proxy::DataReductionProxySettingsTestBase::SetProbeResult( |
| 83 const std::string& test_url, | 83 const std::string& test_url, |
| 84 const std::string& warmup_test_url, | |
| 85 const std::string& response, | 84 const std::string& response, |
| 86 ProbeURLFetchResult result, | 85 ProbeURLFetchResult result, |
| 87 bool success, | 86 bool success, |
| 88 int expected_calls) { | 87 int expected_calls) { |
| 89 MockDataReductionProxySettings<C>* settings = | 88 MockDataReductionProxySettings<C>* settings = |
| 90 static_cast<MockDataReductionProxySettings<C>*>(settings_.get()); | 89 static_cast<MockDataReductionProxySettings<C>*>(settings_.get()); |
| 91 if (0 == expected_calls) { | 90 if (0 == expected_calls) { |
| 92 EXPECT_CALL(*settings, GetURLFetcherForAvailabilityCheck()).Times(0); | 91 EXPECT_CALL(*settings, GetURLFetcherForAvailabilityCheck()).Times(0); |
| 93 EXPECT_CALL(*settings, RecordProbeURLFetchResult(_)).Times(0); | 92 EXPECT_CALL(*settings, RecordProbeURLFetchResult(_)).Times(0); |
| 94 } else { | 93 } else { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 109 data_reduction_proxy::DataReductionProxySettingsTestBase::ResetSettings< | 108 data_reduction_proxy::DataReductionProxySettingsTestBase::ResetSettings< |
| 110 DataReductionProxyChromeSettings>(bool allowed, | 109 DataReductionProxyChromeSettings>(bool allowed, |
| 111 bool fallback_allowed, | 110 bool fallback_allowed, |
| 112 bool alt_allowed, | 111 bool alt_allowed, |
| 113 bool promo_allowed, | 112 bool promo_allowed, |
| 114 bool holdback); | 113 bool holdback); |
| 115 | 114 |
| 116 template void | 115 template void |
| 117 data_reduction_proxy::DataReductionProxySettingsTestBase::SetProbeResult< | 116 data_reduction_proxy::DataReductionProxySettingsTestBase::SetProbeResult< |
| 118 DataReductionProxyChromeSettings>(const std::string& test_url, | 117 DataReductionProxyChromeSettings>(const std::string& test_url, |
| 119 const std::string& warmup_test_url, | |
| 120 const std::string& response, | 118 const std::string& response, |
| 121 ProbeURLFetchResult result, | 119 ProbeURLFetchResult result, |
| 122 bool success, | 120 bool success, |
| 123 int expected_calls); | 121 int expected_calls); |
| 124 | 122 |
| 125 class DataReductionProxySettingsAndroidTest | 123 class DataReductionProxySettingsAndroidTest |
| 126 : public data_reduction_proxy::ConcreteDataReductionProxySettingsTest< | 124 : public data_reduction_proxy::ConcreteDataReductionProxySettingsTest< |
| 127 DataReductionProxyChromeSettings> { | 125 DataReductionProxyChromeSettings> { |
| 128 public: | 126 public: |
| 129 // DataReductionProxySettingsTest implementation: | 127 // DataReductionProxySettingsTest implementation: |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 186 |
| 189 jlong value; | 187 jlong value; |
| 190 for (size_t i = 0; i < data_reduction_proxy::kNumDaysInHistory; ++i) { | 188 for (size_t i = 0; i < data_reduction_proxy::kNumDaysInHistory; ++i) { |
| 191 env_->GetLongArrayRegion(result.obj(), i, 1, &value); | 189 env_->GetLongArrayRegion(result.obj(), i, 1, &value); |
| 192 ASSERT_EQ( | 190 ASSERT_EQ( |
| 193 static_cast<long>( | 191 static_cast<long>( |
| 194 (data_reduction_proxy::kNumDaysInHistory - 1 - i) * 2), value); | 192 (data_reduction_proxy::kNumDaysInHistory - 1 - i) * 2), value); |
| 195 } | 193 } |
| 196 } | 194 } |
| 197 | 195 |
| OLD | NEW |