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 21 matching lines...) Expand all Loading... |
32 : public DataReductionProxySettingsAndroid { | 32 : public DataReductionProxySettingsAndroid { |
33 public: | 33 public: |
34 // Constructs an Android settings object for test that wraps the provided | 34 // Constructs an Android settings object for test that wraps the provided |
35 // settings object. | 35 // settings object. |
36 explicit TestDataReductionProxySettingsAndroid( | 36 explicit TestDataReductionProxySettingsAndroid( |
37 DataReductionProxySettings* settings) | 37 DataReductionProxySettings* settings) |
38 : DataReductionProxySettingsAndroid(), | 38 : DataReductionProxySettingsAndroid(), |
39 settings_(settings) {} | 39 settings_(settings) {} |
40 | 40 |
41 // Returns the provided setting object. Used by wrapping methods. | 41 // Returns the provided setting object. Used by wrapping methods. |
42 virtual DataReductionProxySettings* Settings() override { | 42 DataReductionProxySettings* Settings() override { return settings_; } |
43 return settings_; | |
44 } | |
45 | 43 |
46 // The wrapped settings object. | 44 // The wrapped settings object. |
47 DataReductionProxySettings* settings_; | 45 DataReductionProxySettings* settings_; |
48 }; | 46 }; |
49 | 47 |
50 template <class C> | 48 template <class C> |
51 void data_reduction_proxy::DataReductionProxySettingsTestBase::ResetSettings( | 49 void data_reduction_proxy::DataReductionProxySettingsTestBase::ResetSettings( |
52 bool allowed, | 50 bool allowed, |
53 bool fallback_allowed, | 51 bool fallback_allowed, |
54 bool alt_allowed, | 52 bool alt_allowed, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 const std::string& response, | 117 const std::string& response, |
120 ProbeURLFetchResult result, | 118 ProbeURLFetchResult result, |
121 bool success, | 119 bool success, |
122 int expected_calls); | 120 int expected_calls); |
123 | 121 |
124 class DataReductionProxySettingsAndroidTest | 122 class DataReductionProxySettingsAndroidTest |
125 : public data_reduction_proxy::ConcreteDataReductionProxySettingsTest< | 123 : public data_reduction_proxy::ConcreteDataReductionProxySettingsTest< |
126 DataReductionProxyChromeSettings> { | 124 DataReductionProxyChromeSettings> { |
127 public: | 125 public: |
128 // DataReductionProxySettingsTest implementation: | 126 // DataReductionProxySettingsTest implementation: |
129 virtual void SetUp() override { | 127 void SetUp() override { |
130 env_ = base::android::AttachCurrentThread(); | 128 env_ = base::android::AttachCurrentThread(); |
131 DataReductionProxySettingsAndroid::Register(env_); | 129 DataReductionProxySettingsAndroid::Register(env_); |
132 DataReductionProxySettingsTestBase::SetUp(); | 130 DataReductionProxySettingsTestBase::SetUp(); |
133 ResetSettingsAndroid(); | 131 ResetSettingsAndroid(); |
134 } | 132 } |
135 | 133 |
136 void ResetSettingsAndroid() { | 134 void ResetSettingsAndroid() { |
137 settings_android_.reset(new TestDataReductionProxySettingsAndroid( | 135 settings_android_.reset(new TestDataReductionProxySettingsAndroid( |
138 settings_.get())); | 136 settings_.get())); |
139 } | 137 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 185 |
188 jlong value; | 186 jlong value; |
189 for (size_t i = 0; i < data_reduction_proxy::kNumDaysInHistory; ++i) { | 187 for (size_t i = 0; i < data_reduction_proxy::kNumDaysInHistory; ++i) { |
190 env_->GetLongArrayRegion(result.obj(), i, 1, &value); | 188 env_->GetLongArrayRegion(result.obj(), i, 1, &value); |
191 ASSERT_EQ( | 189 ASSERT_EQ( |
192 static_cast<long>( | 190 static_cast<long>( |
193 (data_reduction_proxy::kNumDaysInHistory - 1 - i) * 2), value); | 191 (data_reduction_proxy::kNumDaysInHistory - 1 - i) * 2), value); |
194 } | 192 } |
195 } | 193 } |
196 | 194 |
OLD | NEW |