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

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

Issue 348066: Flip: FlipSessionPool changes. (Closed)
Patch Set: Windows build fix. Created 11 years, 1 month 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/completion_callback.h" 8 #include "net/base/completion_callback.h"
9 #include "net/base/mock_host_resolver.h" 9 #include "net/base/mock_host_resolver.h"
10 #include "net/base/ssl_config_service_defaults.h" 10 #include "net/base/ssl_config_service_defaults.h"
11 #include "net/base/ssl_info.h" 11 #include "net/base/ssl_info.h"
12 #include "net/base/test_completion_callback.h" 12 #include "net/base/test_completion_callback.h"
13 #include "net/base/upload_data.h" 13 #include "net/base/upload_data.h"
14 #include "net/flip/flip_session_pool.h"
14 #include "net/http/http_auth_handler_ntlm.h" 15 #include "net/http/http_auth_handler_ntlm.h"
15 #include "net/http/http_basic_stream.h" 16 #include "net/http/http_basic_stream.h"
16 #include "net/http/http_network_session.h" 17 #include "net/http/http_network_session.h"
17 #include "net/http/http_network_transaction.h" 18 #include "net/http/http_network_transaction.h"
18 #include "net/http/http_stream.h" 19 #include "net/http/http_stream.h"
19 #include "net/http/http_transaction_unittest.h" 20 #include "net/http/http_transaction_unittest.h"
20 #include "net/proxy/proxy_config_service_fixed.h" 21 #include "net/proxy/proxy_config_service_fixed.h"
21 #include "net/socket/client_socket_factory.h" 22 #include "net/socket/client_socket_factory.h"
22 #include "net/socket/socket_test_util.h" 23 #include "net/socket/socket_test_util.h"
23 #include "net/socket/ssl_client_socket.h" 24 #include "net/socket/ssl_client_socket.h"
(...skipping 10 matching lines...) Expand all
34 } 35 }
35 36
36 // Helper to manage the lifetimes of the dependencies for a 37 // Helper to manage the lifetimes of the dependencies for a
37 // HttpNetworkTransaction. 38 // HttpNetworkTransaction.
38 class SessionDependencies { 39 class SessionDependencies {
39 public: 40 public:
40 // Default set of dependencies -- "null" proxy service. 41 // Default set of dependencies -- "null" proxy service.
41 SessionDependencies() 42 SessionDependencies()
42 : host_resolver(new MockHostResolver), 43 : host_resolver(new MockHostResolver),
43 proxy_service(CreateNullProxyService()), 44 proxy_service(CreateNullProxyService()),
44 ssl_config_service(new SSLConfigServiceDefaults) {} 45 ssl_config_service(new SSLConfigServiceDefaults),
46 flip_session_pool(new FlipSessionPool) {}
45 47
46 // Custom proxy service dependency. 48 // Custom proxy service dependency.
47 explicit SessionDependencies(ProxyService* proxy_service) 49 explicit SessionDependencies(ProxyService* proxy_service)
48 : host_resolver(new MockHostResolver), 50 : host_resolver(new MockHostResolver),
49 proxy_service(proxy_service), 51 proxy_service(proxy_service),
50 ssl_config_service(new SSLConfigServiceDefaults) {} 52 ssl_config_service(new SSLConfigServiceDefaults),
53 flip_session_pool(new FlipSessionPool) {}
51 54
52 scoped_refptr<MockHostResolverBase> host_resolver; 55 scoped_refptr<MockHostResolverBase> host_resolver;
53 scoped_refptr<ProxyService> proxy_service; 56 scoped_refptr<ProxyService> proxy_service;
54 scoped_refptr<SSLConfigService> ssl_config_service; 57 scoped_refptr<SSLConfigService> ssl_config_service;
55 MockClientSocketFactory socket_factory; 58 MockClientSocketFactory socket_factory;
59 scoped_refptr<FlipSessionPool> flip_session_pool;
56 }; 60 };
57 61
58 ProxyService* CreateFixedProxyService(const std::string& proxy) { 62 ProxyService* CreateFixedProxyService(const std::string& proxy) {
59 net::ProxyConfig proxy_config; 63 net::ProxyConfig proxy_config;
60 proxy_config.proxy_rules.ParseFromString(proxy); 64 proxy_config.proxy_rules.ParseFromString(proxy);
61 return ProxyService::CreateFixed(proxy_config); 65 return ProxyService::CreateFixed(proxy_config);
62 } 66 }
63 67
64 68
65 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) { 69 HttpNetworkSession* CreateSession(SessionDependencies* session_deps) {
66 return new HttpNetworkSession(session_deps->host_resolver, 70 return new HttpNetworkSession(session_deps->host_resolver,
67 session_deps->proxy_service, 71 session_deps->proxy_service,
68 &session_deps->socket_factory, 72 &session_deps->socket_factory,
69 session_deps->ssl_config_service); 73 session_deps->ssl_config_service,
74 session_deps->flip_session_pool);
70 } 75 }
71 76
72 class HttpNetworkTransactionTest : public PlatformTest { 77 class HttpNetworkTransactionTest : public PlatformTest {
73 public: 78 public:
74 virtual void TearDown() { 79 virtual void TearDown() {
75 // Empty the current queue. 80 // Empty the current queue.
76 MessageLoop::current()->RunAllPending(); 81 MessageLoop::current()->RunAllPending();
77 PlatformTest::TearDown(); 82 PlatformTest::TearDown();
78 } 83 }
79 84
(...skipping 3701 matching lines...) Expand 10 before | Expand all | Expand 10 after
3781 new HttpNetworkTransaction(CreateSession(&session_deps))); 3786 new HttpNetworkTransaction(CreateSession(&session_deps)));
3782 3787
3783 int rv = trans->Start(&request, &callback, NULL); 3788 int rv = trans->Start(&request, &callback, NULL);
3784 EXPECT_EQ(ERR_IO_PENDING, rv); 3789 EXPECT_EQ(ERR_IO_PENDING, rv);
3785 3790
3786 rv = callback.WaitForResult(); 3791 rv = callback.WaitForResult();
3787 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv); 3792 EXPECT_EQ(ERR_TUNNEL_CONNECTION_FAILED, rv);
3788 } 3793 }
3789 3794
3790 } // namespace net 3795 } // namespace net
OLDNEW
« net/flip/flip_network_transaction.cc ('K') | « net/http/http_network_session.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698