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

Unified Diff: net/websockets/websocket_handshake_stream_create_helper_test.cc

Issue 143913003: Add construction of WebSocketDeflateStream (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase and add DCHECK() for extension params. Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/websockets/websocket_handshake_stream_create_helper.cc ('k') | net/websockets/websocket_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_handshake_stream_create_helper_test.cc
diff --git a/net/websockets/websocket_handshake_stream_create_helper_test.cc b/net/websockets/websocket_handshake_stream_create_helper_test.cc
index 7cf7cdba1fffc52d0fb3cd71367a2dee455e7615..89e7cc3a727d856701691caf03e313a498be423b 100644
--- a/net/websockets/websocket_handshake_stream_create_helper_test.cc
+++ b/net/websockets/websocket_handshake_stream_create_helper_test.cc
@@ -4,6 +4,9 @@
#include "net/websockets/websocket_handshake_stream_create_helper.h"
+#include <string>
+#include <vector>
+
#include "net/base/completion_callback.h"
#include "net/base/net_errors.h"
#include "net/http/http_request_headers.h"
@@ -146,14 +149,47 @@ TEST_F(WebSocketHandshakeStreamCreateHelperTest, SubProtocols) {
sub_protocols.push_back("chat");
sub_protocols.push_back("superchat");
scoped_ptr<WebSocketStream> stream =
- CreateAndInitializeStream("ws://localhost/", "/",
- sub_protocols, "http://localhost/",
+ CreateAndInitializeStream("ws://localhost/",
+ "/",
+ sub_protocols,
+ "http://localhost/",
"Sec-WebSocket-Protocol: chat, superchat\r\n",
"Sec-WebSocket-Protocol: superchat\r\n");
EXPECT_EQ("superchat", stream->GetSubProtocol());
}
-// TODO(ricea): Test extensions once they are implemented.
+// Verify that extension name is available. Bad extension names are tested in
+// websocket_stream_test.cc.
+TEST_F(WebSocketHandshakeStreamCreateHelperTest, Extensions) {
+ scoped_ptr<WebSocketStream> stream = CreateAndInitializeStream(
+ "ws://localhost/",
+ "/",
+ std::vector<std::string>(),
+ "http://localhost/",
+ "",
+ "Sec-WebSocket-Extensions: permessage-deflate\r\n");
+ EXPECT_EQ("permessage-deflate", stream->GetExtensions());
+}
+
+// Verify that extension parameters are available. Bad parameters are tested in
+// websocket_stream_test.cc.
+TEST_F(WebSocketHandshakeStreamCreateHelperTest, ExtensionParameters) {
+ scoped_ptr<WebSocketStream> stream = CreateAndInitializeStream(
+ "ws://localhost/",
+ "/",
+ std::vector<std::string>(),
+ "http://localhost/",
+ "",
+ "Sec-WebSocket-Extensions: permessage-deflate;"
+ " client_max_window_bits=14; server_max_window_bits=14;"
+ " server_no_context_takeover; client_no_context_takeover\r\n");
+
+ EXPECT_EQ(
+ "permessage-deflate;"
+ " client_max_window_bits=14; server_max_window_bits=14;"
+ " server_no_context_takeover; client_no_context_takeover",
+ stream->GetExtensions());
+}
} // namespace
} // namespace net
« no previous file with comments | « net/websockets/websocket_handshake_stream_create_helper.cc ('k') | net/websockets/websocket_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698