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 | |
40 void ReceiveData(const std::string& text) { | 32 void ReceiveData(const std::string& text) { |
41 socket()->OnReadComplete( | 33 socket()->OnReadComplete( |
42 net::MockRead(net::ASYNC, text.data(), text.size())); | 34 net::MockRead(net::ASYNC, text.data(), text.size())); |
43 } | 35 } |
44 | 36 |
45 void Close() { | 37 void Close() { |
46 ReceiveData(std::string()); | 38 ReceiveData(std::string()); |
47 } | 39 } |
48 | 40 |
49 void SimulateNetworkError() { | 41 void SimulateNetworkError() { |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 259 |
268 // Can't send messages anymore. | 260 // Can't send messages anymore. |
269 EXPECT_FALSE(signal_strategy_->SendStanza(make_scoped_ptr( | 261 EXPECT_FALSE(signal_strategy_->SendStanza(make_scoped_ptr( |
270 new buzz::XmlElement(buzz::QName(std::string(), "hello"))))); | 262 new buzz::XmlElement(buzz::QName(std::string(), "hello"))))); |
271 | 263 |
272 // Try connecting again. | 264 // Try connecting again. |
273 Connect(true); | 265 Connect(true); |
274 } | 266 } |
275 | 267 |
276 } // namespace remoting | 268 } // namespace remoting |
OLD | NEW |