Chromium Code Reviews| 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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "base/test/test_simple_task_runner.h" | |
| 13 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 14 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
| 14 #include "chrome/browser/prefs/proxy_prefs.h" | 15 #include "chrome/browser/prefs/proxy_prefs.h" |
| 15 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 16 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 17 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings_test_utils.h" | 18 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett ings_test_utils.h" |
| 18 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 21 | 22 |
| 22 using testing::_; | 23 using testing::_; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 new MockDataReductionProxySettings<C>(flags); | 70 new MockDataReductionProxySettings<C>(flags); |
| 70 EXPECT_CALL(*settings, GetOriginalProfilePrefs()) | 71 EXPECT_CALL(*settings, GetOriginalProfilePrefs()) |
| 71 .Times(AnyNumber()) | 72 .Times(AnyNumber()) |
| 72 .WillRepeatedly(Return(&pref_service_)); | 73 .WillRepeatedly(Return(&pref_service_)); |
| 73 EXPECT_CALL(*settings, GetLocalStatePrefs()) | 74 EXPECT_CALL(*settings, GetLocalStatePrefs()) |
| 74 .Times(AnyNumber()) | 75 .Times(AnyNumber()) |
| 75 .WillRepeatedly(Return(&pref_service_)); | 76 .WillRepeatedly(Return(&pref_service_)); |
| 76 EXPECT_CALL(*settings, GetURLFetcherForAvailabilityCheck()).Times(0); | 77 EXPECT_CALL(*settings, GetURLFetcherForAvailabilityCheck()).Times(0); |
| 77 EXPECT_CALL(*settings, LogProxyState(_, _, _)).Times(0); | 78 EXPECT_CALL(*settings, LogProxyState(_, _, _)).Times(0); |
| 78 settings_.reset(settings); | 79 settings_.reset(settings); |
| 79 settings_->SetDataReductionProxyStatisticsPrefs(statistics_prefs_.get()); | 80 settings_->SetDataReductionProxyStatisticsPrefs( |
| 81 scoped_ptr<DataReductionProxyStatisticsPrefs>( | |
| 82 new DataReductionProxyStatisticsPrefs( | |
| 83 &pref_service_, | |
| 84 scoped_refptr<base::TestSimpleTaskRunner>( | |
| 85 new base::TestSimpleTaskRunner()), | |
| 86 base::TimeDelta()))); | |
|
bengr
2015/02/03 23:51:17
#include "base/memory/ref_counted.h"
#include "bas
megjablon
2015/02/04 18:47:54
Done.
| |
| 80 } | 87 } |
| 81 | 88 |
| 82 template <class C> | 89 template <class C> |
| 83 void data_reduction_proxy::DataReductionProxySettingsTestBase::SetProbeResult( | 90 void data_reduction_proxy::DataReductionProxySettingsTestBase::SetProbeResult( |
| 84 const std::string& test_url, | 91 const std::string& test_url, |
| 85 const std::string& response, | 92 const std::string& response, |
| 86 ProbeURLFetchResult result, | 93 ProbeURLFetchResult result, |
| 87 bool success, | 94 bool success, |
| 88 int expected_calls) { | 95 int expected_calls) { |
| 89 MockDataReductionProxySettings<C>* settings = | 96 MockDataReductionProxySettings<C>* settings = |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 | 194 |
| 188 jlong value; | 195 jlong value; |
| 189 for (size_t i = 0; i < data_reduction_proxy::kNumDaysInHistory; ++i) { | 196 for (size_t i = 0; i < data_reduction_proxy::kNumDaysInHistory; ++i) { |
| 190 env_->GetLongArrayRegion(result.obj(), i, 1, &value); | 197 env_->GetLongArrayRegion(result.obj(), i, 1, &value); |
| 191 ASSERT_EQ( | 198 ASSERT_EQ( |
| 192 static_cast<long>( | 199 static_cast<long>( |
| 193 (data_reduction_proxy::kNumDaysInHistory - 1 - i) * 2), value); | 200 (data_reduction_proxy::kNumDaysInHistory - 1 - i) * 2), value); |
| 194 } | 201 } |
| 195 } | 202 } |
| 196 | 203 |
| OLD | NEW |