OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 const ProxyConfig& config, | 27 const ProxyConfig& config, |
28 ProxyConfigService::ConfigAvailability availability) OVERRIDE { | 28 ProxyConfigService::ConfigAvailability availability) OVERRIDE { |
29 config_ = config; | 29 config_ = config; |
30 availability_ = availability; | 30 availability_ = availability; |
31 } | 31 } |
32 | 32 |
33 ProxyConfigService::ConfigAvailability availability() const { | 33 ProxyConfigService::ConfigAvailability availability() const { |
34 return availability_; | 34 return availability_; |
35 } | 35 } |
36 | 36 |
37 const ProxyConfig& config() const { | 37 const ProxyConfig& config() const { return config_; } |
38 return config_; | |
39 } | |
40 | 38 |
41 private: | 39 private: |
42 ProxyConfig config_; | 40 ProxyConfig config_; |
43 ProxyConfigService::ConfigAvailability availability_; | 41 ProxyConfigService::ConfigAvailability availability_; |
44 }; | 42 }; |
45 | 43 |
46 } // namespace | 44 } // namespace |
47 | 45 |
48 typedef std::map<std::string, std::string> StringMap; | 46 typedef std::map<std::string, std::string> StringMap; |
49 | 47 |
(...skipping 10 matching lines...) Expand all Loading... |
60 base::Unretained(this))) {} | 58 base::Unretained(this))) {} |
61 | 59 |
62 virtual ~ProxyConfigServiceAndroidTestBase() {} | 60 virtual ~ProxyConfigServiceAndroidTestBase() {} |
63 | 61 |
64 // testing::Test: | 62 // testing::Test: |
65 virtual void SetUp() OVERRIDE { | 63 virtual void SetUp() OVERRIDE { |
66 message_loop_->RunUntilIdle(); | 64 message_loop_->RunUntilIdle(); |
67 service_.AddObserver(&observer_); | 65 service_.AddObserver(&observer_); |
68 } | 66 } |
69 | 67 |
70 virtual void TearDown() OVERRIDE { | 68 virtual void TearDown() OVERRIDE { service_.RemoveObserver(&observer_); } |
71 service_.RemoveObserver(&observer_); | |
72 } | |
73 | 69 |
74 void ClearConfiguration() { | 70 void ClearConfiguration() { configuration_.clear(); } |
75 configuration_.clear(); | |
76 } | |
77 | 71 |
78 void AddProperty(const std::string& key, const std::string& value) { | 72 void AddProperty(const std::string& key, const std::string& value) { |
79 configuration_[key] = value; | 73 configuration_[key] = value; |
80 } | 74 } |
81 | 75 |
82 std::string GetProperty(const std::string& key) { | 76 std::string GetProperty(const std::string& key) { |
83 StringMap::const_iterator it = configuration_.find(key); | 77 StringMap::const_iterator it = configuration_.find(key); |
84 if (it == configuration_.end()) | 78 if (it == configuration_.end()) |
85 return std::string(); | 79 return std::string(); |
86 return it->second; | 80 return it->second; |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 TEST_F(ProxyConfigServiceAndroidTest, HttpProxySupercedesSocks) { | 337 TEST_F(ProxyConfigServiceAndroidTest, HttpProxySupercedesSocks) { |
344 // SOCKS proxy is ignored if default HTTP proxy defined. | 338 // SOCKS proxy is ignored if default HTTP proxy defined. |
345 AddProperty("proxyHost", "defaultproxy.com"); | 339 AddProperty("proxyHost", "defaultproxy.com"); |
346 AddProperty("socksProxyHost", "socksproxy.com"); | 340 AddProperty("socksProxyHost", "socksproxy.com"); |
347 AddProperty("socksProxyPort", "9000"); | 341 AddProperty("socksProxyPort", "9000"); |
348 ProxySettingsChanged(); | 342 ProxySettingsChanged(); |
349 TestMapping("http://example.com/", "PROXY defaultproxy.com:80"); | 343 TestMapping("http://example.com/", "PROXY defaultproxy.com:80"); |
350 } | 344 } |
351 | 345 |
352 } // namespace net | 346 } // namespace net |
OLD | NEW |