| 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 <iostream> | 7 #include <iostream> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
| 17 #include "base/strings/string_piece.h" | 17 #include "base/strings/string_piece.h" |
| 18 #include "googleurl/src/gurl.h" | |
| 19 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 20 #include "net/url_request/url_request_context.h" | 19 #include "net/url_request/url_request_context.h" |
| 21 #include "net/websockets/websocket_errors.h" | 20 #include "net/websockets/websocket_errors.h" |
| 22 #include "net/websockets/websocket_event_interface.h" | 21 #include "net/websockets/websocket_event_interface.h" |
| 23 #include "net/websockets/websocket_mux.h" | 22 #include "net/websockets/websocket_mux.h" |
| 24 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 25 #include "url/gurl.h" |
| 26 | 26 |
| 27 namespace net { | 27 namespace net { |
| 28 | 28 |
| 29 // Printing helpers to allow GoogleMock to print frame chunks. These are | 29 // Printing helpers to allow GoogleMock to print frame chunks. These are |
| 30 // explicitly designed to look like the static initialisation format we use in | 30 // explicitly designed to look like the static initialisation format we use in |
| 31 // these tests. They have to live in the net namespace in order to be found by | 31 // these tests. They have to live in the net namespace in order to be found by |
| 32 // GoogleMock; a nested anonymous namespace will not work. | 32 // GoogleMock; a nested anonymous namespace will not work. |
| 33 | 33 |
| 34 std::ostream& operator<<(std::ostream& os, const WebSocketFrameHeader& header) { | 34 std::ostream& operator<<(std::ostream& os, const WebSocketFrameHeader& header) { |
| 35 return os << "{" << (header.final ? "FINAL_FRAME" : "NOT_FINAL_FRAME") << ", " | 35 return os << "{" << (header.final ? "FINAL_FRAME" : "NOT_FINAL_FRAME") << ", " |
| (...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 Pointee(Field(&WebSocketFrameHeader::masked, true)))))), | 1168 Pointee(Field(&WebSocketFrameHeader::masked, true)))))), |
| 1169 _)).WillOnce(Return(ERR_IO_PENDING)); | 1169 _)).WillOnce(Return(ERR_IO_PENDING)); |
| 1170 | 1170 |
| 1171 CreateChannelAndConnectSuccessfully(); | 1171 CreateChannelAndConnectSuccessfully(); |
| 1172 channel_->SendFrame( | 1172 channel_->SendFrame( |
| 1173 true, WebSocketFrameHeader::kOpCodeText, AsVector("NEEDS MASKING")); | 1173 true, WebSocketFrameHeader::kOpCodeText, AsVector("NEEDS MASKING")); |
| 1174 } | 1174 } |
| 1175 | 1175 |
| 1176 } // namespace | 1176 } // namespace |
| 1177 } // namespace net | 1177 } // namespace net |
| OLD | NEW |