Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1204)

Side by Side Diff: net/proxy/proxy_resolver_v8_tracing_wrapper_unittest.cc

Issue 2610473002: Use TaskScheduler instead of WorkerPool in v8_platform.cc. (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_wrapper.h" 5 #include "net/proxy/proxy_resolver_v8_tracing_wrapper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.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/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "base/synchronization/waitable_event.h" 18 #include "base/synchronization/waitable_event.h"
19 #include "base/test/scoped_async_task_scheduler.h"
19 #include "base/threading/platform_thread.h" 20 #include "base/threading/platform_thread.h"
20 #include "base/values.h" 21 #include "base/values.h"
21 #include "net/base/net_errors.h" 22 #include "net/base/net_errors.h"
22 #include "net/base/test_completion_callback.h" 23 #include "net/base/test_completion_callback.h"
23 #include "net/dns/host_cache.h" 24 #include "net/dns/host_cache.h"
24 #include "net/dns/mock_host_resolver.h" 25 #include "net/dns/mock_host_resolver.h"
25 #include "net/log/net_log_event_type.h" 26 #include "net/log/net_log_event_type.h"
26 #include "net/log/net_log_with_source.h" 27 #include "net/log/net_log_with_source.h"
27 #include "net/log/test_net_log.h" 28 #include "net/log/test_net_log.h"
28 #include "net/log/test_net_log_entry.h" 29 #include "net/log/test_net_log_entry.h"
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 EXPECT_EQ(0u, log.GetSize()); 1063 EXPECT_EQ(0u, log.GetSize());
1063 EXPECT_EQ(0u, request_log.GetSize()); 1064 EXPECT_EQ(0u, request_log.GetSize());
1064 } 1065 }
1065 1066
1066 // Tests that multiple instances of ProxyResolverV8TracingWrapper can coexist 1067 // Tests that multiple instances of ProxyResolverV8TracingWrapper can coexist
1067 // and run correctly at the same time. This is relevant because at the moment 1068 // and run correctly at the same time. This is relevant because at the moment
1068 // (time this test was written) each ProxyResolverV8TracingWrapper creates its 1069 // (time this test was written) each ProxyResolverV8TracingWrapper creates its
1069 // own thread to run V8 on, however each thread is operating on the same 1070 // own thread to run V8 on, however each thread is operating on the same
1070 // v8::Isolate. 1071 // v8::Isolate.
1071 TEST_F(ProxyResolverV8TracingWrapperTest, MultipleResolvers) { 1072 TEST_F(ProxyResolverV8TracingWrapperTest, MultipleResolvers) {
1073 // Required by gin::V8Platform::CallOnBackgroundThread(). Can't be a
1074 // ScopedTaskScheduler because v8 synchronously waits for tasks to run.
1075 base::test::ScopedAsyncTaskScheduler scoped_async_task_scheduler;
1076
1072 // ------------------------ 1077 // ------------------------
1073 // Setup resolver0 1078 // Setup resolver0
1074 // ------------------------ 1079 // ------------------------
1075 MockHostResolver host_resolver0; 1080 MockHostResolver host_resolver0;
1076 host_resolver0.rules()->AddRuleForAddressFamily("host1", ADDRESS_FAMILY_IPV4, 1081 host_resolver0.rules()->AddRuleForAddressFamily("host1", ADDRESS_FAMILY_IPV4,
1077 "166.155.144.44"); 1082 "166.155.144.44");
1078 host_resolver0.rules()->AddIPLiteralRule("host1", "::1,192.168.1.1", 1083 host_resolver0.rules()->AddIPLiteralRule("host1", "::1,192.168.1.1",
1079 std::string()); 1084 std::string());
1080 host_resolver0.rules()->AddSimulatedFailure("host2"); 1085 host_resolver0.rules()->AddSimulatedFailure("host2");
1081 host_resolver0.rules()->AddRule("host3", "166.155.144.33"); 1086 host_resolver0.rules()->AddRule("host3", "166.155.144.33");
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 proxy_uri.substr(0, proxy_uri.find(':') + 1)); 1174 proxy_uri.substr(0, proxy_uri.find(':') + 1));
1170 } else { 1175 } else {
1171 NOTREACHED(); 1176 NOTREACHED();
1172 } 1177 }
1173 } 1178 }
1174 } 1179 }
1175 1180
1176 } // namespace 1181 } // namespace
1177 1182
1178 } // namespace net 1183 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_resolver_v8_tracing_unittest.cc ('k') | net/proxy/proxy_resolver_v8_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698