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

Side by Side Diff: net/websockets/websocket_stream_cookie_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
« no previous file with comments | « net/websockets/websocket_stream.cc ('k') | net/websockets/websocket_stream_create_test_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <string> 5 #include <string>
6 6
7 #include "base/callback_forward.h" 7 #include "base/callback_forward.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 24 matching lines...) Expand all
35 const std::string& cookie_header, 35 const std::string& cookie_header,
36 const std::string& response_body) { 36 const std::string& response_body) {
37 // We assume cookie_header ends with CRLF if not empty, as 37 // We assume cookie_header ends with CRLF if not empty, as
38 // WebSocketStandardRequestWithCookies requires. Use AddCRLFIfNotEmpty 38 // WebSocketStandardRequestWithCookies requires. Use AddCRLFIfNotEmpty
39 // in a call site. 39 // in a call site.
40 CHECK(cookie_header.empty() || 40 CHECK(cookie_header.empty() ||
41 base::EndsWith(cookie_header, "\r\n", base::CompareCase::SENSITIVE)); 41 base::EndsWith(cookie_header, "\r\n", base::CompareCase::SENSITIVE));
42 42
43 url_request_context_host_.SetExpectations( 43 url_request_context_host_.SetExpectations(
44 WebSocketStandardRequestWithCookies(url.path(), url.host(), origin, 44 WebSocketStandardRequestWithCookies(url.path(), url.host(), origin,
45 cookie_header, std::string()), 45 cookie_header, std::string(),
46 std::string()),
46 response_body); 47 response_body);
47 CreateAndConnectStream(url.spec(), NoSubProtocols(), origin, nullptr); 48 CreateAndConnectStream(url.spec(), NoSubProtocols(), origin, "", nullptr);
48 } 49 }
49 50
50 std::string AddCRLFIfNotEmpty(const std::string& s) { 51 std::string AddCRLFIfNotEmpty(const std::string& s) {
51 return s.empty() ? s : s + "\r\n"; 52 return s.empty() ? s : s + "\r\n";
52 } 53 }
53 }; 54 };
54 55
55 struct ClientUseCookieParameter { 56 struct ClientUseCookieParameter {
56 // The URL for the WebSocket connection. 57 // The URL for the WebSocket connection.
57 const char* const url; 58 const char* const url;
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 "", 498 "",
498 "Set-Cookie: test-cookie"}, 499 "Set-Cookie: test-cookie"},
499 }; 500 };
500 501
501 INSTANTIATE_TEST_CASE_P(WebSocketStreamServerSetCookieTest, 502 INSTANTIATE_TEST_CASE_P(WebSocketStreamServerSetCookieTest,
502 WebSocketStreamServerSetCookieTest, 503 WebSocketStreamServerSetCookieTest,
503 ValuesIn(kServerSetCookieParameters)); 504 ValuesIn(kServerSetCookieParameters));
504 505
505 } // namespace 506 } // namespace
506 } // namespace net 507 } // namespace net
OLDNEW
« no previous file with comments | « net/websockets/websocket_stream.cc ('k') | net/websockets/websocket_stream_create_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698