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

Unified Diff: net/proxy/proxy_service_unittest.cc

Issue 6597070: Allow ProxyConfigService to report "no configuration set" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Eric's comments. Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/proxy/proxy_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_service_unittest.cc
diff --git a/net/proxy/proxy_service_unittest.cc b/net/proxy/proxy_service_unittest.cc
index 95f8bbcf48f79be496fc558c69c5c1044387f8a7..7326c6724d7b5cabb98a734b0c26d3a35b7c516b 100644
--- a/net/proxy/proxy_service_unittest.cc
+++ b/net/proxy/proxy_service_unittest.cc
@@ -11,9 +11,9 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "googleurl/src/gurl.h"
+#include "net/base/net_errors.h"
#include "net/base/net_log.h"
#include "net/base/net_log_unittest.h"
-#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
#include "net/proxy/mock_proxy_resolver.h"
#include "net/proxy/proxy_config_service.h"
@@ -29,11 +29,12 @@ namespace {
class MockProxyConfigService: public ProxyConfigService {
public:
explicit MockProxyConfigService(const ProxyConfig& config)
- : has_config_(true), config_(config) {
+ : availability_(CONFIG_VALID),
+ config_(config) {
}
explicit MockProxyConfigService(const std::string& pac_url)
- : has_config_(true),
+ : availability_(CONFIG_VALID),
config_(ProxyConfig::CreateFromCustomPacURL(GURL(pac_url))) {
}
@@ -45,22 +46,21 @@ class MockProxyConfigService: public ProxyConfigService {
observers_.RemoveObserver(observer);
}
- virtual bool GetLatestProxyConfig(ProxyConfig* results) {
- if (has_config_) {
+ virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* results) {
+ if (availability_ == CONFIG_VALID)
*results = config_;
- return true;
- }
- return false;
+ return availability_;
}
void SetConfig(const ProxyConfig& config) {
- has_config_ = true;
+ availability_ = CONFIG_VALID;
config_ = config;
- FOR_EACH_OBSERVER(Observer, observers_, OnProxyConfigChanged(config));
+ FOR_EACH_OBSERVER(Observer, observers_,
+ OnProxyConfigChanged(config_, availability_));
}
private:
- bool has_config_;
+ ConfigAvailability availability_;
ProxyConfig config_;
ObserverList<Observer, true> observers_;
};
« no previous file with comments | « net/proxy/proxy_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698