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> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "base/threading/non_thread_safe.h" | 15 #include "base/sequence_checker.h" |
16 #include "remoting/signaling/iq_sender.h" | 16 #include "remoting/signaling/iq_sender.h" |
17 #include "remoting/signaling/signal_strategy.h" | 17 #include "remoting/signaling/signal_strategy.h" |
18 #include "remoting/signaling/signaling_address.h" | 18 #include "remoting/signaling/signaling_address.h" |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 class SingleThreadTaskRunner; | 21 class SingleThreadTaskRunner; |
22 } // namespace base | 22 } // namespace base |
23 | 23 |
24 namespace remoting { | 24 namespace remoting { |
25 | 25 |
26 class FakeSignalStrategy : public SignalStrategy, | 26 class FakeSignalStrategy : public SignalStrategy { |
27 public base::NonThreadSafe { | |
28 public: | 27 public: |
29 // Calls ConenctTo() to connect |peer1| and |peer2|. Both |peer1| and |peer2| | 28 // Calls ConenctTo() to connect |peer1| and |peer2|. Both |peer1| and |peer2| |
30 // must belong to the current thread. | 29 // must belong to the current thread. |
31 static void Connect(FakeSignalStrategy* peer1, FakeSignalStrategy* peer2); | 30 static void Connect(FakeSignalStrategy* peer1, FakeSignalStrategy* peer2); |
32 | 31 |
33 FakeSignalStrategy(const SignalingAddress& address); | 32 FakeSignalStrategy(const SignalingAddress& address); |
34 ~FakeSignalStrategy() override; | 33 ~FakeSignalStrategy() override; |
35 | 34 |
36 const std::list<buzz::XmlElement*>& received_messages() { | 35 const std::list<buzz::XmlElement*>& received_messages() { |
37 return received_messages_; | 36 return received_messages_; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 int last_id_; | 83 int last_id_; |
85 | 84 |
86 base::TimeDelta send_delay_; | 85 base::TimeDelta send_delay_; |
87 | 86 |
88 bool simulate_reorder_ = false; | 87 bool simulate_reorder_ = false; |
89 std::unique_ptr<buzz::XmlElement> pending_stanza_; | 88 std::unique_ptr<buzz::XmlElement> pending_stanza_; |
90 | 89 |
91 // All received messages, includes thouse still in |pending_messages_|. | 90 // All received messages, includes thouse still in |pending_messages_|. |
92 std::list<buzz::XmlElement*> received_messages_; | 91 std::list<buzz::XmlElement*> received_messages_; |
93 | 92 |
| 93 SEQUENCE_CHECKER(sequence_checker_); |
| 94 |
94 base::WeakPtrFactory<FakeSignalStrategy> weak_factory_; | 95 base::WeakPtrFactory<FakeSignalStrategy> weak_factory_; |
95 | 96 |
96 DISALLOW_COPY_AND_ASSIGN(FakeSignalStrategy); | 97 DISALLOW_COPY_AND_ASSIGN(FakeSignalStrategy); |
97 }; | 98 }; |
98 | 99 |
99 } // namespace remoting | 100 } // namespace remoting |
100 | 101 |
101 #endif // REMOTING_SIGNALING_FAKE_SIGNAL_STRATEGY_H_ | 102 #endif // REMOTING_SIGNALING_FAKE_SIGNAL_STRATEGY_H_ |
OLD | NEW |