summaryrefslogtreecommitdiffstats
path: root/net/proxy/proxy_resolver_v8_unittest.cc
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-03 21:30:46 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-03 21:30:46 +0000
commiteba291345caec278ef7b8f2a8c73b8b6c60f7364 (patch)
tree368f0fd8b38f05fe1d1d447d390823bf4bc0b7b6 /net/proxy/proxy_resolver_v8_unittest.cc
parent2455e073eb458b2ab5a7edbb337781152868b8c0 (diff)
downloadchromium_src-eba291345caec278ef7b8f2a8c73b8b6c60f7364.zip
chromium_src-eba291345caec278ef7b8f2a8c73b8b6c60f7364.tar.gz
chromium_src-eba291345caec278ef7b8f2a8c73b8b6c60f7364.tar.bz2
Implement the PAC js-binding for "myIpAddress()".
BUG=2764 Review URL: http://codereview.chromium.org/38001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10824 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_resolver_v8_unittest.cc')
-rw-r--r--net/proxy/proxy_resolver_v8_unittest.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/net/proxy/proxy_resolver_v8_unittest.cc b/net/proxy/proxy_resolver_v8_unittest.cc
index c2ddb9f..5cbdfd4 100644
--- a/net/proxy/proxy_resolver_v8_unittest.cc
+++ b/net/proxy/proxy_resolver_v8_unittest.cc
@@ -380,12 +380,14 @@ TEST(ProxyResolverV8DefaultBindingsTest, DnsResolve) {
net::ProxyResolverV8 resolver;
net::ProxyResolverV8::JSBindings* bindings = resolver.js_bindings();
+ // Considered an error.
+ EXPECT_EQ("", bindings->DnsResolve(""));
+
const struct {
const char* input;
const char* expected;
} tests[] = {
{"www.google.com", "127.0.0.1"},
- {"", ""},
{".", ""},
{"foo@google.com", ""},
{"@google.com", ""},
@@ -424,3 +426,14 @@ TEST(ProxyResolverV8DefaultBindingsTest, DnsResolve) {
}
}
+TEST(ProxyResolverV8DefaultBindingsTest, MyIpAddress) {
+ // Get a hold of a DefaultJSBindings* (it is a hidden impl class).
+ net::ProxyResolverV8 resolver;
+ net::ProxyResolverV8::JSBindings* bindings = resolver.js_bindings();
+
+ // Our ip address is always going to be 127.0.0.1, since we are using a
+ // mock host mapper when running in unit-test mode.
+ std::string my_ip_address = bindings->MyIpAddress();
+
+ EXPECT_EQ("127.0.0.1", my_ip_address);
+}