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 virtual DataReductionProxySettings* Settings() override { |
43 return settings_; | 43 return settings_; |
44 } | 44 } |
45 | 45 |
46 // The wrapped settings object. | 46 // The wrapped settings object. |
47 DataReductionProxySettings* settings_; | 47 DataReductionProxySettings* settings_; |
48 }; | 48 }; |
49 | 49 |
50 template <class C> | 50 template <class C> |
51 void data_reduction_proxy::DataReductionProxySettingsTestBase::ResetSettings( | 51 void data_reduction_proxy::DataReductionProxySettingsTestBase::ResetSettings( |
52 bool allowed, | 52 bool allowed, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 const std::string& response, | 119 const std::string& response, |
120 ProbeURLFetchResult result, | 120 ProbeURLFetchResult result, |
121 bool success, | 121 bool success, |
122 int expected_calls); | 122 int expected_calls); |
123 | 123 |
124 class DataReductionProxySettingsAndroidTest | 124 class DataReductionProxySettingsAndroidTest |
125 : public data_reduction_proxy::ConcreteDataReductionProxySettingsTest< | 125 : public data_reduction_proxy::ConcreteDataReductionProxySettingsTest< |
126 DataReductionProxyChromeSettings> { | 126 DataReductionProxyChromeSettings> { |
127 public: | 127 public: |
128 // DataReductionProxySettingsTest implementation: | 128 // DataReductionProxySettingsTest implementation: |
129 virtual void SetUp() OVERRIDE { | 129 virtual void SetUp() override { |
130 env_ = base::android::AttachCurrentThread(); | 130 env_ = base::android::AttachCurrentThread(); |
131 DataReductionProxySettingsAndroid::Register(env_); | 131 DataReductionProxySettingsAndroid::Register(env_); |
132 DataReductionProxySettingsTestBase::SetUp(); | 132 DataReductionProxySettingsTestBase::SetUp(); |
133 ResetSettingsAndroid(); | 133 ResetSettingsAndroid(); |
134 } | 134 } |
135 | 135 |
136 void ResetSettingsAndroid() { | 136 void ResetSettingsAndroid() { |
137 settings_android_.reset(new TestDataReductionProxySettingsAndroid( | 137 settings_android_.reset(new TestDataReductionProxySettingsAndroid( |
138 settings_.get())); | 138 settings_.get())); |
139 } | 139 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 jlong value; | 188 jlong value; |
189 for (size_t i = 0; i < data_reduction_proxy::kNumDaysInHistory; ++i) { | 189 for (size_t i = 0; i < data_reduction_proxy::kNumDaysInHistory; ++i) { |
190 env_->GetLongArrayRegion(result.obj(), i, 1, &value); | 190 env_->GetLongArrayRegion(result.obj(), i, 1, &value); |
191 ASSERT_EQ( | 191 ASSERT_EQ( |
192 static_cast<long>( | 192 static_cast<long>( |
193 (data_reduction_proxy::kNumDaysInHistory - 1 - i) * 2), value); | 193 (data_reduction_proxy::kNumDaysInHistory - 1 - i) * 2), value); |
194 } | 194 } |
195 } | 195 } |
196 | 196 |
OLD | NEW |