OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "modules/websockets/WebSocketChannel.h" | 5 #include "modules/websockets/WebSocketChannel.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <memory> | 8 #include <memory> |
9 #include "core/dom/DOMArrayBuffer.h" | 9 #include "core/dom/DOMArrayBuffer.h" |
10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 Persistent<MockWebSocketChannelClient> channel_client_; | 141 Persistent<MockWebSocketChannelClient> channel_client_; |
142 MockWebSocketHandle* handle_; | 142 MockWebSocketHandle* handle_; |
143 Persistent<DocumentWebSocketChannel> channel_; | 143 Persistent<DocumentWebSocketChannel> channel_; |
144 unsigned long sum_of_consumed_buffered_amount_; | 144 unsigned long sum_of_consumed_buffered_amount_; |
145 }; | 145 }; |
146 | 146 |
147 MATCHER_P2(MemEq, | 147 MATCHER_P2(MemEq, |
148 p, | 148 p, |
149 len, | 149 len, |
150 std::string("pointing to memory") + (negation ? " not" : "") + | 150 std::string("pointing to memory") + (negation ? " not" : "") + |
151 " equal to \"" + | 151 " equal to \"" + std::string(p, len) + |
152 std::string(p, len) + | 152 "\" (length=" + PrintToString(len) + ")") { |
153 "\" (length=" + | |
154 PrintToString(len) + | |
155 ")") { | |
156 return memcmp(arg, p, len) == 0; | 153 return memcmp(arg, p, len) == 0; |
157 } | 154 } |
158 | 155 |
159 MATCHER_P(KURLEq, | 156 MATCHER_P(KURLEq, |
160 url_string, | 157 url_string, |
161 std::string(negation ? "doesn't equal" : "equals") + " to \"" + | 158 std::string(negation ? "doesn't equal" : "equals") + " to \"" + |
162 url_string + | 159 url_string + "\"") { |
163 "\"") { | |
164 KURL url(KURL(), url_string); | 160 KURL url(KURL(), url_string); |
165 *result_listener << "where the url is \"" << arg.GetString().Utf8().data() | 161 *result_listener << "where the url is \"" << arg.GetString().Utf8().data() |
166 << "\""; | 162 << "\""; |
167 return arg == url; | 163 return arg == url; |
168 } | 164 } |
169 | 165 |
170 TEST_F(DocumentWebSocketChannelTest, connectSuccess) { | 166 TEST_F(DocumentWebSocketChannelTest, connectSuccess) { |
171 Vector<String> protocols; | 167 Vector<String> protocols; |
172 RefPtr<SecurityOrigin> origin; | 168 RefPtr<SecurityOrigin> origin; |
173 | 169 |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 WebSocketChannel::kCloseEventCodeAbnormalClosure, String())); | 767 WebSocketChannel::kCloseEventCodeAbnormalClosure, String())); |
772 } | 768 } |
773 | 769 |
774 Channel()->Fail("fail message from WebSocket", kErrorMessageLevel, | 770 Channel()->Fail("fail message from WebSocket", kErrorMessageLevel, |
775 SourceLocation::Create(String(), 0, 0, nullptr)); | 771 SourceLocation::Create(String(), 0, 0, nullptr)); |
776 } | 772 } |
777 | 773 |
778 } // namespace | 774 } // namespace |
779 | 775 |
780 } // namespace blink | 776 } // namespace blink |
OLD | NEW |