diff options
author | yhirano <yhirano@chromium.org> | 2015-02-11 20:33:06 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-12 04:34:22 +0000 |
commit | 01a5d66a26a60f970d9a8b595d3b463d6c876c00 (patch) | |
tree | cb41e3940d03f45d8d86cde8d69d66a3c915cd8e /net/websockets/websocket_test_util.h | |
parent | 93de29973602195f3b0c6bcb3980dd145e8372c4 (diff) | |
download | chromium_src-01a5d66a26a60f970d9a8b595d3b463d6c876c00.zip chromium_src-01a5d66a26a60f970d9a8b595d3b463d6c876c00.tar.gz chromium_src-01a5d66a26a60f970d9a8b595d3b463d6c876c00.tar.bz2 |
Add WebSocket cookie tests.
As it turned out WebSocket implementation had some problems with Cookie, this
CL adds unit tests.
BUG=None
R=rsleevi@chromium.org
Review URL: https://codereview.chromium.org/869073002
Cr-Commit-Position: refs/heads/master@{#315930}
Diffstat (limited to 'net/websockets/websocket_test_util.h')
-rw-r--r-- | net/websockets/websocket_test_util.h | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/net/websockets/websocket_test_util.h b/net/websockets/websocket_test_util.h index f9bf961..0230f5c9 100644 --- a/net/websockets/websocket_test_util.h +++ b/net/websockets/websocket_test_util.h @@ -45,27 +45,37 @@ class LinearCongruentialGenerator { // use only. The differences are the use of a |create_helper| argument in place // of |requested_subprotocols| and taking |timer| as the handshake timeout // timer. Implemented in websocket_stream.cc. -NET_EXPORT_PRIVATE extern scoped_ptr<WebSocketStreamRequest> - CreateAndConnectStreamForTesting( - const GURL& socket_url, - scoped_ptr<WebSocketHandshakeStreamCreateHelper> create_helper, - const url::Origin& origin, - URLRequestContext* url_request_context, - const BoundNetLog& net_log, - scoped_ptr<WebSocketStream::ConnectDelegate> connect_delegate, - scoped_ptr<base::Timer> timer); +NET_EXPORT_PRIVATE scoped_ptr<WebSocketStreamRequest> +CreateAndConnectStreamForTesting( + const GURL& socket_url, + scoped_ptr<WebSocketHandshakeStreamCreateHelper> create_helper, + const url::Origin& origin, + URLRequestContext* url_request_context, + const BoundNetLog& net_log, + scoped_ptr<WebSocketStream::ConnectDelegate> connect_delegate, + scoped_ptr<base::Timer> timer); // Generates a standard WebSocket handshake request. The challenge key used is // "dGhlIHNhbXBsZSBub25jZQ==". Each header in |extra_headers| must be terminated // with "\r\n". -extern std::string WebSocketStandardRequest(const std::string& path, - const std::string& host, - const std::string& origin, - const std::string& extra_headers); +std::string WebSocketStandardRequest(const std::string& path, + const std::string& host, + const std::string& origin, + const std::string& extra_headers); + +// Generates a standard WebSocket handshake request. The challenge key used is +// "dGhlIHNhbXBsZSBub25jZQ==". |cookies| must be empty or terminated with +// "\r\n". Each header in |extra_headers| must be terminated with "\r\n". +std::string WebSocketStandardRequestWithCookies( + const std::string& path, + const std::string& host, + const std::string& origin, + const std::string& cookies, + const std::string& extra_headers); // A response with the appropriate accept header to match the above challenge // key. Each header in |extra_headers| must be terminated with "\r\n". -extern std::string WebSocketStandardResponse(const std::string& extra_headers); +std::string WebSocketStandardResponse(const std::string& extra_headers); // This class provides a convenient way to construct a // DeterministicMockClientSocketFactory for WebSocket tests. |