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

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: Created 4 years, 6 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 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 26 matching lines...) Expand all
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 response_body); 46 response_body);
47 CreateAndConnectStream(url.spec(), NoSubProtocols(), origin, nullptr); 47 CreateAndConnectStream(url.spec(), NoSubProtocols(), origin, "", nullptr);
48 } 48 }
49 49
50 std::string AddCRLFIfNotEmpty(const std::string& s) { 50 std::string AddCRLFIfNotEmpty(const std::string& s) {
51 return s.empty() ? s : s + "\r\n"; 51 return s.empty() ? s : s + "\r\n";
52 } 52 }
53 }; 53 };
54 54
55 struct ClientUseCookieParameter { 55 struct ClientUseCookieParameter {
56 // The URL for the WebSocket connection. 56 // The URL for the WebSocket connection.
57 const char* const url; 57 const char* const url;
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 "", 497 "",
498 "Set-Cookie: test-cookie"}, 498 "Set-Cookie: test-cookie"},
499 }; 499 };
500 500
501 INSTANTIATE_TEST_CASE_P(WebSocketStreamServerSetCookieTest, 501 INSTANTIATE_TEST_CASE_P(WebSocketStreamServerSetCookieTest,
502 WebSocketStreamServerSetCookieTest, 502 WebSocketStreamServerSetCookieTest,
503 ValuesIn(kServerSetCookieParameters)); 503 ValuesIn(kServerSetCookieParameters));
504 504
505 } // namespace 505 } // namespace
506 } // namespace net 506 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698