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

Side by Side Diff: components/data_reduction_proxy/browser/data_reduction_proxy_config_service_unittest.cc

Issue 286013002: Added alternative configuration for the data reduction proxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK fix Created 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/data_reduction_proxy/browser/data_reduction_proxy_config_se rvice.h" 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_config_se rvice.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 DataReductionProxyConfigTracker tracker(config_service_.get(), 200 DataReductionProxyConfigTracker tracker(config_service_.get(),
201 task_runner_.get()); 201 task_runner_.get());
202 net::ProxyConfig expected_config; 202 net::ProxyConfig expected_config;
203 expected_config.proxy_rules().ParseFromString(kDataReductionProxyRules); 203 expected_config.proxy_rules().ParseFromString(kDataReductionProxyRules);
204 EXPECT_CALL(observer, OnProxyConfigChanged( 204 EXPECT_CALL(observer, OnProxyConfigChanged(
205 ProxyConfigMatches(expected_config), 205 ProxyConfigMatches(expected_config),
206 net::ProxyConfigService::CONFIG_VALID)).Times(1); 206 net::ProxyConfigService::CONFIG_VALID)).Times(1);
207 tracker.Enable(false, 207 tracker.Enable(false,
208 false, 208 false,
209 "https://foo.com:443", 209 "https://foo.com:443",
210 "http://bar.com:80"); 210 "http://bar.com:80",
211 "");
211 task_runner_->RunUntilIdle(); 212 task_runner_->RunUntilIdle();
212 Mock::VerifyAndClearExpectations(&observer); 213 Mock::VerifyAndClearExpectations(&observer);
213 214
214 config_service_->RemoveObserver(&observer); 215 config_service_->RemoveObserver(&observer);
215 } 216 }
216 217
217 TEST_F(DataReductionProxyConfigServiceTest, TrackerEnableRestricted) { 218 TEST_F(DataReductionProxyConfigServiceTest, TrackerEnableRestricted) {
218 MockObserver observer; 219 MockObserver observer;
219 //base::MessageLoopForUI loop; 220 //base::MessageLoopForUI loop;
220 config_service_->AddObserver(&observer); 221 config_service_->AddObserver(&observer);
221 scoped_refptr<base::TestSimpleTaskRunner> task_runner_( 222 scoped_refptr<base::TestSimpleTaskRunner> task_runner_(
222 new base::TestSimpleTaskRunner()); 223 new base::TestSimpleTaskRunner());
223 DataReductionProxyConfigTracker tracker(config_service_.get(), 224 DataReductionProxyConfigTracker tracker(config_service_.get(),
224 task_runner_.get()); 225 task_runner_.get());
225 net::ProxyConfig expected_config; 226 net::ProxyConfig expected_config;
226 expected_config.proxy_rules().ParseFromString( 227 expected_config.proxy_rules().ParseFromString(
227 kDataReductionProxyRestrictedRules); 228 kDataReductionProxyRestrictedRules);
228 EXPECT_CALL(observer, OnProxyConfigChanged( 229 EXPECT_CALL(observer, OnProxyConfigChanged(
229 ProxyConfigMatches(expected_config), 230 ProxyConfigMatches(expected_config),
230 net::ProxyConfigService::CONFIG_VALID)).Times(1); 231 net::ProxyConfigService::CONFIG_VALID)).Times(1);
231 tracker.Enable(true, 232 tracker.Enable(true,
232 false, 233 false,
233 "https://foo.com:443", 234 "https://foo.com:443",
234 "http://bar.com:80"); 235 "http://bar.com:80",
236 "");
235 task_runner_->RunUntilIdle(); 237 task_runner_->RunUntilIdle();
236 Mock::VerifyAndClearExpectations(&observer); 238 Mock::VerifyAndClearExpectations(&observer);
237 239
238 config_service_->RemoveObserver(&observer); 240 config_service_->RemoveObserver(&observer);
239 } 241 }
240 242
241 TEST_F(DataReductionProxyConfigServiceTest, TrackerDisable) { 243 TEST_F(DataReductionProxyConfigServiceTest, TrackerDisable) {
242 MockObserver observer; 244 MockObserver observer;
243 //base::MessageLoopForUI loop; 245 //base::MessageLoopForUI loop;
244 config_service_->AddObserver(&observer); 246 config_service_->AddObserver(&observer);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 286
285 ASSERT_EQ(tracker.bypass_rules_.size(), 6u); 287 ASSERT_EQ(tracker.bypass_rules_.size(), 6u);
286 int i = 0; 288 int i = 0;
287 for (std::vector<std::string>::iterator it = tracker.bypass_rules_.begin(); 289 for (std::vector<std::string>::iterator it = tracker.bypass_rules_.begin();
288 it != tracker.bypass_rules_.end(); ++it) { 290 it != tracker.bypass_rules_.end(); ++it) {
289 EXPECT_EQ(expected[i++], *it); 291 EXPECT_EQ(expected[i++], *it);
290 } 292 }
291 } 293 }
292 294
293 } // namespace data_reduction_proxy 295 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698