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

Unified Diff: chrome/browser/prefs/proxy_prefs_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/prefs/proxy_prefs_unittest.cc
diff --git a/chrome/browser/prefs/proxy_prefs_unittest.cc b/chrome/browser/prefs/proxy_prefs_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ff3baf85d21d9d10a1221e8af839c0142532ec2b
--- /dev/null
+++ b/chrome/browser/prefs/proxy_prefs_unittest.cc
@@ -0,0 +1,52 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <string>
+
+#include "base/logging.h"
+#include "base/values.h"
+#include "base/version.h"
+#include "chrome/browser/prefs/proxy_prefs.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+class ProxyPrefsTest : public testing::Test {
+};
+
+TEST_F(ProxyPrefsTest, IntValuesFixed) {
Mattias Nissler (ping if slow) 2010/12/20 13:34:03 Hm. Isn't this overkill?
battre (please use the other) 2010/12/21 14:18:18 Made these assertions for the last tests.
+ EXPECT_EQ(ProxyPrefs::DISABLED, 0);
+ EXPECT_EQ(ProxyPrefs::AUTO_DETECT, 1);
+ EXPECT_EQ(ProxyPrefs::MANUAL, 2);
+ EXPECT_EQ(ProxyPrefs::SYSTEM, 3);
+ // Update the following as necessary, don't change the previous ones.
+ EXPECT_EQ(ProxyPrefs::NUM_MODES, 4);
+}
+
+TEST_F(ProxyPrefsTest, StringToProxyMode) {
+ ProxyPrefs::ProxyServerMode mode;
+ EXPECT_TRUE(ProxyPrefs::StringToProxyMode("disabled", &mode));
+ EXPECT_EQ(ProxyPrefs::DISABLED, mode);
+ EXPECT_TRUE(ProxyPrefs::StringToProxyMode("system", &mode));
+ EXPECT_EQ(ProxyPrefs::SYSTEM, mode);
+ EXPECT_TRUE(ProxyPrefs::StringToProxyMode("auto_detect", &mode));
+ EXPECT_EQ(ProxyPrefs::AUTO_DETECT, mode);
+ EXPECT_TRUE(ProxyPrefs::StringToProxyMode("manual", &mode));
+ EXPECT_EQ(ProxyPrefs::MANUAL, mode);
+
+ EXPECT_FALSE(ProxyPrefs::StringToProxyMode("monkey", &mode));
+}
+
+TEST_F(ProxyPrefsTest, IntToProxyMode) {
+ ProxyPrefs::ProxyServerMode mode;
+ EXPECT_TRUE(ProxyPrefs::IntToProxyMode(0, &mode));
+ EXPECT_EQ(ProxyPrefs::DISABLED, mode);
+ EXPECT_TRUE(ProxyPrefs::IntToProxyMode(3, &mode));
+ EXPECT_EQ(ProxyPrefs::SYSTEM, mode);
+ EXPECT_TRUE(ProxyPrefs::IntToProxyMode(1, &mode));
+ EXPECT_EQ(ProxyPrefs::AUTO_DETECT, mode);
+ EXPECT_TRUE(ProxyPrefs::IntToProxyMode(2, &mode));
+ EXPECT_EQ(ProxyPrefs::MANUAL, mode);
+
+ EXPECT_FALSE(ProxyPrefs::IntToProxyMode(-1, &mode));
+ EXPECT_FALSE(ProxyPrefs::IntToProxyMode(ProxyPrefs::NUM_MODES, &mode));
+}

Powered by Google App Engine
This is Rietveld 408576698