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

Unified Diff: net/proxy/proxy_config_service_linux_unittest.cc

Issue 2968573002: Check the return value of base::StringToInt() in (Closed)
Patch Set: Created 3 years, 6 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
Index: net/proxy/proxy_config_service_linux_unittest.cc
diff --git a/net/proxy/proxy_config_service_linux_unittest.cc b/net/proxy/proxy_config_service_linux_unittest.cc
index 6650825a04f6946f107703fe0bb6d3b788e32210..b143ca794ed4ceba2eab1e7479f4d77d0ae42de0 100644
--- a/net/proxy/proxy_config_service_linux_unittest.cc
+++ b/net/proxy/proxy_config_service_linux_unittest.cc
@@ -29,6 +29,8 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
+// TODO(eroman): Convert these to parameterized tests using TEST_P().
+
namespace net {
namespace {
@@ -1157,6 +1159,19 @@ TEST_F(ProxyConfigServiceLinuxTest, KDEConfigParser) {
GURL(), // pac_url
ProxyRulesExpectation::Empty(),
},
+ {
+ TEST_DESC("No proxying (negative value)"),
mmenke 2017/06/29 22:21:20 Maybe a test in each group where the ProxyType is
eroman 2017/06/29 22:33:58 Done.
+
+ // Input.
+ "[Proxy Settings]\nProxyType=-3\n",
+ {}, // env_values
+
+ // Expected result.
+ ProxyConfigService::CONFIG_VALID,
+ false, // auto_detect
+ GURL(), // pac_url
+ ProxyRulesExpectation::Empty(),
+ },
{
TEST_DESC("Auto detect"),
@@ -1313,7 +1328,7 @@ TEST_F(ProxyConfigServiceLinuxTest, KDEConfigParser) {
},
{
- TEST_DESC("Correctly parse bypass list with ReversedException"),
+ TEST_DESC("Correctly parse bypass list with ReversedException=true"),
// Input.
"[Proxy Settings]\nProxyType=1\nhttpProxy=www.google.com\n"
@@ -1331,6 +1346,62 @@ TEST_F(ProxyConfigServiceLinuxTest, KDEConfigParser) {
"*.google.com"), // bypass rules
},
+ {
+ TEST_DESC("Correctly parse bypass list with ReversedException=1"),
+
+ // Input.
+ "[Proxy Settings]\nProxyType=1\nhttpProxy=www.google.com\n"
+ "NoProxyFor=.google.com\nReversedException=1\n",
+ {}, // env_values
+
+ // Expected result.
+ ProxyConfigService::CONFIG_VALID,
+ false, // auto_detect
+ GURL(), // pac_url
+ ProxyRulesExpectation::PerSchemeWithBypassReversed(
+ "www.google.com:80", // http
+ "", // https
+ "", // ftp
+ "*.google.com"), // bypass rules
+ },
+
+ {
+ TEST_DESC("Correctly parse bypass list with ReversedException=false"),
eroman 2017/06/29 21:11:18 This is weird -- it tries parsing "false" as a num
+
+ // Input.
+ "[Proxy Settings]\nProxyType=1\nhttpProxy=www.google.com\n"
+ "NoProxyFor=.google.com\nReversedException=false\n",
+ {}, // env_values
+
+ // Expected result.
+ ProxyConfigService::CONFIG_VALID,
+ false, // auto_detect
+ GURL(), // pac_url
+ ProxyRulesExpectation::PerScheme("www.google.com:80", // http
+ "", // https
+ "", // ftp
+ "*.google.com"), // bypass rules
+ },
+
+ {
+ TEST_DESC("Correctly parse bypass list with "
+ "ReversedException=18446744073709551617"),
eroman 2017/06/29 21:11:18 Previously this would be interpreted as true (beca
+
+ // Input.
+ "[Proxy Settings]\nProxyType=1\nhttpProxy=www.google.com\n"
+ "NoProxyFor=.google.com\nReversedException=18446744073709551617\n",
+ {}, // env_values
+
+ // Expected result.
+ ProxyConfigService::CONFIG_VALID,
+ false, // auto_detect
+ GURL(), // pac_url
+ ProxyRulesExpectation::PerScheme("www.google.com:80", // http
+ "", // https
+ "", // ftp
+ "*.google.com"), // bypass rules
+ },
+
{
TEST_DESC("socks"),
« net/proxy/proxy_config_service_linux.cc ('K') | « net/proxy/proxy_config_service_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698