| OLD | NEW |
| 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 Loading... |
| 35 const GURL& first_party_for_cookies, | 35 const GURL& first_party_for_cookies, |
| 36 const std::string& cookie_header, | 36 const std::string& cookie_header, |
| 37 const std::string& response_body) { | 37 const std::string& response_body) { |
| 38 // We assume cookie_header ends with CRLF if not empty, as | 38 // We assume cookie_header ends with CRLF if not empty, as |
| 39 // WebSocketStandardRequestWithCookies requires. Use AddCRLFIfNotEmpty | 39 // WebSocketStandardRequestWithCookies requires. Use AddCRLFIfNotEmpty |
| 40 // in a call site. | 40 // in a call site. |
| 41 CHECK(cookie_header.empty() || | 41 CHECK(cookie_header.empty() || |
| 42 base::EndsWith(cookie_header, "\r\n", base::CompareCase::SENSITIVE)); | 42 base::EndsWith(cookie_header, "\r\n", base::CompareCase::SENSITIVE)); |
| 43 | 43 |
| 44 url_request_context_host_.SetExpectations( | 44 url_request_context_host_.SetExpectations( |
| 45 WebSocketStandardRequestWithCookies(url.path(), url.host(), origin, | 45 WebSocketStandardRequestWithCookies(url.path().as_string(), url.host(), |
| 46 cookie_header, std::string(), | 46 origin, cookie_header, |
| 47 std::string()), | 47 std::string(), std::string()), |
| 48 response_body); | 48 response_body); |
| 49 CreateAndConnectStream(url, NoSubProtocols(), origin, | 49 CreateAndConnectStream(url, NoSubProtocols(), origin, |
| 50 first_party_for_cookies, "", nullptr); | 50 first_party_for_cookies, "", nullptr); |
| 51 } | 51 } |
| 52 | 52 |
| 53 std::string AddCRLFIfNotEmpty(const std::string& s) { | 53 std::string AddCRLFIfNotEmpty(const std::string& s) { |
| 54 return s.empty() ? s : s + "\r\n"; | 54 return s.empty() ? s : s + "\r\n"; |
| 55 } | 55 } |
| 56 }; | 56 }; |
| 57 | 57 |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 "", | 503 "", |
| 504 "Set-Cookie: test-cookie"}, | 504 "Set-Cookie: test-cookie"}, |
| 505 }; | 505 }; |
| 506 | 506 |
| 507 INSTANTIATE_TEST_CASE_P(WebSocketStreamServerSetCookieTest, | 507 INSTANTIATE_TEST_CASE_P(WebSocketStreamServerSetCookieTest, |
| 508 WebSocketStreamServerSetCookieTest, | 508 WebSocketStreamServerSetCookieTest, |
| 509 ValuesIn(kServerSetCookieParameters)); | 509 ValuesIn(kServerSetCookieParameters)); |
| 510 | 510 |
| 511 } // namespace | 511 } // namespace |
| 512 } // namespace net | 512 } // namespace net |
| OLD | NEW |