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

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

Issue 2626963003: Remove kAllowed and kFallbackAllowed from data reduction proxy (Closed)
Patch Set: Addressed nits Created 3 years, 11 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 allowed,
66 bool fallback_allowed,
67 bool promo_allowed, 65 bool promo_allowed,
68 bool holdback) { 66 bool holdback) {
69 int flags = 0; 67 int flags = 0;
70 if (allowed)
71 flags |= DataReductionProxyParams::kAllowed;
72 if (fallback_allowed)
73 flags |= DataReductionProxyParams::kFallbackAllowed;
74 if (promo_allowed) 68 if (promo_allowed)
75 flags |= DataReductionProxyParams::kPromoAllowed; 69 flags |= DataReductionProxyParams::kPromoAllowed;
76 if (holdback) 70 if (holdback)
77 flags |= DataReductionProxyParams::kHoldback; 71 flags |= DataReductionProxyParams::kHoldback;
78 MockDataReductionProxySettings<C>* settings = 72 MockDataReductionProxySettings<C>* settings =
79 new MockDataReductionProxySettings<C>(); 73 new MockDataReductionProxySettings<C>();
80 settings->config_ = test_context_->config(); 74 settings->config_ = test_context_->config();
81 test_context_->config()->ResetParamFlagsForTest(flags); 75 test_context_->config()->ResetParamFlagsForTest(flags);
82 settings->UpdateConfigValues(); 76 settings->UpdateConfigValues();
83 EXPECT_CALL(*settings, GetOriginalProfilePrefs()) 77 EXPECT_CALL(*settings, GetOriginalProfilePrefs())
84 .Times(AnyNumber()) 78 .Times(AnyNumber())
85 .WillRepeatedly(Return(test_context_->pref_service())); 79 .WillRepeatedly(Return(test_context_->pref_service()));
86 EXPECT_CALL(*settings, GetLocalStatePrefs()) 80 EXPECT_CALL(*settings, GetLocalStatePrefs())
87 .Times(AnyNumber()) 81 .Times(AnyNumber())
88 .WillRepeatedly(Return(test_context_->pref_service())); 82 .WillRepeatedly(Return(test_context_->pref_service()));
89 settings_.reset(settings); 83 settings_.reset(settings);
90 settings_->data_reduction_proxy_service_ = 84 settings_->data_reduction_proxy_service_ =
91 test_context_->CreateDataReductionProxyService(settings_.get()); 85 test_context_->CreateDataReductionProxyService(settings_.get());
92 } 86 }
93 87
94 template void 88 template void
95 data_reduction_proxy::DataReductionProxySettingsTestBase::ResetSettings< 89 data_reduction_proxy::DataReductionProxySettingsTestBase::ResetSettings<
96 DataReductionProxyChromeSettings>(std::unique_ptr<base::Clock> clock, 90 DataReductionProxyChromeSettings>(std::unique_ptr<base::Clock> clock,
97 bool allowed,
98 bool fallback_allowed,
99 bool promo_allowed, 91 bool promo_allowed,
100 bool holdback); 92 bool holdback);
101 93
102 class DataReductionProxySettingsAndroidTest 94 class DataReductionProxySettingsAndroidTest
103 : public data_reduction_proxy::ConcreteDataReductionProxySettingsTest< 95 : public data_reduction_proxy::ConcreteDataReductionProxySettingsTest<
104 DataReductionProxyChromeSettings> { 96 DataReductionProxyChromeSettings> {
105 public: 97 public:
106 // DataReductionProxySettingsTest implementation: 98 // DataReductionProxySettingsTest implementation:
107 void SetUp() override { 99 void SetUp() override {
108 env_ = base::android::AttachCurrentThread(); 100 env_ = base::android::AttachCurrentThread();
(...skipping 30 matching lines...) Expand all
139 java_array_len); 131 java_array_len);
140 132
141 jlong value; 133 jlong value;
142 for (size_t i = 0; i < data_reduction_proxy::kNumDaysInHistory; ++i) { 134 for (size_t i = 0; i < data_reduction_proxy::kNumDaysInHistory; ++i) {
143 env_->GetLongArrayRegion(result.obj(), i, 1, &value); 135 env_->GetLongArrayRegion(result.obj(), i, 1, &value);
144 ASSERT_EQ( 136 ASSERT_EQ(
145 static_cast<long>( 137 static_cast<long>(
146 (data_reduction_proxy::kNumDaysInHistory - 1 - i) * 2), value); 138 (data_reduction_proxy::kNumDaysInHistory - 1 - i) * 2), value);
147 } 139 }
148 } 140 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698