This source file includes following definitions.
- TEST
#include "net/proxy/proxy_config_service_win.h"
#include "net/base/net_errors.h"
#include "net/proxy/proxy_config.h"
#include "net/proxy/proxy_config_service_common_unittest.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace net {
TEST(ProxyConfigServiceWinTest, SetFromIEConfig) {
const struct {
WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ie_config;
bool auto_detect;
GURL pac_url;
ProxyRulesExpectation proxy_rules;
const char* proxy_bypass_list;
} tests[] = {
{
{
TRUE,
NULL,
NULL,
NULL,
},
true,
GURL(),
ProxyRulesExpectation::Empty(),
},
{
{
FALSE,
L"http://wpad/wpad.dat",
NULL,
NULL,
},
false,
GURL("http://wpad/wpad.dat"),
ProxyRulesExpectation::Empty(),
},
{
{
FALSE,
L"wpad.dat",
NULL,
NULL,
},
false,
GURL(),
ProxyRulesExpectation::Empty(),
},
{
{
FALSE,
NULL,
L"www.google.com",
NULL,
},
false,
GURL(),
ProxyRulesExpectation::Single(
"www.google.com:80",
""),
},
{
{
FALSE,
NULL,
L"http=www.google.com:80;https=www.foo.com:110",
NULL,
},
false,
GURL(),
ProxyRulesExpectation::PerScheme(
"www.google.com:80",
"www.foo.com:110",
"",
""),
},
{
{
FALSE,
NULL,
L"http=www.google.com:80;https=www.foo.com:110;"
L"ftp=ftpproxy:20;socks=foopy:130",
NULL,
},
false,
GURL(),
ProxyRulesExpectation::PerSchemeWithSocks(
"www.google.com:80",
"www.foo.com:110",
"ftpproxy:20",
"socks4://foopy:130",
""),
},
{
{
TRUE,
NULL,
NULL,
L"<local>",
},
true,
GURL(),
ProxyRulesExpectation::EmptyWithBypass("<local>"),
},
{
{
TRUE,
NULL,
NULL,
L"<local> ; google.com",
},
true,
GURL(),
ProxyRulesExpectation::EmptyWithBypass("<local>,google.com"),
},
{
{
TRUE,
NULL,
NULL,
L"foo.com\r\ngoogle.com",
},
true,
GURL(),
ProxyRulesExpectation::EmptyWithBypass("foo.com,google.com"),
},
{
{
TRUE,
NULL,
NULL,
L"foo.com, google.com",
},
true,
GURL(),
ProxyRulesExpectation::EmptyWithBypass("foo.com,google.com"),
},
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
ProxyConfig config;
ProxyConfigServiceWin::SetFromIEConfig(&config, tests[i].ie_config);
EXPECT_EQ(tests[i].auto_detect, config.auto_detect());
EXPECT_EQ(tests[i].pac_url, config.pac_url());
EXPECT_TRUE(tests[i].proxy_rules.Matches(config.proxy_rules()));
EXPECT_EQ(PROXY_CONFIG_SOURCE_SYSTEM, config.source());
}
}
}