OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ |
6 #define CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "third_party/libjingle/source/talk/app/webrtc/peerconnection.h" | 12 #include "third_party/libjingle/source/talk/app/webrtc/peerconnection.h" |
13 | 13 |
| 14 class MockMediaStreamDependencyFactory; |
| 15 |
14 namespace webrtc { | 16 namespace webrtc { |
15 | 17 |
16 class MockStreamCollection; | 18 class MockStreamCollection; |
17 | 19 |
18 class MockPeerConnectionImpl : public PeerConnectionInterface { | 20 class MockPeerConnectionImpl : public PeerConnectionInterface { |
19 public: | 21 public: |
20 MockPeerConnectionImpl(); | 22 MockPeerConnectionImpl(MockMediaStreamDependencyFactory* factory); |
21 | 23 |
22 // PeerConnectionInterface implementation. | 24 // PeerConnectionInterface implementation. |
23 virtual void ProcessSignalingMessage(const std::string& msg) OVERRIDE; | 25 virtual void ProcessSignalingMessage(const std::string& msg) OVERRIDE; |
24 virtual bool Send(const std::string& msg) OVERRIDE; | 26 virtual bool Send(const std::string& msg) OVERRIDE; |
25 virtual talk_base::scoped_refptr<StreamCollectionInterface> | 27 virtual talk_base::scoped_refptr<StreamCollectionInterface> |
26 local_streams() OVERRIDE; | 28 local_streams() OVERRIDE; |
27 virtual talk_base::scoped_refptr<StreamCollectionInterface> | 29 virtual talk_base::scoped_refptr<StreamCollectionInterface> |
28 remote_streams() OVERRIDE; | 30 remote_streams() OVERRIDE; |
29 virtual void AddStream(LocalMediaStreamInterface* stream) OVERRIDE; | 31 virtual void AddStream(LocalMediaStreamInterface* stream) OVERRIDE; |
30 virtual void RemoveStream(LocalMediaStreamInterface* stream) OVERRIDE; | 32 virtual void RemoveStream(LocalMediaStreamInterface* stream) OVERRIDE; |
(...skipping 16 matching lines...) Expand all Loading... |
47 webrtc::SessionDescriptionInterface* desc) OVERRIDE; | 49 webrtc::SessionDescriptionInterface* desc) OVERRIDE; |
48 virtual bool ProcessIceMessage( | 50 virtual bool ProcessIceMessage( |
49 const webrtc::IceCandidateInterface* ice_candidate) OVERRIDE; | 51 const webrtc::IceCandidateInterface* ice_candidate) OVERRIDE; |
50 virtual const webrtc::SessionDescriptionInterface* local_description() | 52 virtual const webrtc::SessionDescriptionInterface* local_description() |
51 const OVERRIDE; | 53 const OVERRIDE; |
52 virtual const webrtc::SessionDescriptionInterface* remote_description() | 54 virtual const webrtc::SessionDescriptionInterface* remote_description() |
53 const OVERRIDE; | 55 const OVERRIDE; |
54 | 56 |
55 void AddRemoteStream(MediaStreamInterface* stream); | 57 void AddRemoteStream(MediaStreamInterface* stream); |
56 void ClearStreamChangesCommitted() { stream_changes_committed_ = false; } | 58 void ClearStreamChangesCommitted() { stream_changes_committed_ = false; } |
| 59 void SetReadyState(ReadyState state) { ready_state_ = state; } |
57 | 60 |
58 const std::string& signaling_message() const { return signaling_message_; } | 61 const std::string& signaling_message() const { return signaling_message_; } |
59 const std::string& stream_label() const { return stream_label_; } | 62 const std::string& stream_label() const { return stream_label_; } |
60 bool stream_changes_committed() const { return stream_changes_committed_; } | 63 bool stream_changes_committed() const { return stream_changes_committed_; } |
| 64 bool hint_audio() const { return hint_audio_; } |
| 65 bool hint_video() const { return hint_video_; } |
| 66 Action action() const { return action_; } |
| 67 const std::string& description_sdp() const { return description_sdp_; } |
| 68 IceOptions ice_options() const { return ice_options_; } |
| 69 const std::string& ice_label() const { return ice_label_; } |
| 70 const std::string& ice_sdp() const { return ice_sdp_; } |
| 71 |
| 72 static const char kDummyOffer[]; |
61 | 73 |
62 protected: | 74 protected: |
63 virtual ~MockPeerConnectionImpl(); | 75 virtual ~MockPeerConnectionImpl(); |
64 | 76 |
65 private: | 77 private: |
| 78 // Used for creating MockSessionDescription. |
| 79 MockMediaStreamDependencyFactory* dependency_factory_; |
| 80 |
66 std::string signaling_message_; | 81 std::string signaling_message_; |
67 std::string stream_label_; | 82 std::string stream_label_; |
68 bool stream_changes_committed_; | 83 bool stream_changes_committed_; |
69 talk_base::scoped_refptr<MockStreamCollection> local_streams_; | 84 talk_base::scoped_refptr<MockStreamCollection> local_streams_; |
70 talk_base::scoped_refptr<MockStreamCollection> remote_streams_; | 85 talk_base::scoped_refptr<MockStreamCollection> remote_streams_; |
| 86 scoped_ptr<webrtc::SessionDescriptionInterface> local_desc_; |
| 87 scoped_ptr<webrtc::SessionDescriptionInterface> remote_desc_; |
| 88 bool hint_audio_; |
| 89 bool hint_video_; |
| 90 Action action_; |
| 91 std::string description_sdp_; |
| 92 IceOptions ice_options_; |
| 93 std::string ice_label_; |
| 94 std::string ice_sdp_; |
| 95 ReadyState ready_state_; |
71 | 96 |
72 DISALLOW_COPY_AND_ASSIGN(MockPeerConnectionImpl); | 97 DISALLOW_COPY_AND_ASSIGN(MockPeerConnectionImpl); |
73 }; | 98 }; |
74 | 99 |
75 } // namespace webrtc | 100 } // namespace webrtc |
76 | 101 |
77 #endif // CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ | 102 #endif // CONTENT_RENDERER_MEDIA_MOCK_PEER_CONNECTION_IMPL_H_ |
OLD | NEW |