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 "remoting/signaling/xmpp_signal_strategy.h" | 5 #include "remoting/signaling/xmpp_signal_strategy.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "net/socket/socket_test_util.h" | 10 #include "net/socket/socket_test_util.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 return net::MockRead(net::ASYNC, net::ERR_IO_PENDING); | 22 return net::MockRead(net::ASYNC, net::ERR_IO_PENDING); |
23 } | 23 } |
24 | 24 |
25 net::MockWriteResult OnWrite(const std::string& data) override { | 25 net::MockWriteResult OnWrite(const std::string& data) override { |
26 written_data_.append(data); | 26 written_data_.append(data); |
27 return net::MockWriteResult(net::SYNCHRONOUS, data.size()); | 27 return net::MockWriteResult(net::SYNCHRONOUS, data.size()); |
28 } | 28 } |
29 | 29 |
30 void Reset() override {} | 30 void Reset() override {} |
31 | 31 |
| 32 bool AllReadDataConsumed() const override { |
| 33 return true; |
| 34 } |
| 35 |
| 36 bool AllWriteDataConsumed() const override { |
| 37 return true; |
| 38 } |
| 39 |
32 void ReceiveData(const std::string& text) { | 40 void ReceiveData(const std::string& text) { |
33 socket()->OnReadComplete( | 41 socket()->OnReadComplete( |
34 net::MockRead(net::ASYNC, text.data(), text.size())); | 42 net::MockRead(net::ASYNC, text.data(), text.size())); |
35 } | 43 } |
36 | 44 |
37 void Close() { | 45 void Close() { |
38 ReceiveData(std::string()); | 46 ReceiveData(std::string()); |
39 } | 47 } |
40 | 48 |
41 void SimulateNetworkError() { | 49 void SimulateNetworkError() { |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 267 |
260 // Can't send messages anymore. | 268 // Can't send messages anymore. |
261 EXPECT_FALSE(signal_strategy_->SendStanza(make_scoped_ptr( | 269 EXPECT_FALSE(signal_strategy_->SendStanza(make_scoped_ptr( |
262 new buzz::XmlElement(buzz::QName(std::string(), "hello"))))); | 270 new buzz::XmlElement(buzz::QName(std::string(), "hello"))))); |
263 | 271 |
264 // Try connecting again. | 272 // Try connecting again. |
265 Connect(true); | 273 Connect(true); |
266 } | 274 } |
267 | 275 |
268 } // namespace remoting | 276 } // namespace remoting |
OLD | NEW |