| 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 #ifndef REMOTING_SIGNALING_FAKE_SIGNAL_STRATEGY_H_ | 5 #ifndef REMOTING_SIGNALING_FAKE_SIGNAL_STRATEGY_H_ |
| 6 #define REMOTING_SIGNALING_FAKE_SIGNAL_STRATEGY_H_ | 6 #define REMOTING_SIGNALING_FAKE_SIGNAL_STRATEGY_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // must belong to the current thread. | 28 // must belong to the current thread. |
| 29 static void Connect(FakeSignalStrategy* peer1, FakeSignalStrategy* peer2); | 29 static void Connect(FakeSignalStrategy* peer1, FakeSignalStrategy* peer2); |
| 30 | 30 |
| 31 FakeSignalStrategy(const std::string& jid); | 31 FakeSignalStrategy(const std::string& jid); |
| 32 ~FakeSignalStrategy() override; | 32 ~FakeSignalStrategy() override; |
| 33 | 33 |
| 34 const std::list<buzz::XmlElement*>& received_messages() { | 34 const std::list<buzz::XmlElement*>& received_messages() { |
| 35 return received_messages_; | 35 return received_messages_; |
| 36 } | 36 } |
| 37 | 37 |
| 38 void set_send_delay(base::TimeDelta delay) { |
| 39 send_delay_ = delay; |
| 40 } |
| 41 |
| 38 // Connects current FakeSignalStrategy to receive messages from |peer|. | 42 // Connects current FakeSignalStrategy to receive messages from |peer|. |
| 39 void ConnectTo(FakeSignalStrategy* peer); | 43 void ConnectTo(FakeSignalStrategy* peer); |
| 40 | 44 |
| 41 // SignalStrategy interface. | 45 // SignalStrategy interface. |
| 42 void Connect() override; | 46 void Connect() override; |
| 43 void Disconnect() override; | 47 void Disconnect() override; |
| 44 State GetState() const override; | 48 State GetState() const override; |
| 45 Error GetError() const override; | 49 Error GetError() const override; |
| 46 std::string GetLocalJid() const override; | 50 std::string GetLocalJid() const override; |
| 47 void AddListener(Listener* listener) override; | 51 void AddListener(Listener* listener) override; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 63 void SetPeerCallback(const PeerCallback& peer_callback); | 67 void SetPeerCallback(const PeerCallback& peer_callback); |
| 64 | 68 |
| 65 scoped_refptr<base::SingleThreadTaskRunner> main_thread_; | 69 scoped_refptr<base::SingleThreadTaskRunner> main_thread_; |
| 66 | 70 |
| 67 std::string jid_; | 71 std::string jid_; |
| 68 PeerCallback peer_callback_; | 72 PeerCallback peer_callback_; |
| 69 ObserverList<Listener, true> listeners_; | 73 ObserverList<Listener, true> listeners_; |
| 70 | 74 |
| 71 int last_id_; | 75 int last_id_; |
| 72 | 76 |
| 77 base::TimeDelta send_delay_; |
| 78 |
| 73 // All received messages, includes thouse still in |pending_messages_|. | 79 // All received messages, includes thouse still in |pending_messages_|. |
| 74 std::list<buzz::XmlElement*> received_messages_; | 80 std::list<buzz::XmlElement*> received_messages_; |
| 75 | 81 |
| 76 base::WeakPtrFactory<FakeSignalStrategy> weak_factory_; | 82 base::WeakPtrFactory<FakeSignalStrategy> weak_factory_; |
| 77 | 83 |
| 78 DISALLOW_COPY_AND_ASSIGN(FakeSignalStrategy); | 84 DISALLOW_COPY_AND_ASSIGN(FakeSignalStrategy); |
| 79 }; | 85 }; |
| 80 | 86 |
| 81 } // namespace remoting | 87 } // namespace remoting |
| 82 | 88 |
| 83 #endif // REMOTING_SIGNALING_FAKE_SIGNAL_STRATEGY_H_ | 89 #endif // REMOTING_SIGNALING_FAKE_SIGNAL_STRATEGY_H_ |
| OLD | NEW |