| Index: chrome/browser/prefs/command_line_pref_store_unittest.cc
|
| diff --git a/chrome/browser/prefs/command_line_pref_store_unittest.cc b/chrome/browser/prefs/command_line_pref_store_unittest.cc
|
| index 2518ff9595377056f2e101e64f7fc0aadb6f3ba1..d9d49ad75745992b3521cfef4f9ed1408197820b 100644
|
| --- a/chrome/browser/prefs/command_line_pref_store_unittest.cc
|
| +++ b/chrome/browser/prefs/command_line_pref_store_unittest.cc
|
| @@ -26,10 +26,14 @@ class TestCommandLinePrefStore : public CommandLinePrefStore {
|
| return ValidateProxySwitches();
|
| }
|
|
|
| - void VerifyIntPref(const std::string& path, int expected_value) {
|
| - Value* actual = NULL;
|
| - ASSERT_EQ(PrefStore::READ_OK, GetValue(path, &actual));
|
| - EXPECT_TRUE(FundamentalValue(expected_value).Equals(actual));
|
| + void VerifyProxyMode(ProxyPrefs::ProxyMode expected_mode) {
|
| + Value* value = NULL;
|
| + ASSERT_EQ(PrefStore::READ_OK, GetValue(prefs::kProxy, &value));
|
| + ASSERT_EQ(Value::TYPE_DICTIONARY, value->GetType());
|
| + ProxyPrefsDictionary dict((DictionaryValue*)value);
|
| + ProxyPrefs::ProxyMode actual_mode;
|
| + ASSERT_TRUE(dict.GetMode(&actual_mode));
|
| + EXPECT_EQ(expected_mode, actual_mode);
|
| }
|
| };
|
|
|
| @@ -59,7 +63,7 @@ TEST(CommandLinePrefStoreTest, SimpleBooleanPref) {
|
| scoped_refptr<TestCommandLinePrefStore> store =
|
| new TestCommandLinePrefStore(&cl);
|
|
|
| - store->VerifyIntPref(prefs::kProxyMode, ProxyPrefs::MODE_DIRECT);
|
| + store->VerifyProxyMode(ProxyPrefs::MODE_DIRECT);
|
| }
|
|
|
| // Tests a command line with no recognized prefs.
|
| @@ -78,7 +82,6 @@ TEST(CommandLinePrefStoreTest, NoPrefs) {
|
| TEST(CommandLinePrefStoreTest, MultipleSwitches) {
|
| CommandLine cl(CommandLine::NO_PROGRAM);
|
| cl.AppendSwitch(unknown_string);
|
| - cl.AppendSwitch(switches::kProxyAutoDetect);
|
| cl.AppendSwitchASCII(switches::kProxyServer, "proxy");
|
| cl.AppendSwitchASCII(switches::kProxyBypassList, "list");
|
| cl.AppendSwitchASCII(unknown_bool, "a value");
|
| @@ -87,16 +90,21 @@ TEST(CommandLinePrefStoreTest, MultipleSwitches) {
|
|
|
| Value* actual = NULL;
|
| EXPECT_EQ(PrefStore::READ_NO_VALUE, store->GetValue(unknown_bool, &actual));
|
| - store->VerifyIntPref(prefs::kProxyMode, ProxyPrefs::MODE_AUTO_DETECT);
|
| -
|
| EXPECT_EQ(PrefStore::READ_NO_VALUE, store->GetValue(unknown_string, &actual));
|
| +
|
| + store->VerifyProxyMode(ProxyPrefs::MODE_FIXED_SERVERS);
|
| +
|
| + Value* value = NULL;
|
| + ASSERT_EQ(PrefStore::READ_OK, store->GetValue(prefs::kProxy, &value));
|
| + ASSERT_EQ(Value::TYPE_DICTIONARY, value->GetType());
|
| + ProxyPrefsDictionary dict((DictionaryValue*)value);
|
| +
|
| std::string string_result = "";
|
| - ASSERT_EQ(PrefStore::READ_OK, store->GetValue(prefs::kProxyServer, &actual));
|
| - EXPECT_TRUE(actual->GetAsString(&string_result));
|
| +
|
| + ASSERT_TRUE(dict.GetProxyServer(&string_result));
|
| EXPECT_EQ("proxy", string_result);
|
| - ASSERT_EQ(PrefStore::READ_OK,
|
| - store->GetValue(prefs::kProxyBypassList, &actual));
|
| - EXPECT_TRUE(actual->GetAsString(&string_result));
|
| +
|
| + ASSERT_TRUE(dict.GetBypassList(&string_result));
|
| EXPECT_EQ("list", string_result);
|
| }
|
|
|
| @@ -138,11 +146,11 @@ TEST(CommandLinePrefStoreTest, ManualProxyModeInference) {
|
| cl1.AppendSwitchASCII(switches::kProxyServer, "proxy");
|
| scoped_refptr<TestCommandLinePrefStore> store1 =
|
| new TestCommandLinePrefStore(&cl1);
|
| - store1->VerifyIntPref(prefs::kProxyMode, ProxyPrefs::MODE_FIXED_SERVERS);
|
| + store1->VerifyProxyMode(ProxyPrefs::MODE_FIXED_SERVERS);
|
|
|
| CommandLine cl2(CommandLine::NO_PROGRAM);
|
| cl2.AppendSwitchASCII(switches::kProxyPacUrl, "proxy");
|
| scoped_refptr<TestCommandLinePrefStore> store2 =
|
| new TestCommandLinePrefStore(&cl2);
|
| - store2->VerifyIntPref(prefs::kProxyMode, ProxyPrefs::MODE_PAC_SCRIPT);
|
| + store2->VerifyProxyMode(ProxyPrefs::MODE_PAC_SCRIPT);
|
| }
|
|
|