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

Side by Side Diff: net/http/http_network_transaction_unittest.cc

Issue 118100: Avoid doing concurrent DNS resolves of the same hostname (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Get compiling on mac Created 11 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <math.h> // ceil 5 #include <math.h> // ceil
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "net/base/client_socket_factory.h" 8 #include "net/base/client_socket_factory.h"
9 #include "net/base/completion_callback.h" 9 #include "net/base/completion_callback.h"
10 #include "net/base/host_resolver_unittest.h" 10 #include "net/base/host_resolver_unittest.h"
(...skipping 23 matching lines...) Expand all
34 // HttpNetworkTransaction. 34 // HttpNetworkTransaction.
35 class SessionDependencies { 35 class SessionDependencies {
36 public: 36 public:
37 // Default set of dependencies -- "null" proxy service. 37 // Default set of dependencies -- "null" proxy service.
38 SessionDependencies() : proxy_service(CreateNullProxyService()) {} 38 SessionDependencies() : proxy_service(CreateNullProxyService()) {}
39 39
40 // Custom proxy service dependency. 40 // Custom proxy service dependency.
41 explicit SessionDependencies(ProxyService* proxy_service) 41 explicit SessionDependencies(ProxyService* proxy_service)
42 : proxy_service(proxy_service) {} 42 : proxy_service(proxy_service) {}
43 43
44 HostResolver host_resolver;
44 scoped_ptr<ProxyService> proxy_service; 45 scoped_ptr<ProxyService> proxy_service;
45 MockClientSocketFactory socket_factory; 46 MockClientSocketFactory socket_factory;
46 }; 47 };
47 48
48 ProxyService* CreateFixedProxyService(const std::string& proxy) { 49 ProxyService* CreateFixedProxyService(const std::string& proxy) {
49 net::ProxyConfig proxy_config; 50 net::ProxyConfig proxy_config;
50 proxy_config.proxy_rules.ParseFromString(proxy); 51 proxy_config.proxy_rules.ParseFromString(proxy);
51 return ProxyService::CreateFixed(proxy_config); 52 return ProxyService::CreateFixed(proxy_config);
52 } 53 }
53 54
54 55
55 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { 56 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) {
56 return new HttpNetworkSession(session_deps->proxy_service.get(), 57 return new HttpNetworkSession(&session_deps->host_resolver,
58 session_deps->proxy_service.get(),
57 &session_deps->socket_factory); 59 &session_deps->socket_factory);
58 } 60 }
59 61
60 class HttpNetworkTransactionTest : public PlatformTest { 62 class HttpNetworkTransactionTest : public PlatformTest {
61 public: 63 public:
62 virtual void TearDown() { 64 virtual void TearDown() {
63 // Empty the current queue. 65 // Empty the current queue.
64 MessageLoop::current()->RunAllPending(); 66 MessageLoop::current()->RunAllPending();
65 PlatformTest::TearDown(); 67 PlatformTest::TearDown();
66 } 68 }
(...skipping 3047 matching lines...) Expand 10 before | Expand all | Expand 10 after
3114 TestCompletionCallback callback; 3116 TestCompletionCallback callback;
3115 3117
3116 int rv = trans->Start(&request, &callback); 3118 int rv = trans->Start(&request, &callback);
3117 EXPECT_EQ(ERR_IO_PENDING, rv); 3119 EXPECT_EQ(ERR_IO_PENDING, rv);
3118 3120
3119 rv = callback.WaitForResult(); 3121 rv = callback.WaitForResult();
3120 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, rv); 3122 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, rv);
3121 } 3123 }
3122 3124
3123 } // namespace net 3125 } // namespace net
OLDNEW
« net/base/address_list.h ('K') | « net/http/http_network_transaction.cc ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698