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 <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "base/synchronization/waitable_event.h" | 15 #include "base/synchronization/waitable_event.h" |
16 #include "base/test/scoped_async_task_scheduler.h" | |
17 #include "base/threading/platform_thread.h" | 16 #include "base/threading/platform_thread.h" |
18 #include "base/threading/thread_checker.h" | 17 #include "base/threading/thread_checker.h" |
19 #include "base/values.h" | 18 #include "base/values.h" |
20 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
21 #include "net/base/test_completion_callback.h" | 20 #include "net/base/test_completion_callback.h" |
22 #include "net/dns/host_cache.h" | 21 #include "net/dns/host_cache.h" |
23 #include "net/dns/mock_host_resolver.h" | 22 #include "net/dns/mock_host_resolver.h" |
24 #include "net/log/net_log_with_source.h" | 23 #include "net/log/net_log_with_source.h" |
25 #include "net/proxy/proxy_info.h" | 24 #include "net/proxy/proxy_info.h" |
26 #include "net/test/event_waiter.h" | 25 #include "net/test/event_waiter.h" |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 // No errors or alerts. | 942 // No errors or alerts. |
944 EXPECT_TRUE(mock_bindings.GetErrors().empty()); | 943 EXPECT_TRUE(mock_bindings.GetErrors().empty()); |
945 EXPECT_TRUE(mock_bindings.GetAlerts().empty()); | 944 EXPECT_TRUE(mock_bindings.GetAlerts().empty()); |
946 } | 945 } |
947 | 946 |
948 // Tests that multiple instances of ProxyResolverV8Tracing can coexist and run | 947 // Tests that multiple instances of ProxyResolverV8Tracing can coexist and run |
949 // correctly at the same time. This is relevant because at the moment (time | 948 // correctly at the same time. This is relevant because at the moment (time |
950 // this test was written) each ProxyResolverV8Tracing creates its own thread to | 949 // this test was written) each ProxyResolverV8Tracing creates its own thread to |
951 // run V8 on, however each thread is operating on the same v8::Isolate. | 950 // run V8 on, however each thread is operating on the same v8::Isolate. |
952 TEST_F(ProxyResolverV8TracingTest, MultipleResolvers) { | 951 TEST_F(ProxyResolverV8TracingTest, MultipleResolvers) { |
953 // Required by gin::V8Platform::CallOnBackgroundThread(). Can't be a | |
954 // ScopedTaskScheduler because v8 synchronously waits for tasks to run. | |
955 base::test::ScopedAsyncTaskScheduler scoped_async_task_scheduler; | |
956 | |
957 // ------------------------ | 952 // ------------------------ |
958 // Setup resolver0 | 953 // Setup resolver0 |
959 // ------------------------ | 954 // ------------------------ |
960 MockHostResolver host_resolver0; | 955 MockHostResolver host_resolver0; |
961 MockBindings mock_bindings0(&host_resolver0); | 956 MockBindings mock_bindings0(&host_resolver0); |
962 host_resolver0.rules()->AddRuleForAddressFamily( | 957 host_resolver0.rules()->AddRuleForAddressFamily( |
963 "host1", ADDRESS_FAMILY_IPV4, "166.155.144.44"); | 958 "host1", ADDRESS_FAMILY_IPV4, "166.155.144.44"); |
964 host_resolver0.rules() | 959 host_resolver0.rules() |
965 ->AddIPLiteralRule("host1", "::1,192.168.1.1", std::string()); | 960 ->AddIPLiteralRule("host1", "::1,192.168.1.1", std::string()); |
966 host_resolver0.rules()->AddSimulatedFailure("host2"); | 961 host_resolver0.rules()->AddSimulatedFailure("host2"); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 proxy_uri.substr(0, proxy_uri.find(':') + 1)); | 1047 proxy_uri.substr(0, proxy_uri.find(':') + 1)); |
1053 } else { | 1048 } else { |
1054 NOTREACHED(); | 1049 NOTREACHED(); |
1055 } | 1050 } |
1056 } | 1051 } |
1057 } | 1052 } |
1058 | 1053 |
1059 } // namespace | 1054 } // namespace |
1060 | 1055 |
1061 } // namespace net | 1056 } // namespace net |
OLD | NEW |