| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/websockets/websocket_test_util.h" | 5 #include "net/websockets/websocket_test_util.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "net/proxy/proxy_service.h" |
| 14 #include "net/socket/socket_test_util.h" | 15 #include "net/socket/socket_test_util.h" |
| 15 | 16 |
| 16 namespace net { | 17 namespace net { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 const uint64 kA = | 20 const uint64 kA = |
| 20 (static_cast<uint64>(0x5851f42d) << 32) + static_cast<uint64>(0x4c957f2d); | 21 (static_cast<uint64>(0x5851f42d) << 32) + static_cast<uint64>(0x4c957f2d); |
| 21 const uint64 kC = 12345; | 22 const uint64 kC = 12345; |
| 22 const uint64 kM = static_cast<uint64>(1) << 48; | 23 const uint64 kM = static_cast<uint64>(1) << 48; |
| 23 | 24 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 void WebSocketTestURLRequestContextHost::AddRawExpectations( | 145 void WebSocketTestURLRequestContextHost::AddRawExpectations( |
| 145 scoped_ptr<DeterministicSocketData> socket_data) { | 146 scoped_ptr<DeterministicSocketData> socket_data) { |
| 146 maker_.AddRawExpectations(socket_data.Pass()); | 147 maker_.AddRawExpectations(socket_data.Pass()); |
| 147 } | 148 } |
| 148 | 149 |
| 149 void WebSocketTestURLRequestContextHost::AddSSLSocketDataProvider( | 150 void WebSocketTestURLRequestContextHost::AddSSLSocketDataProvider( |
| 150 scoped_ptr<SSLSocketDataProvider> ssl_socket_data) { | 151 scoped_ptr<SSLSocketDataProvider> ssl_socket_data) { |
| 151 maker_.AddSSLSocketDataProvider(ssl_socket_data.Pass()); | 152 maker_.AddSSLSocketDataProvider(ssl_socket_data.Pass()); |
| 152 } | 153 } |
| 153 | 154 |
| 155 void WebSocketTestURLRequestContextHost::SetProxyConfig( |
| 156 const std::string& proxy_rules) { |
| 157 DCHECK(!url_request_context_initialized_); |
| 158 proxy_service_.reset(ProxyService::CreateFixed(proxy_rules)); |
| 159 url_request_context_.set_proxy_service(proxy_service_.get()); |
| 160 } |
| 161 |
| 154 TestURLRequestContext* | 162 TestURLRequestContext* |
| 155 WebSocketTestURLRequestContextHost::GetURLRequestContext() { | 163 WebSocketTestURLRequestContextHost::GetURLRequestContext() { |
| 156 if (!url_request_context_initialized_) { | 164 if (!url_request_context_initialized_) { |
| 157 url_request_context_.Init(); | 165 url_request_context_.Init(); |
| 158 // A Network Delegate is required to make the URLRequest::Delegate work. | 166 // A Network Delegate is required to make the URLRequest::Delegate work. |
| 159 url_request_context_.set_network_delegate(&network_delegate_); | 167 url_request_context_.set_network_delegate(&network_delegate_); |
| 160 url_request_context_initialized_ = true; | 168 url_request_context_initialized_ = true; |
| 161 } | 169 } |
| 162 return &url_request_context_; | 170 return &url_request_context_; |
| 163 } | 171 } |
| 164 | 172 |
| 165 } // namespace net | 173 } // namespace net |
| OLD | NEW |