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

Unified Diff: chrome/browser/net/pref_proxy_config_service_unittest.cc

Issue 5701003: Intorduce a separate preference for 'proxy server mode' (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix indentation nit Created 10 years 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
Index: chrome/browser/net/pref_proxy_config_service_unittest.cc
diff --git a/chrome/browser/net/pref_proxy_config_service_unittest.cc b/chrome/browser/net/pref_proxy_config_service_unittest.cc
index cc602ec490ed606225b4b8aec5f92e91a1f2ac2a..ba9e21a1114e5ab1461c105fb2ad79a0830172bf 100644
--- a/chrome/browser/net/pref_proxy_config_service_unittest.cc
+++ b/chrome/browser/net/pref_proxy_config_service_unittest.cc
@@ -8,6 +8,7 @@
#include "base/file_path.h"
#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/browser/prefs/pref_service_mock_builder.h"
+#include "chrome/browser/prefs/proxy_prefs.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/testing_pref_service.h"
@@ -114,6 +115,9 @@ TEST_F(PrefProxyConfigServiceTest, BaseConfiguration) {
TEST_F(PrefProxyConfigServiceTest, DynamicPrefOverrides) {
pref_service_->SetManagedPref(
prefs::kProxyServer, Value::CreateStringValue("http://example.com:3128"));
+ pref_service_->SetManagedPref(
+ prefs::kProxyServerMode,
+ Value::CreateIntegerValue(ProxyPrefs::MANUAL));
loop_.RunAllPending();
net::ProxyConfig actual_config;
@@ -126,7 +130,8 @@ TEST_F(PrefProxyConfigServiceTest, DynamicPrefOverrides) {
net::ProxyServer::SCHEME_HTTP));
pref_service_->SetManagedPref(
- prefs::kProxyAutoDetect, Value::CreateBooleanValue(true));
+ prefs::kProxyServerMode,
+ Value::CreateIntegerValue(ProxyPrefs::AUTO_DETECT));
loop_.RunAllPending();
proxy_config_service_->GetLatestProxyConfig(&actual_config);
@@ -156,10 +161,20 @@ TEST_F(PrefProxyConfigServiceTest, Observers) {
// Override configuration, this should trigger a notification.
net::ProxyConfig pref_config;
pref_config.set_pac_url(GURL(kFixedPacUrl));
+
EXPECT_CALL(observer,
OnProxyConfigChanged(ProxyConfigMatches(pref_config))).Times(1);
+
pref_service_->SetManagedPref(prefs::kProxyPacUrl,
Value::CreateStringValue(kFixedPacUrl));
+ // The above does not trigger a notification, because PreProxyConfig still
Mattias Nissler (ping if slow) 2010/12/20 13:34:03 s/PreProxyConfig/PrefProxyConfig/
battre (please use the other) 2010/12/21 14:18:18 Done.
+ // sees the mode as the dafault (ProxyPrefs::SYSTEM), so that it doesn't claim
+ // to have proxy config.
+ // TODO(battre): Remove this comment when http://crbug.com/65732 is
+ // completed.
Mattias Nissler (ping if slow) 2010/12/20 13:34:03 s/completed/resolved/? Also below. I'm not really
battre (please use the other) 2010/12/21 14:18:18 Done.
+ pref_service_->SetManagedPref(
+ prefs::kProxyServerMode,
+ Value::CreateIntegerValue(ProxyPrefs::MANUAL));
Mattias Nissler (ping if slow) 2010/12/20 13:34:03 Don't the parameters fit line after the opening pa
battre (please use the other) 2010/12/21 14:18:18 No, but formated nicely, now.
loop_.RunAllPending();
Mock::VerifyAndClearExpectations(&observer);
@@ -175,6 +190,11 @@ TEST_F(PrefProxyConfigServiceTest, Observers) {
// Clear the override should switch back to the fixed configuration.
EXPECT_CALL(observer,
OnProxyConfigChanged(ProxyConfigMatches(config3))).Times(1);
+ pref_service_->RemoveManagedPref(prefs::kProxyServerMode);
+ // The above swithces the mode the default (ProxyPrefs::SYSTEM), so the next
Mattias Nissler (ping if slow) 2010/12/20 13:34:03 s/swithces/switches/ s/mode the default/mode to th
battre (please use the other) 2010/12/21 14:18:18 Done.
+ // removal won't bother PrefProxyConfigService.
+ // TODO(battre): Remove this comment when http://crbug.com/65732 is
+ // completed.
pref_service_->RemoveManagedPref(prefs::kProxyPacUrl);
loop_.RunAllPending();
Mock::VerifyAndClearExpectations(&observer);

Powered by Google App Engine
This is Rietveld 408576698