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

Side by Side Diff: net/websockets/websocket_end_to_end_test.cc

Issue 2003253002: [Devtools] Allow User-Agent header override for Websockets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tests Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // End-to-end tests for WebSocket. 5 // End-to-end tests for WebSocket.
6 // 6 //
7 // A python server is (re)started for each test, which is moderately 7 // A python server is (re)started for each test, which is moderately
8 // inefficient. However, it makes these tests a good fit for scenarios which 8 // inefficient. However, it makes these tests a good fit for scenarios which
9 // require special server configurations. 9 // require special server configurations.
10 10
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 // Send the connect request to |socket_url| and wait for a response. Returns 261 // Send the connect request to |socket_url| and wait for a response. Returns
262 // true if the handshake succeeded. 262 // true if the handshake succeeded.
263 bool ConnectAndWait(const GURL& socket_url) { 263 bool ConnectAndWait(const GURL& socket_url) {
264 if (!initialised_context_) { 264 if (!initialised_context_) {
265 InitialiseContext(); 265 InitialiseContext();
266 } 266 }
267 url::Origin origin(GURL("http://localhost")); 267 url::Origin origin(GURL("http://localhost"));
268 event_interface_ = new ConnectTestingEventInterface; 268 event_interface_ = new ConnectTestingEventInterface;
269 channel_.reset( 269 channel_.reset(
270 new WebSocketChannel(base::WrapUnique(event_interface_), &context_)); 270 new WebSocketChannel(base::WrapUnique(event_interface_), &context_));
271 channel_->SendAddChannelRequest(GURL(socket_url), sub_protocols_, origin); 271 channel_->SendAddChannelRequest(GURL(socket_url), sub_protocols_, origin,
272 "");
272 event_interface_->WaitForResponse(); 273 event_interface_->WaitForResponse();
273 return !event_interface_->failed(); 274 return !event_interface_->failed();
274 } 275 }
275 276
276 ConnectTestingEventInterface* event_interface_; // owned by channel_ 277 ConnectTestingEventInterface* event_interface_; // owned by channel_
277 std::unique_ptr<TestProxyDelegateWithProxyInfo> proxy_delegate_; 278 std::unique_ptr<TestProxyDelegateWithProxyInfo> proxy_delegate_;
278 TestURLRequestContext context_; 279 TestURLRequestContext context_;
279 std::unique_ptr<WebSocketChannel> channel_; 280 std::unique_ptr<WebSocketChannel> channel_;
280 std::vector<std::string> sub_protocols_; 281 std::vector<std::string> sub_protocols_;
281 bool initialised_context_; 282 bool initialised_context_;
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 GURL ws_url = ws_server.GetURL("header-continuation"); 511 GURL ws_url = ws_server.GetURL("header-continuation");
511 512
512 EXPECT_TRUE(ConnectAndWait(ws_url)); 513 EXPECT_TRUE(ConnectAndWait(ws_url));
513 EXPECT_EQ("permessage-deflate; server_max_window_bits=10", 514 EXPECT_EQ("permessage-deflate; server_max_window_bits=10",
514 event_interface_->extensions()); 515 event_interface_->extensions());
515 } 516 }
516 517
517 } // namespace 518 } // namespace
518 519
519 } // namespace net 520 } // namespace net
OLDNEW
« no previous file with comments | « net/websockets/websocket_channel_test.cc ('k') | net/websockets/websocket_handshake_stream_create_helper_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698