Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: chrome/browser/net/spdyproxy/data_reduction_proxy_settings_unittest_android.cc

Issue 2922663002: Data Reduction Proxy: Remove duplicate functions (Closed)
Patch Set: ps Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 // Returns the provided setting object. Used by wrapping methods. 55 // Returns the provided setting object. Used by wrapping methods.
56 DataReductionProxySettings* Settings() override { return settings_; } 56 DataReductionProxySettings* Settings() override { return settings_; }
57 57
58 // The wrapped settings object. 58 // The wrapped settings object.
59 DataReductionProxySettings* settings_; 59 DataReductionProxySettings* settings_;
60 }; 60 };
61 61
62 template <class C> 62 template <class C>
63 void data_reduction_proxy::DataReductionProxySettingsTestBase::ResetSettings( 63 void data_reduction_proxy::DataReductionProxySettingsTestBase::ResetSettings(
64 std::unique_ptr<base::Clock> clock, 64 std::unique_ptr<base::Clock> clock) {
65 bool promo_allowed,
66 bool holdback) {
67 int flags = 0;
68 if (promo_allowed)
69 flags |= DataReductionProxyParams::kPromoAllowed;
70 if (holdback)
71 flags |= DataReductionProxyParams::kHoldback;
72 MockDataReductionProxySettings<C>* settings = 65 MockDataReductionProxySettings<C>* settings =
73 new MockDataReductionProxySettings<C>(); 66 new MockDataReductionProxySettings<C>();
74 settings->config_ = test_context_->config(); 67 settings->config_ = test_context_->config();
75 test_context_->config()->ResetParamFlagsForTest(flags); 68 test_context_->config()->ResetParamFlagsForTest();
76 settings->UpdateConfigValues(); 69 settings->UpdateConfigValues();
77 EXPECT_CALL(*settings, GetOriginalProfilePrefs()) 70 EXPECT_CALL(*settings, GetOriginalProfilePrefs())
78 .Times(AnyNumber()) 71 .Times(AnyNumber())
79 .WillRepeatedly(Return(test_context_->pref_service())); 72 .WillRepeatedly(Return(test_context_->pref_service()));
80 EXPECT_CALL(*settings, GetLocalStatePrefs()) 73 EXPECT_CALL(*settings, GetLocalStatePrefs())
81 .Times(AnyNumber()) 74 .Times(AnyNumber())
82 .WillRepeatedly(Return(test_context_->pref_service())); 75 .WillRepeatedly(Return(test_context_->pref_service()));
83 settings_.reset(settings); 76 settings_.reset(settings);
84 settings_->data_reduction_proxy_service_ = 77 settings_->data_reduction_proxy_service_ =
85 test_context_->CreateDataReductionProxyService(settings_.get()); 78 test_context_->CreateDataReductionProxyService(settings_.get());
86 } 79 }
87 80
88 template void 81 template void
89 data_reduction_proxy::DataReductionProxySettingsTestBase::ResetSettings< 82 data_reduction_proxy::DataReductionProxySettingsTestBase::ResetSettings<
90 DataReductionProxyChromeSettings>(std::unique_ptr<base::Clock> clock, 83 DataReductionProxyChromeSettings>(std::unique_ptr<base::Clock> clock);
91 bool promo_allowed,
92 bool holdback);
93 84
94 class DataReductionProxySettingsAndroidTest 85 class DataReductionProxySettingsAndroidTest
95 : public data_reduction_proxy::ConcreteDataReductionProxySettingsTest< 86 : public data_reduction_proxy::ConcreteDataReductionProxySettingsTest<
96 DataReductionProxyChromeSettings> { 87 DataReductionProxyChromeSettings> {
97 public: 88 public:
98 // DataReductionProxySettingsTest implementation: 89 // DataReductionProxySettingsTest implementation:
99 void SetUp() override { 90 void SetUp() override {
100 env_ = base::android::AttachCurrentThread(); 91 env_ = base::android::AttachCurrentThread();
101 DataReductionProxySettingsAndroid::Register(env_); 92 DataReductionProxySettingsAndroid::Register(env_);
102 DataReductionProxySettingsTestBase::SetUp(); 93 DataReductionProxySettingsTestBase::SetUp();
(...skipping 28 matching lines...) Expand all
131 java_array_len); 122 java_array_len);
132 123
133 jlong value; 124 jlong value;
134 for (size_t i = 0; i < data_reduction_proxy::kNumDaysInHistory; ++i) { 125 for (size_t i = 0; i < data_reduction_proxy::kNumDaysInHistory; ++i) {
135 env_->GetLongArrayRegion(result.obj(), i, 1, &value); 126 env_->GetLongArrayRegion(result.obj(), i, 1, &value);
136 ASSERT_EQ( 127 ASSERT_EQ(
137 static_cast<long>( 128 static_cast<long>(
138 (data_reduction_proxy::kNumDaysInHistory - 1 - i) * 2), value); 129 (data_reduction_proxy::kNumDaysInHistory - 1 - i) * 2), value);
139 } 130 }
140 } 131 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698