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 #ifndef NET_WEBSOCKETS_WEBSOCKET_TEST_UTIL_H_ | 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_TEST_UTIL_H_ |
6 #define NET_WEBSOCKETS_WEBSOCKET_TEST_UTIL_H_ | 6 #define NET_WEBSOCKETS_WEBSOCKET_TEST_UTIL_H_ |
7 | 7 |
| 8 #include <stdint.h> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "net/url_request/url_request_test_util.h" | 13 #include "net/url_request/url_request_test_util.h" |
13 #include "net/websockets/websocket_stream.h" | 14 #include "net/websockets/websocket_stream.h" |
14 | 15 |
15 class GURL; | 16 class GURL; |
16 | 17 |
17 namespace base { | 18 namespace base { |
18 class Timer; | 19 class Timer; |
19 } // namespace base | 20 } // namespace base |
20 | 21 |
21 namespace url { | 22 namespace url { |
22 class Origin; | 23 class Origin; |
23 } // namespace url | 24 } // namespace url |
24 | 25 |
25 namespace net { | 26 namespace net { |
26 | 27 |
27 class BoundNetLog; | 28 class BoundNetLog; |
28 class MockClientSocketFactory; | 29 class MockClientSocketFactory; |
29 class ProxyService; | 30 class ProxyService; |
30 class SequencedSocketData; | 31 class SequencedSocketData; |
31 struct SSLSocketDataProvider; | 32 struct SSLSocketDataProvider; |
32 class URLRequestContext; | 33 class URLRequestContext; |
33 | 34 |
34 class LinearCongruentialGenerator { | 35 class LinearCongruentialGenerator { |
35 public: | 36 public: |
36 explicit LinearCongruentialGenerator(uint32 seed); | 37 explicit LinearCongruentialGenerator(uint32_t seed); |
37 uint32 Generate(); | 38 uint32_t Generate(); |
38 | 39 |
39 private: | 40 private: |
40 uint64 current_; | 41 uint64_t current_; |
41 }; | 42 }; |
42 | 43 |
43 // Generates a standard WebSocket handshake request. The challenge key used is | 44 // Generates a standard WebSocket handshake request. The challenge key used is |
44 // "dGhlIHNhbXBsZSBub25jZQ==". Each header in |extra_headers| must be terminated | 45 // "dGhlIHNhbXBsZSBub25jZQ==". Each header in |extra_headers| must be terminated |
45 // with "\r\n". | 46 // with "\r\n". |
46 std::string WebSocketStandardRequest(const std::string& path, | 47 std::string WebSocketStandardRequest(const std::string& path, |
47 const std::string& host, | 48 const std::string& host, |
48 const url::Origin& origin, | 49 const url::Origin& origin, |
49 const std::string& extra_headers); | 50 const std::string& extra_headers); |
50 | 51 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 TestNetworkDelegate network_delegate_; | 136 TestNetworkDelegate network_delegate_; |
136 scoped_ptr<ProxyService> proxy_service_; | 137 scoped_ptr<ProxyService> proxy_service_; |
137 bool url_request_context_initialized_; | 138 bool url_request_context_initialized_; |
138 | 139 |
139 DISALLOW_COPY_AND_ASSIGN(WebSocketTestURLRequestContextHost); | 140 DISALLOW_COPY_AND_ASSIGN(WebSocketTestURLRequestContextHost); |
140 }; | 141 }; |
141 | 142 |
142 } // namespace net | 143 } // namespace net |
143 | 144 |
144 #endif // NET_WEBSOCKETS_WEBSOCKET_TEST_UTIL_H_ | 145 #endif // NET_WEBSOCKETS_WEBSOCKET_TEST_UTIL_H_ |
OLD | NEW |