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

Unified Diff: chrome/browser/prefs/pref_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: " 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/prefs/pref_service_unittest.cc
diff --git a/chrome/browser/prefs/pref_service_unittest.cc b/chrome/browser/prefs/pref_service_unittest.cc
index 8ada07a47ffb62d04698ed9364c139382248aff0..186e8742e3bdacb004ee1fb2034ab8a603d24235 100644
--- a/chrome/browser/prefs/pref_service_unittest.cc
+++ b/chrome/browser/prefs/pref_service_unittest.cc
@@ -8,6 +8,7 @@
#include "base/command_line.h"
#include "base/scoped_ptr.h"
#include "base/values.h"
+#include "chrome/browser/net/pref_proxy_config_service.h"
#include "chrome/browser/policy/configuration_policy_pref_store.h"
#include "chrome/browser/policy/mock_configuration_policy_provider.h"
#include "chrome/browser/prefs/browser_prefs.h"
@@ -170,8 +171,8 @@ TEST(PrefServiceTest, ProxyPolicyOverridesCommandLineOptions) {
builder.WithCommandLine(&command_line);
scoped_ptr<PrefService> prefs(builder.Create());
browser::RegisterUserPrefs(prefs.get());
- EXPECT_FALSE(prefs->GetBoolean(prefs::kProxyAutoDetect));
- EXPECT_FALSE(prefs->GetBoolean(prefs::kNoProxyServer));
+ EXPECT_EQ(PrefProxyConfigService::MANUAL,
+ prefs->GetInteger(prefs::kProxyServerMode));
EXPECT_EQ("789", prefs->GetString(prefs::kProxyServer));
EXPECT_EQ("456", prefs->GetString(prefs::kProxyPacUrl));
EXPECT_EQ("123", prefs->GetString(prefs::kProxyBypassList));
@@ -183,8 +184,8 @@ TEST(PrefServiceTest, ProxyPolicyOverridesCommandLineOptions) {
builder.WithManagedPlatformProvider(provider.get());
scoped_ptr<PrefService> prefs2(builder.Create());
browser::RegisterUserPrefs(prefs2.get());
- EXPECT_FALSE(prefs2->GetBoolean(prefs::kProxyAutoDetect));
- EXPECT_FALSE(prefs2->GetBoolean(prefs::kNoProxyServer));
+ EXPECT_EQ(PrefProxyConfigService::MANUAL,
+ prefs2->GetInteger(prefs::kProxyServerMode));
EXPECT_EQ("ghi", prefs2->GetString(prefs::kProxyServer));
EXPECT_EQ("def", prefs2->GetString(prefs::kProxyPacUrl));
EXPECT_EQ("abc", prefs2->GetString(prefs::kProxyBypassList));
@@ -207,8 +208,8 @@ TEST(PrefServiceTest, ProxyPolicyOverridesUnrelatedCommandLineOptions) {
builder.WithCommandLine(&command_line);
scoped_ptr<PrefService> prefs(builder.Create());
browser::RegisterUserPrefs(prefs.get());
- EXPECT_FALSE(prefs->GetBoolean(prefs::kProxyAutoDetect));
- EXPECT_FALSE(prefs->GetBoolean(prefs::kNoProxyServer));
+ EXPECT_EQ(PrefProxyConfigService::MANUAL,
+ prefs->GetInteger(prefs::kProxyServerMode));
EXPECT_EQ("789", prefs->GetString(prefs::kProxyServer));
EXPECT_EQ("456", prefs->GetString(prefs::kProxyPacUrl));
EXPECT_EQ("123", prefs->GetString(prefs::kProxyBypassList));
@@ -221,8 +222,8 @@ TEST(PrefServiceTest, ProxyPolicyOverridesUnrelatedCommandLineOptions) {
builder.WithManagedPlatformProvider(provider.get());
scoped_ptr<PrefService> prefs2(builder.Create());
browser::RegisterUserPrefs(prefs2.get());
- EXPECT_FALSE(prefs2->GetBoolean(prefs::kProxyAutoDetect));
- EXPECT_FALSE(prefs2->GetBoolean(prefs::kNoProxyServer));
+ EXPECT_EQ(PrefProxyConfigService::SYSTEM,
+ prefs2->GetInteger(prefs::kProxyServerMode));
EXPECT_EQ(std::string(), prefs2->GetString(prefs::kProxyServer));
EXPECT_EQ(std::string(), prefs2->GetString(prefs::kProxyPacUrl));
EXPECT_EQ(std::string(), prefs2->GetString(prefs::kProxyBypassList));
@@ -243,8 +244,8 @@ TEST(PrefServiceTest, ProxyPolicyOverridesCommandLineNoProxy) {
builder.WithCommandLine(&command_line);
scoped_ptr<PrefService> prefs(builder.Create());
browser::RegisterUserPrefs(prefs.get());
- EXPECT_FALSE(prefs->GetBoolean(prefs::kProxyAutoDetect));
- EXPECT_TRUE(prefs->GetBoolean(prefs::kNoProxyServer));
+ EXPECT_EQ(PrefProxyConfigService::DISABLED,
+ prefs->GetInteger(prefs::kProxyServerMode));
EXPECT_EQ(std::string(), prefs->GetString(prefs::kProxyServer));
EXPECT_EQ(std::string(), prefs->GetString(prefs::kProxyPacUrl));
EXPECT_EQ(std::string(), prefs->GetString(prefs::kProxyBypassList));
@@ -256,8 +257,8 @@ TEST(PrefServiceTest, ProxyPolicyOverridesCommandLineNoProxy) {
builder.WithManagedPlatformProvider(provider.get());
scoped_ptr<PrefService> prefs2(builder.Create());
browser::RegisterUserPrefs(prefs2.get());
- EXPECT_TRUE(prefs2->GetBoolean(prefs::kProxyAutoDetect));
- EXPECT_FALSE(prefs2->GetBoolean(prefs::kNoProxyServer));
+ EXPECT_EQ(PrefProxyConfigService::AUTO_DETECT,
+ prefs2->GetInteger(prefs::kProxyServerMode));
EXPECT_EQ(std::string(), prefs2->GetString(prefs::kProxyServer));
EXPECT_EQ(std::string(), prefs2->GetString(prefs::kProxyPacUrl));
EXPECT_EQ(std::string(), prefs2->GetString(prefs::kProxyBypassList));
@@ -278,8 +279,8 @@ TEST(PrefServiceTest, ProxyPolicyOverridesCommandLineAutoDetect) {
builder.WithCommandLine(&command_line);
scoped_ptr<PrefService> prefs(builder.Create());
browser::RegisterUserPrefs(prefs.get());
- EXPECT_TRUE(prefs->GetBoolean(prefs::kProxyAutoDetect));
- EXPECT_FALSE(prefs->GetBoolean(prefs::kNoProxyServer));
+ EXPECT_EQ(PrefProxyConfigService::AUTO_DETECT,
+ prefs->GetInteger(prefs::kProxyServerMode));
EXPECT_EQ(std::string(), prefs->GetString(prefs::kProxyServer));
EXPECT_EQ(std::string(), prefs->GetString(prefs::kProxyPacUrl));
EXPECT_EQ(std::string(), prefs->GetString(prefs::kProxyBypassList));
@@ -291,8 +292,8 @@ TEST(PrefServiceTest, ProxyPolicyOverridesCommandLineAutoDetect) {
builder.WithManagedPlatformProvider(provider.get());
scoped_ptr<PrefService> prefs2(builder.Create());
browser::RegisterUserPrefs(prefs2.get());
- EXPECT_FALSE(prefs2->GetBoolean(prefs::kProxyAutoDetect));
- EXPECT_TRUE(prefs2->GetBoolean(prefs::kNoProxyServer));
+ EXPECT_EQ(PrefProxyConfigService::DISABLED,
+ prefs2->GetInteger(prefs::kProxyServerMode));
EXPECT_EQ(std::string(), prefs2->GetString(prefs::kProxyServer));
EXPECT_EQ(std::string(), prefs2->GetString(prefs::kProxyPacUrl));
EXPECT_EQ(std::string(), prefs2->GetString(prefs::kProxyBypassList));

Powered by Google App Engine
This is Rietveld 408576698