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

Side by Side Diff: net/proxy/proxy_resolver_v8_tracing_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.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"
16 #include "base/threading/platform_thread.h" 17 #include "base/threading/platform_thread.h"
17 #include "base/threading/thread_checker.h" 18 #include "base/threading/thread_checker.h"
18 #include "base/values.h" 19 #include "base/values.h"
19 #include "net/base/net_errors.h" 20 #include "net/base/net_errors.h"
20 #include "net/base/test_completion_callback.h" 21 #include "net/base/test_completion_callback.h"
21 #include "net/dns/host_cache.h" 22 #include "net/dns/host_cache.h"
22 #include "net/dns/mock_host_resolver.h" 23 #include "net/dns/mock_host_resolver.h"
23 #include "net/log/net_log_with_source.h" 24 #include "net/log/net_log_with_source.h"
24 #include "net/proxy/proxy_info.h" 25 #include "net/proxy/proxy_info.h"
25 #include "net/test/event_waiter.h" 26 #include "net/test/event_waiter.h"
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 // No errors or alerts. 943 // No errors or alerts.
943 EXPECT_TRUE(mock_bindings.GetErrors().empty()); 944 EXPECT_TRUE(mock_bindings.GetErrors().empty());
944 EXPECT_TRUE(mock_bindings.GetAlerts().empty()); 945 EXPECT_TRUE(mock_bindings.GetAlerts().empty());
945 } 946 }
946 947
947 // Tests that multiple instances of ProxyResolverV8Tracing can coexist and run 948 // Tests that multiple instances of ProxyResolverV8Tracing can coexist and run
948 // correctly at the same time. This is relevant because at the moment (time 949 // correctly at the same time. This is relevant because at the moment (time
949 // this test was written) each ProxyResolverV8Tracing creates its own thread to 950 // this test was written) each ProxyResolverV8Tracing creates its own thread to
950 // run V8 on, however each thread is operating on the same v8::Isolate. 951 // run V8 on, however each thread is operating on the same v8::Isolate.
951 TEST_F(ProxyResolverV8TracingTest, MultipleResolvers) { 952 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
952 // ------------------------ 957 // ------------------------
953 // Setup resolver0 958 // Setup resolver0
954 // ------------------------ 959 // ------------------------
955 MockHostResolver host_resolver0; 960 MockHostResolver host_resolver0;
956 MockBindings mock_bindings0(&host_resolver0); 961 MockBindings mock_bindings0(&host_resolver0);
957 host_resolver0.rules()->AddRuleForAddressFamily( 962 host_resolver0.rules()->AddRuleForAddressFamily(
958 "host1", ADDRESS_FAMILY_IPV4, "166.155.144.44"); 963 "host1", ADDRESS_FAMILY_IPV4, "166.155.144.44");
959 host_resolver0.rules() 964 host_resolver0.rules()
960 ->AddIPLiteralRule("host1", "::1,192.168.1.1", std::string()); 965 ->AddIPLiteralRule("host1", "::1,192.168.1.1", std::string());
961 host_resolver0.rules()->AddSimulatedFailure("host2"); 966 host_resolver0.rules()->AddSimulatedFailure("host2");
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 proxy_uri.substr(0, proxy_uri.find(':') + 1)); 1052 proxy_uri.substr(0, proxy_uri.find(':') + 1));
1048 } else { 1053 } else {
1049 NOTREACHED(); 1054 NOTREACHED();
1050 } 1055 }
1051 } 1056 }
1052 } 1057 }
1053 1058
1054 } // namespace 1059 } // namespace
1055 1060
1056 } // namespace net 1061 } // namespace net
OLDNEW
« no previous file with comments | « mojo/edk/js/tests/js_to_cpp_tests.cc ('k') | net/proxy/proxy_resolver_v8_tracing_wrapper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698