| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "net/websockets/websocket_channel.h" | 5 #include "net/websockets/websocket_channel.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 }; | 704 }; |
| 705 | 705 |
| 706 struct WebSocketStreamCreationCallbackArgumentSaver { | 706 struct WebSocketStreamCreationCallbackArgumentSaver { |
| 707 std::unique_ptr<WebSocketStreamRequest> Create( | 707 std::unique_ptr<WebSocketStreamRequest> Create( |
| 708 const GURL& socket_url, | 708 const GURL& socket_url, |
| 709 std::unique_ptr<WebSocketHandshakeStreamCreateHelper> create_helper, | 709 std::unique_ptr<WebSocketHandshakeStreamCreateHelper> create_helper, |
| 710 const url::Origin& origin, | 710 const url::Origin& origin, |
| 711 const GURL& first_party_for_cookies, | 711 const GURL& first_party_for_cookies, |
| 712 const std::string& additional_headers, | 712 const std::string& additional_headers, |
| 713 URLRequestContext* url_request_context, | 713 URLRequestContext* url_request_context, |
| 714 const BoundNetLog& net_log, | 714 const NetLogWithSource& net_log, |
| 715 std::unique_ptr<WebSocketStream::ConnectDelegate> connect_delegate) { | 715 std::unique_ptr<WebSocketStream::ConnectDelegate> connect_delegate) { |
| 716 this->socket_url = socket_url; | 716 this->socket_url = socket_url; |
| 717 this->create_helper = std::move(create_helper); | 717 this->create_helper = std::move(create_helper); |
| 718 this->origin = origin; | 718 this->origin = origin; |
| 719 this->first_party_for_cookies = first_party_for_cookies; | 719 this->first_party_for_cookies = first_party_for_cookies; |
| 720 this->url_request_context = url_request_context; | 720 this->url_request_context = url_request_context; |
| 721 this->net_log = net_log; | 721 this->net_log = net_log; |
| 722 this->connect_delegate = std::move(connect_delegate); | 722 this->connect_delegate = std::move(connect_delegate); |
| 723 return base::WrapUnique(new MockWebSocketStreamRequest); | 723 return base::WrapUnique(new MockWebSocketStreamRequest); |
| 724 } | 724 } |
| 725 | 725 |
| 726 GURL socket_url; | 726 GURL socket_url; |
| 727 std::unique_ptr<WebSocketHandshakeStreamCreateHelper> create_helper; | 727 std::unique_ptr<WebSocketHandshakeStreamCreateHelper> create_helper; |
| 728 url::Origin origin; | 728 url::Origin origin; |
| 729 GURL first_party_for_cookies; | 729 GURL first_party_for_cookies; |
| 730 URLRequestContext* url_request_context; | 730 URLRequestContext* url_request_context; |
| 731 BoundNetLog net_log; | 731 NetLogWithSource net_log; |
| 732 std::unique_ptr<WebSocketStream::ConnectDelegate> connect_delegate; | 732 std::unique_ptr<WebSocketStream::ConnectDelegate> connect_delegate; |
| 733 }; | 733 }; |
| 734 | 734 |
| 735 // Converts a std::string to a std::vector<char>. For test purposes, it is | 735 // Converts a std::string to a std::vector<char>. For test purposes, it is |
| 736 // convenient to be able to specify data as a string, but the | 736 // convenient to be able to specify data as a string, but the |
| 737 // WebSocketEventInterface requires the vector<char> type. | 737 // WebSocketEventInterface requires the vector<char> type. |
| 738 std::vector<char> AsVector(const std::string& s) { | 738 std::vector<char> AsVector(const std::string& s) { |
| 739 return std::vector<char>(s.begin(), s.end()); | 739 return std::vector<char>(s.begin(), s.end()); |
| 740 } | 740 } |
| 741 | 741 |
| (...skipping 2771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3513 | 3513 |
| 3514 channel_->SendFrame( | 3514 channel_->SendFrame( |
| 3515 true, WebSocketFrameHeader::kOpCodeText, | 3515 true, WebSocketFrameHeader::kOpCodeText, |
| 3516 std::vector<char>(static_cast<size_t>(kMessageSize), 'a')); | 3516 std::vector<char>(static_cast<size_t>(kMessageSize), 'a')); |
| 3517 int new_send_quota = channel_->current_send_quota(); | 3517 int new_send_quota = channel_->current_send_quota(); |
| 3518 EXPECT_EQ(kMessageSize, initial_send_quota - new_send_quota); | 3518 EXPECT_EQ(kMessageSize, initial_send_quota - new_send_quota); |
| 3519 } | 3519 } |
| 3520 | 3520 |
| 3521 } // namespace | 3521 } // namespace |
| 3522 } // namespace net | 3522 } // namespace net |
| OLD | NEW |