OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // Doesn't really matter what these values are for many of the tests. | 138 // Doesn't really matter what these values are for many of the tests. |
139 const GURL kQueryUrl("http://www.google.com"); | 139 const GURL kQueryUrl("http://www.google.com"); |
140 const GURL kPacUrl; | 140 const GURL kPacUrl; |
141 | 141 |
142 TEST(ProxyResolverV8Test, Direct) { | 142 TEST(ProxyResolverV8Test, Direct) { |
143 ProxyResolverV8WithMockBindings resolver; | 143 ProxyResolverV8WithMockBindings resolver; |
144 int result = resolver.SetPacScriptFromDisk("direct.js"); | 144 int result = resolver.SetPacScriptFromDisk("direct.js"); |
145 EXPECT_EQ(OK, result); | 145 EXPECT_EQ(OK, result); |
146 | 146 |
147 ProxyInfo proxy_info; | 147 ProxyInfo proxy_info; |
148 CapturingBoundNetLog log; | 148 BoundTestNetLog log; |
149 result = resolver.GetProxyForURL( | 149 result = resolver.GetProxyForURL( |
150 kQueryUrl, &proxy_info, CompletionCallback(), NULL, log.bound()); | 150 kQueryUrl, &proxy_info, CompletionCallback(), NULL, log.bound()); |
151 | 151 |
152 EXPECT_EQ(OK, result); | 152 EXPECT_EQ(OK, result); |
153 EXPECT_TRUE(proxy_info.is_direct()); | 153 EXPECT_TRUE(proxy_info.is_direct()); |
154 | 154 |
155 EXPECT_EQ(0U, resolver.mock_js_bindings()->alerts.size()); | 155 EXPECT_EQ(0U, resolver.mock_js_bindings()->alerts.size()); |
156 EXPECT_EQ(0U, resolver.mock_js_bindings()->errors.size()); | 156 EXPECT_EQ(0U, resolver.mock_js_bindings()->errors.size()); |
157 | 157 |
158 net::CapturingNetLog::CapturedEntryList entries; | 158 net::TestNetLog::CapturedEntryList entries; |
159 log.GetEntries(&entries); | 159 log.GetEntries(&entries); |
160 // No bindings were called, so no log entries. | 160 // No bindings were called, so no log entries. |
161 EXPECT_EQ(0u, entries.size()); | 161 EXPECT_EQ(0u, entries.size()); |
162 } | 162 } |
163 | 163 |
164 TEST(ProxyResolverV8Test, ReturnEmptyString) { | 164 TEST(ProxyResolverV8Test, ReturnEmptyString) { |
165 ProxyResolverV8WithMockBindings resolver; | 165 ProxyResolverV8WithMockBindings resolver; |
166 int result = resolver.SetPacScriptFromDisk("return_empty_string.js"); | 166 int result = resolver.SetPacScriptFromDisk("return_empty_string.js"); |
167 EXPECT_EQ(OK, result); | 167 EXPECT_EQ(OK, result); |
168 | 168 |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 GURL("http://kittens/"), &proxy_info, | 662 GURL("http://kittens/"), &proxy_info, |
663 CompletionCallback(), NULL, BoundNetLog()); | 663 CompletionCallback(), NULL, BoundNetLog()); |
664 | 664 |
665 EXPECT_EQ(OK, result); | 665 EXPECT_EQ(OK, result); |
666 EXPECT_EQ(0u, bindings->errors.size()); | 666 EXPECT_EQ(0u, bindings->errors.size()); |
667 EXPECT_EQ("kittens:88", proxy_info.proxy_server().ToURI()); | 667 EXPECT_EQ("kittens:88", proxy_info.proxy_server().ToURI()); |
668 } | 668 } |
669 | 669 |
670 } // namespace | 670 } // namespace |
671 } // namespace net | 671 } // namespace net |
OLD | NEW |