| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "net/proxy/proxy_resolver_v8_tracing.h" | 5 #include "net/proxy/proxy_resolver_v8_tracing.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 // the correct set of queries. | 275 // the correct set of queries. |
| 276 TEST_F(ProxyResolverV8TracingTest, Dns) { | 276 TEST_F(ProxyResolverV8TracingTest, Dns) { |
| 277 CapturingNetLog log; | 277 CapturingNetLog log; |
| 278 CapturingBoundNetLog request_log; | 278 CapturingBoundNetLog request_log; |
| 279 MockCachingHostResolver host_resolver; | 279 MockCachingHostResolver host_resolver; |
| 280 MockErrorObserver* error_observer = new MockErrorObserver; | 280 MockErrorObserver* error_observer = new MockErrorObserver; |
| 281 ProxyResolverV8Tracing resolver(&host_resolver, error_observer, &log); | 281 ProxyResolverV8Tracing resolver(&host_resolver, error_observer, &log); |
| 282 | 282 |
| 283 host_resolver.rules()->AddRuleForAddressFamily( | 283 host_resolver.rules()->AddRuleForAddressFamily( |
| 284 "host1", ADDRESS_FAMILY_IPV4, "166.155.144.44"); | 284 "host1", ADDRESS_FAMILY_IPV4, "166.155.144.44"); |
| 285 host_resolver.rules()->AddIPLiteralRule("host1", "::1,192.168.1.1", ""); | 285 host_resolver.rules() |
| 286 ->AddIPLiteralRule("host1", "::1,192.168.1.1", std::string()); |
| 286 host_resolver.rules()->AddSimulatedFailure("host2"); | 287 host_resolver.rules()->AddSimulatedFailure("host2"); |
| 287 host_resolver.rules()->AddRule("host3", "166.155.144.33"); | 288 host_resolver.rules()->AddRule("host3", "166.155.144.33"); |
| 288 host_resolver.rules()->AddRule("host5", "166.155.144.55"); | 289 host_resolver.rules()->AddRule("host5", "166.155.144.55"); |
| 289 host_resolver.rules()->AddSimulatedFailure("host6"); | 290 host_resolver.rules()->AddSimulatedFailure("host6"); |
| 290 host_resolver.rules()->AddRuleForAddressFamily( | 291 host_resolver.rules()->AddRuleForAddressFamily( |
| 291 "*", ADDRESS_FAMILY_IPV4, "122.133.144.155"); | 292 "*", ADDRESS_FAMILY_IPV4, "122.133.144.155"); |
| 292 host_resolver.rules()->AddRule("*", "133.122.100.200"); | 293 host_resolver.rules()->AddRule("*", "133.122.100.200"); |
| 293 | 294 |
| 294 InitResolver(&resolver, "dns.js"); | 295 InitResolver(&resolver, "dns.js"); |
| 295 | 296 |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 // correctly at the same time. This is relevant because at the moment (time | 989 // correctly at the same time. This is relevant because at the moment (time |
| 989 // this test was written) each ProxyResolverV8Tracing creates its own thread to | 990 // this test was written) each ProxyResolverV8Tracing creates its own thread to |
| 990 // run V8 on, however each thread is operating on the same v8::Isolate. | 991 // run V8 on, however each thread is operating on the same v8::Isolate. |
| 991 TEST_F(ProxyResolverV8TracingTest, MultipleResolvers) { | 992 TEST_F(ProxyResolverV8TracingTest, MultipleResolvers) { |
| 992 // ------------------------ | 993 // ------------------------ |
| 993 // Setup resolver0 | 994 // Setup resolver0 |
| 994 // ------------------------ | 995 // ------------------------ |
| 995 MockHostResolver host_resolver0; | 996 MockHostResolver host_resolver0; |
| 996 host_resolver0.rules()->AddRuleForAddressFamily( | 997 host_resolver0.rules()->AddRuleForAddressFamily( |
| 997 "host1", ADDRESS_FAMILY_IPV4, "166.155.144.44"); | 998 "host1", ADDRESS_FAMILY_IPV4, "166.155.144.44"); |
| 998 host_resolver0.rules()->AddIPLiteralRule("host1", "::1,192.168.1.1", ""); | 999 host_resolver0.rules() |
| 1000 ->AddIPLiteralRule("host1", "::1,192.168.1.1", std::string()); |
| 999 host_resolver0.rules()->AddSimulatedFailure("host2"); | 1001 host_resolver0.rules()->AddSimulatedFailure("host2"); |
| 1000 host_resolver0.rules()->AddRule("host3", "166.155.144.33"); | 1002 host_resolver0.rules()->AddRule("host3", "166.155.144.33"); |
| 1001 host_resolver0.rules()->AddRule("host5", "166.155.144.55"); | 1003 host_resolver0.rules()->AddRule("host5", "166.155.144.55"); |
| 1002 host_resolver0.rules()->AddSimulatedFailure("host6"); | 1004 host_resolver0.rules()->AddSimulatedFailure("host6"); |
| 1003 host_resolver0.rules()->AddRuleForAddressFamily( | 1005 host_resolver0.rules()->AddRuleForAddressFamily( |
| 1004 "*", ADDRESS_FAMILY_IPV4, "122.133.144.155"); | 1006 "*", ADDRESS_FAMILY_IPV4, "122.133.144.155"); |
| 1005 host_resolver0.rules()->AddRule("*", "133.122.100.200"); | 1007 host_resolver0.rules()->AddRule("*", "133.122.100.200"); |
| 1006 ProxyResolverV8Tracing resolver0( | 1008 ProxyResolverV8Tracing resolver0( |
| 1007 &host_resolver0, new MockErrorObserver, NULL); | 1009 &host_resolver0, new MockErrorObserver, NULL); |
| 1008 InitResolver(&resolver0, "dns.js"); | 1010 InitResolver(&resolver0, "dns.js"); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 proxy_uri.substr(0, proxy_uri.find(':') + 1)); | 1089 proxy_uri.substr(0, proxy_uri.find(':') + 1)); |
| 1088 } else { | 1090 } else { |
| 1089 NOTREACHED(); | 1091 NOTREACHED(); |
| 1090 } | 1092 } |
| 1091 } | 1093 } |
| 1092 } | 1094 } |
| 1093 | 1095 |
| 1094 } // namespace | 1096 } // namespace |
| 1095 | 1097 |
| 1096 } // namespace net | 1098 } // namespace net |
| OLD | NEW |